Skip to content

Guide / Checked Nov 2026

Alpaca API TradingView setup

Alpaca's API takes a key and secret from your Alpaca dashboard, paper or live. A TradingView alert only posts its message to a URL. Nyria reads that message and sends the order to Alpaca.

Official documentation

From alert to Alpaca order

  1. 1

    Generate the Alpaca key

    At alpaca.markets, open Paper Trading or Live Trading and select API Keys. Generate a key and copy the secret now. It's shown once.

  2. 2

    Paste it into Nyria

    Open Integrations, choose Alpaca and paste the key and secret. Paper and live keys are separate at Alpaca. Connect both.

  3. 3

    Copy the strategy URL

    Select Create strategy with TradingView as the source. Copy the URL Nyria shows. Its token is the only authentication, so keep it private.

  4. 4

    Send the alert

    In TradingView, paste the URL under Webhook URL. From code, POST the JSON to the URL. Use /v1/alerts to get an order_id back.

  5. 5

    Read fills

    GET /v1/positions lists open positions for each account with a bot on the strategy. GET /v1/orders/{order_id} shows one order's status and fill.

Send an alert from code

Webhook POST

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

Limit entry, JSON

{ "action": "OPEN", "instrument": "QQQ", "direction": "LONG", "order_type": "limit", "price": 740 }

Buys QQQ at a $740 limit. Size still comes from the bot.

What the Alpaca API needs

  • An API key and secret from your Alpaca dashboard, paper or live.
  • Paper and live keys are separate.
  • Options go as Day orders, crypto as GTC.
  • Alpaca paper takes stop, trailing stop, bracket and OCO orders on stocks and ETFs.
  • Live accounts take market and limit orders.

Why an alert can't call it

  • A TradingView alert only posts its message to a URL.
  • Alpaca doesn't read alert text and place orders from a URL.
  • TradingView sends webhooks on paid plans with two-factor sign-in on.

How Nyria places the order

  • TradingView posts to Nyria's webhook URL, and Nyria places the order at Alpaca.
  • A POST with a ticker and an action is enough. Plain text works too.
  • The message never sets the size. Each bot's budget per entry does.
  • Stocks and options up to 4 legs. Crypto spot too.
  • Alert to order, sub-second.

For developers

  • The webhook reply carries no order id. To get one back, send through the REST API.
  • nyria_preview_alert shows how Nyria reads an alert. Places nothing.
  • The REST endpoints and all eight MCP tools are listed at nyria.io/developers.

What it can't do

  • Order forms beyond market and limit on live accounts. Stops and targets are exit alerts.
  • SPX options. Those go to Charles Schwab, Tradier and tastytrade, not Alpaca.
  • Futures. Alpaca doesn't offer them.
  • An order id in the webhook reply. The REST API gives one back.

Questions

Does the Alpaca API work with TradingView?
Not by itself. A TradingView alert only posts to a URL. Nyria is the receiver that turns it into an Alpaca order.
Do I need an Alpaca API key?
Yes. Generate the key and secret in the Alpaca dashboard, paper or live. Paste them into Nyria.
Can I use the Alpaca paper API with TradingView alerts?
Yes. The paper key is separate from the live one. Connect it and test there first.
Can I send alerts from Python instead of TradingView?
Yes. Any HTTP client can POST the same JSON to the strategy URL. For an order_id back, use POST /v1/alerts.
Does Nyria send back the Alpaca order id?
Only through the REST API or MCP. The webhook reply carries no order id.
Can Claude or Cursor trade my Alpaca account?
Yes, over Nyria's MCP endpoint, with the strategy's token in a Bearer header. Start with a paper bot.

Next

More TradingView to Alpaca guides

Try a paper bot first

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