Skip to content
Nyria Docs

Build Your First Nyria Strategy

Your first end-to-end trade: connect Nyria Paper in one click, create a strategy, send a test alert, watch the bot fire, then flatten the position.

By the end you will have a simulated broker connected, a Nyria strategy with its own webhook token, a deployed bot, one filled paper trade triggered from a curl call, and a clean flat position.

Paper only. This tutorial routes every order through Nyria Paper, a fully simulated account. Do not point any of the webhook calls below at a live broker until you have read Known Limitations and Risk Disclosure.

What you will need

  • A Nyria account at app.nyria.io. The free tier is enough. Nothing here costs anything.
  • About 15 minutes. You do not need the market to be open: Nyria Paper simulates fills at any hour, including weekends.
  • A terminal that can run curl (macOS, Linux, or Windows PowerShell; examples for both below).

You do not need a brokerage account, an API key, or a developer signup. The account you create in Step 1 is built into Nyria.

Step 1: Connect Nyria Paper

Nyria Paper is Nyria's built-in simulated broker. It is free, connects in one click, and covers stocks, options, crypto spot, and perpetuals.

Sign in to app.nyria.io.

In the left sidebar, click Integrations.

Click the Nyria Paper card in the Brokers grid.

Click Create Nyria Paper account. There is no credential form and no redirect anywhere.

The Integrations list now shows Nyria Paper with a green Connected badge and the account labelled Simulated account. It never expires and never needs reauthorizing.

For what the simulator does and does not model, see Nyria Paper and Paper Trading.

Prefer to test against a real broker's sandbox instead? Alpaca and Tradier both offer their own paper accounts. See the Alpaca setup guide or the Tradier setup guide. The rest of this tutorial is broker-agnostic past this step.

Step 2: Create the strategy

A strategy in Nyria is a parser configuration plus a unique webhook URL. The webhook URL contains a token (we call it a tokenHash in the codebase, and it is the only piece of authentication on the webhook endpoint).

In the left sidebar, click My Strategies, then Create Strategy.

Fill in:

  • Strategy Name: First Strategy
  • Public URL: first-strategy
  • Signal Source: Custom (we will use curl for the smoke test)

Click Next to move to What it trades.

Step 2a: Configure trading behavior

Asset Type: Stocks

Long Behavior

  • On a long entry signal: Enter Position
  • Enable exit orders: on
  • Order Type: Market

Short Behavior

  • On a short entry signal: Do Nothing

Short-selling is intentionally off for this first run. You can flip it on later once you understand the long flow.

Click Next.

Step 2b: Set access, instrument, and create

The wizard runs Who can copy it, then Which tickers, then a final review.

Who can copy it: choose Private, then click Next.

Which tickers: type SPY in the instrument search, click the result, then click Next.

Review: check the summary, then click Create Strategy.

Nyria drops you on the strategy's detail page, on the Integration tab.

Step 3: Grab the webhook URL (the tokenHash)

On the strategy page, click the Integration tab.

You will see a URL of the form:

https://trades.nyria.io/webhooks/4f9c2a91b7d34e0fae9c1b6d2e8f0a4c...

Click Copy. The segment after /webhooks/ is the strategy's tokenHash, a 64-character hexadecimal string with no prefix. Treat it like a password: anyone with this URL can fire orders into your strategy.

Paste the URL into a scratchpad. You will use it in Step 5.

Do not commit the webhook URL to a public repo or share it in a screenshot. If you ever leak it, click Rotate token on the same Integration tab. It invalidates the old URL immediately. Any alert source still pointed at the old URL stops working, so update those too.

For the complete list of fields Nyria accepts in the webhook body, see Webhook Reference.

Step 3a: Validate the alert formats

A new strategy is a draft, and a draft cannot run a bot. Validating your alert formats is what activates it. A banner on the Integration tab says Please validate your alert formats to activate your strategy until you do.

Still on the Integration tab, find the Alert Validation card. It shows one box per alert this strategy uses. With the behavior set in Step 2a, that is Long Entry and Long Exit.

Paste a sample alert into each box, exactly as your alert source will send it. This tutorial fires the payloads below in Steps 5 and 7, so use them here:

  • Long Entry: {"ticker": "SPY", "action": "buy"}
  • Long Exit: {"ticker": "SPY", "action": "sell"}

Click Validate Alert Formats. Nyria parses each sample the way a live alert would be parsed. No orders are placed.

Every box turns Valid, the card's badge flips from Not Validated to Validated, and the banner disappears. The strategy status is now Active.

Do not skip this. Until the strategy is Active, Step 4 fails with Bots can only be deployed to active strategies.

Step 4: Deploy the bot

A strategy parses alerts; a bot is what actually places orders. One strategy can power many bots (one per broker account, one per position size, etc.). You need exactly one for this tutorial.

On the strategy page, click Deploy a bot.

This strategy allows one ticker, so the wizard has no Instruments step. Work through the three steps in order:

  • Size: A dollar budget, Budget per signal ($) 1000. The budget has to cover one share of SPY. Below that, the form names the minimum and Next does not advance.
  • Account: Nyria Paper, the connection from Step 1.
  • Review: check the summary.

Click Deploy Bot.

The bot now appears under My Bots in the sidebar with status Active.

Step 5: Send a test webhook

This is the moment of truth. Send one HTTP POST to the webhook URL from Step 3 and watch the bot place a simulated order.

Step 5a: Choose your terminal

The payload below is the 2-field minimum documented in Webhook Reference: ticker plus action. Nyria infers everything else from the strategy config.

macOS / Linux (bash or zsh):

curl -i -X POST 'https://trades.nyria.io/webhooks/REPLACE_WITH_YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "ticker": "SPY",
    "action": "buy"
  }'

Windows PowerShell:

Invoke-RestMethod `
  -Uri 'https://trades.nyria.io/webhooks/REPLACE_WITH_YOUR_TOKEN' `
  -Method Post `
  -ContentType 'application/json' `
  -Body '{"ticker":"SPY","action":"buy"}'

Replace REPLACE_WITH_YOUR_TOKEN with the tokenHash you copied in Step 3. Keep the rest of the URL exactly as shown.

Step 5b: Fire it

Run the command. A successful POST returns HTTP 200 with "status": "processed" in the JSON body.

If instead you get:

  • 400: the token is not a valid token. Re-copy it from the Integration tab.
  • 404: no strategy matches that token. Re-copy it from the Integration tab.
  • 200 with "rejected": true or "status": "rejected": the alert arrived but was not acted on. The message or reason says why: usually a strategy that is not Active, or an instrument outside the strategy's list.
  • 200 with "status": "duplicate": the identical body was already sent in the last few minutes.
  • 500: the alert could not be processed. The error text says why.

The full status table is in Handle the response.

Step 6: Watch the bot fire

Switch back to the Nyria UI.

Open the strategy and click the Logs tab. Within a second or two you should see an entry recording the parsed alert: SPY, long, entry.

Open the bot (sidebar → My BotsFirst Strategy) and click the Logs tab. Shortly after the strategy log, you should see a SUCCESS entry carrying the order id, the quantity, and the fill price.

Open the bot's positions and confirm an open long SPY position at roughly your $500 budget.

If nothing appears in the strategy log after ~30 seconds, jump to Troubleshooting below.

Step 7: Flatten the position

You now have an open long SPY position in the simulated account. Close it the same way you opened it, with one webhook call.

macOS / Linux:

curl -i -X POST 'https://trades.nyria.io/webhooks/REPLACE_WITH_YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "ticker": "SPY",
    "action": "sell"
  }'

Windows PowerShell:

Invoke-RestMethod `
  -Uri 'https://trades.nyria.io/webhooks/REPLACE_WITH_YOUR_TOKEN' `
  -Method Post `
  -ContentType 'application/json' `
  -Body '{"ticker":"SPY","action":"sell"}'

Because the strategy's Long Behavior → Exit is enabled, Nyria recognizes this as a flatten on the existing long position and routes a sell order for the exact quantity that was opened.

In the bot log, you should see a second SUCCESS entry for the closing side.

The bot's open positions should now be empty, and the closed trade should appear with its realized P&L.

That is the full lifecycle: alert in, parsed, ordered, filled, closed, flat.

That P&L is simulated. Nyria Paper fills at the price on the alert, so it pays no spread and takes no slippage. A paper result reads better than the same alerts traded live. Paper Trading lists everything a simulated fill does not test.

What to do next

  • Wire up TradingView. The same strategy works with TradingView alerts. Paste the webhook URL into a TradingView alert's webhook field and use the message format described in the TradingView setup guide.
  • Add options. Edit the strategy, change Asset Type to Options, and add a leg (e.g. buy 1 ATM call, 7–31 DTE). The webhook payload stays the same. Nyria picks the contract from the leg config. See Multi-leg options.
  • Connect a real broker. See Alpaca, Schwab, tastytrade, or Tradier. The strategy from this tutorial does not need to change. Deploy a second bot pointing at the new broker and the same alert fans out to both.
  • Read the deeper guides. Strategies covers every parser knob. Bots covers position sizing, instrument filters, and pausing/resuming.

Troubleshooting

Strategy log shows nothing after the curl

  • Confirm the curl actually got a 200 back. The -i flag above prints the status line; if you dropped it, add it back.
  • Confirm you copied the tokenHash from this strategy's Integration tab, not another strategy you also created.
  • Confirm the strategy's Status is Active, not Paused, on the detail page.

Strategy log shows the parse but the bot log is empty

  • The bot may be paused. Open the bot and check its Status header.
  • The alert's instrument may not be in the bot's selected instruments. Open the bot and check Instruments.

Bot log shows an error

  • Insufficient budget (...): your $500 position size is below the cost of one unit of the instrument. Raise the position size on the bot, or pick a cheaper instrument.
  • Anything else: copy the message from the bot log and check the Troubleshooting guide, then When an Order Fails.

"Could not parse alert"

The payload was malformed JSON or missing both ticker and action. Validate the JSON in a tool like jsonlint.com and resend. For the full set of accepted fields, see Webhook Reference.

Cleaning up

When you are done experimenting:

Open the bot, then choose Delete from its actions menu. A bot with open trades moves to Closing Only rather than disappearing, and stops acting on every signal, so close the position first if you want it gone. See Close a Position.

Delete the strategy from its Actions menu. This also invalidates the webhook URL.

Leave the Nyria Paper integration connected. It costs nothing and you will want it for the next strategy.

Nothing in this tutorial costs money or touches a real market. Every order was simulated inside Nyria.