Nyria Docs
Getting started

Build Your First Nyria Strategy

End-to-end first trade — connect a paper broker, create a strategy with a webhook token, send a test alert, watch the bot fire, then flatten the position.

By the end you will have a paper 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 a paper (simulated) broker 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.
  • ~15 minutes during US regular session hours (9:30am–4:00pm ET, Mon–Fri). Outside those hours the smoke test still parses correctly but the broker will reject the market order, which is harder to interpret as a beginner.
  • A terminal that can run curl (macOS, Linux, or Windows PowerShell — examples for both below).

The broker you connect in Step 1 has no fees and no real money at risk. You can throw the strategy away when you are done.

Step 1: Connect a paper broker

Nyria's paper broker of choice for this tutorial is Tradier Sandbox. It is free, opens instantly, and supports stocks plus options. If you already have a Tradier developer account, skip to Step 1c.

Step 1a: Open a Tradier sandbox account

Go to developer.tradier.com and click Sign Up.

Verify your email and log in to the developer portal.

The portal provisions a sandbox account with ~$100,000 in simulated cash. You do not need to copy any API keys — Nyria uses OAuth.

Step 1b: Open the Integrations tab in Nyria

Sign in to app.nyria.io.

In the left sidebar, click Integrations.

Click Add Integration in the top right.

Step 1c: Authorize Tradier Sandbox

In the broker picker, click the Tradier tile, then click Connect.

Choose Paper (Sandbox). Click Continue with Tradier.

Sign in with your Tradier developer-portal credentials. Click Authorize on Tradier's consent screen.

Tradier redirects back to Nyria. In the account selector, tick your sandbox account and click Save.

The Integrations list now shows Tradier (Paper) with a green Connected badge.

For the full Tradier walkthrough (including the live-trading flow and the weekend phantom-fill warning), see the Tradier setup guide.

Prefer a different broker? Alpaca paper works the same way — see the Alpaca 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:

  • Name: First Strategy
  • Public URL slug: first-strategy
  • Alert Source: Custom Webhook (we will use curl for the smoke test)
  • Visibility: Private

Click Next to move to the trading-behavior step.

Step 2a: Configure trading behavior

Asset Type: Stocks

Long Behavior

  • Entry: Enter Direction
  • Exit: Enabled
  • Order Type: Market

Short Behavior

  • Entry: Do Nothing
  • Exit: Disabled

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: Pick the instrument

In the instrument search, type SPY and click the result.

Click Next, then Create Strategy.

Nyria drops you on the strategy's detail page.

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/s_8f2a91c4b6e0d31a5c7e...

Click Copy. The s_8f2a91c4... segment is the strategy's tokenHash. 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.

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

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 Bot.

Fill in:

  • Integration: Tradier (Paper) — the connection from Step 1.
  • Account: the sandbox account you ticked.
  • Position Size: Fixed, value $500.
  • Instruments: Trade All.

Click Deploy Bot.

The bot now appears in the Bots 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 real (paper) order at Tradier.

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 -X POST 'https://trades.nyria.io/webhooks/s_REPLACE_ME' \
  -H 'Content-Type: application/json' \
  -d '{
    "ticker": "SPY",
    "action": "buy"
  }'

Windows PowerShell:

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

Replace s_REPLACE_ME 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 an HTTP 200 with a JSON body like:

{
  "ok": true,
  "strategy_log_id": "sl_01HXY...",
  "parsed": {
    "ticker": "SPY",
    "direction": "long",
    "action": "entry"
  }
}

If you get a 401, the tokenHash is wrong — re-copy it from the Integration tab. If you get a 422, the payload was unparseable; check the body matches the example exactly.

Step 6: Watch the bot fire

Switch back to the Nyria UI.

Open the strategy and click the Logs tab. Within ~2 seconds you should see a row:

parsed_alertSPYlongentry

Open the bot (sidebar → BotsFirst Strategy) and click the Logs tab. Within ~5 seconds of the strategy log, you should see:

  1. order_submitted with a Tradier order id like 2-abc12345.
  2. order_filled with the fill price and quantity.

In a separate browser tab, log into your Tradier sandbox account at sandbox.tradier.com and confirm the open position matches what Nyria shows.

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 paper account. Close it the same way you opened it — with one webhook call.

macOS / Linux:

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

Windows PowerShell:

Invoke-RestMethod `
  -Uri 'https://trades.nyria.io/webhooks/s_REPLACE_ME' `
  -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 order_submitted then order_filled for the closing side within ~5 seconds.

Refresh your Tradier sandbox positions page — SPY should no longer appear.

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

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 Webhook Reference.
  • Add options. Edit the strategy, change Asset Type to Options, and add a leg (e.g. buy 1 ATM call, 7–45 DTE). The webhook payload stays the same — Nyria picks the contract from the leg config.
  • Connect another broker. See Alpaca, Schwab, TastyTrade, or Binance. 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. If it returned silently, add -i to the command to print the status line.
  • 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 bot's Account may have been disconnected. Open Integrations and check the Tradier row has a green Connected badge — if it shows Reauth Required, click Reconnect and reauthorize.

Bot log shows order_rejected

  • market_closed — Tradier rejects market orders outside 9:30am–4:00pm ET. Wait for the session, or change the strategy's order type to Limit and include a "price": <number> field in the webhook payload.
  • insufficient_buying_power — your sandbox cash is exhausted. Reset the sandbox balance from the Tradier developer portal.
  • Anything else — copy the rejection string from the bot log and check the Troubleshooting guide.

"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:

Pause or delete the bot from its detail page (SettingsDelete Bot).

Delete the strategy from its detail page (SettingsDelete Strategy). This also invalidates the webhook URL.

Optionally, disconnect the Tradier integration from the Integrations page if you do not plan to use it again.

Nothing in this tutorial costs money or leaves residue beyond the test orders in your Tradier sandbox account, which Tradier resets on demand from the developer portal.