Skip to content

Guide

Webhook trading bot for stocks

Nyria is a webhook trading bot for stocks. Each strategy gets a URL, and Nyria waits there for an alert, reads the ticker and the side, and has a bot place the order at your broker. A TradingView alert, a TrendSpider alert or your own script posts to it, and the order goes to your Charles Schwab, Alpaca, tastytrade or Tradier account, or to Nyria Paper first. You write no code unless your own script sends the alert.

Official documentation

Set up the bot

  1. 1

    Create the strategy

    In Nyria, select Create strategy and pick Webhook as the alert source, or TradingView if a chart sends the alert. Choose stocks as the asset type and set what an entry and an exit do on each side.

  2. 2

    Copy the webhook URL

    Open the strategy's Integration tab and copy the URL. It is https://trades.nyria.io/webhooks/ followed by a token that belongs to the strategy. The token is the only authentication, so keep the URL private.

  3. 3

    Post an alert to it

    Paste the URL into a TradingView alert's Webhook URL box, set it as a TrendSpider webhook, or POST to it from your own script. A body with a ticker and an action is enough, such as the one below, and plain text such as AAPL long entry works too.

  4. 4

    Check what Nyria read

    Select Check format, then Check and save. The strategy turns Active once Nyria reads the ticker and the side, and the Logs tab shows what it read for every alert after that. A 200 reply means the alert arrived, not that a broker filled it.

  5. 5

    Deploy a bot on Nyria Paper

    Select Deploy bot, choose Nyria Paper and set a Budget per entry. Stocks trade in whole shares. Let real alerts fire for a week or two and read the Logs tab against what you meant.

  6. 6

    Deploy a bot on your broker

    When the paper log reads right, deploy a second bot and pick the Charles Schwab, Alpaca, tastytrade or Tradier account on the Account step. The next alert becomes an order there.

Automate long and short stock trades from TradingView alerts
A SPY strategy with its own long and short behavior: entry alerts open the position and exit alerts close it.

Messages to copy

A stock entry, as JSON

{ "ticker": "NVDA", "action": "buy" }

The exit

{ "ticker": "NVDA", "action": "sell" }

What a stock webhook does

  • The alert names the ticker, the side and whether it opens or closes. It cannot set the size: each bot sizes the order from its Budget per entry.
  • Orders are market or limit. Exits come from your exit alerts.
  • Each webhook takes 10 alerts at once, then one per second. An alert over that limit is dropped with a 429.
  • Anyone who has the URL can post to it. Select Rotate token on the Integration tab to replace it.

Which accounts it trades

  • Charles Schwab, tastytrade and Tradier connect through the broker's own sign-in. Alpaca connects with an API key.
  • Nyria Paper is built in, free on every plan and needs no broker.
  • Nyria cannot move money out of any of them.

Questions

Do I need to write code for a webhook trading bot?
No, when the alert comes from TradingView or TrendSpider. Code is only needed when your own script sends the alert, and the Python guide has a short sender.
Which brokers can a stock webhook trade at?
Charles Schwab, Alpaca, tastytrade and Tradier, plus Nyria Paper for free.
Can the alert say how many shares to buy?
No. The bot sizes each order from the Budget per entry you set when you deploy it, in whole shares.
What does it cost?
Paper is free. Live trading from $15 a month.

Next

Try a paper bot first

No card required. Paper is free. Live trading from $15 a month.