Skip to content
  • Deploy a strategy to Alpaca. The strategy's Deploy page: the budget per entry at its starting figure, the Alpaca account picked, Deploy, then the new bot's page in My bots, on Alpaca.
  • Alpaca on Nyria: a first order from an alert. The Alpaca paper account shows as connected in Nyria, then a bot on it places a BTC buy from an alert and shows the filled position.
  • Connect Alpaca to Nyria. Connecting Alpaca on Nyria's Integrations page: Connect paper account, the Authorize Nyria notice, the paper API key ID and secret key entered, then the paper account shown as Connected.
Alpaca

Broker · Live now

How do I use the Alpaca API with TradingView?

Connect Alpaca in Nyria with an API key. Paste the strategy's webhook URL into a TradingView alert. Each alert becomes an Alpaca order. It trades stocks, ETFs, options up to 4 legs or crypto spot. Test free on Alpaca's paper account or Nyria's own paper trading first.

StocksOptionsCrypto
The strategy's Deploy page: the budget per entry at its starting figure, the Alpaca account picked, Deploy, then the new bot's page in My bots, on Alpaca
Brokers/Alpaca

On Alpaca

Paper and live, one key each

Connect Alpaca's paper and live API keys. Test on paper, then go live.

Stocks, options and crypto

US stocks, ETFs, options up to 4 legs and Alpaca's crypto spot pairs.

The steps

  1. 1

    Create a Nyria account

    Sign up free. Paper needs no card.

  2. 2

    Connect Alpaca

    Create an API key and secret in your Alpaca dashboard, paper or live. Paste both into Nyria's Alpaca card. Nyria fills in the account number.

  3. 3

    Create a strategy

    Pick TradingView as the alert source. Choose stocks, options or crypto, then set what an entry and an exit do.

  4. 4

    Add the TradingView alert

    Paste the strategy's message and webhook URL into the alert. TradingView sends webhooks on paid plans with two-factor sign-in on.

  5. 5

    Deploy a bot

    Pick the Alpaca account and set the budget per entry. The Logs tab shows the ticker, side and contract each alert read.

Watch the setup

How to automate TradingView alerts to Alpaca
Connect Alpaca and build a TradingView strategy. Check the alert format, deploy a bot.
Steps in the video
  1. 0:00Connect Alpaca. Open Integrations and the Alpaca card. Pick Paper or Live and accept. Paste the API key ID and secret from your Alpaca dashboard.
  2. 0:22Create a strategy. Select Create strategy and name it. Then, select your alert source. This example uses TradingView. Pick stocks and a ticker, then create the draft.
  3. 0:50Create the alert in TradingView. Copy the webhook URL and the alert message from the Integration tab. In TradingView, select Message, paste the message and select Apply. Then select Notifications, tick Webhook URL, paste the URL and select Apply.
  4. 2:32Check the format. Select Check format and add an entry and an exit alert. Nyria shows the ticker, side and order it read.
  5. 2:52Deploy a bot. Select Deploy bot, set a budget per entry and pick an account. Nyria Paper is free, so test there first. On your own Alpaca account, pick it on the Account step. Send a sample alert and watch the paper order fill.

Asset class support

Asset classSupportedNotes
StocksUS equities, in whole shares
ETFsUS ETFs, in whole shares
OptionsSingle legs and spreads up to 4 legs
CryptoCrypto spot pairs Alpaca lists
FuturesNot offered by Alpaca

Trading features

Live trading
Paper trading
Fractional shares
Short selling
Margin trading
Multi-leg options (up to 4 legs)
Extended hours

Order types and durations

Market orders
Limit orders
Day
Good till canceled (GTC)
Fill or kill (FOK)

Options orders go as Day. Crypto orders go as GTC. On live accounts, stops and targets are exit alerts. Alpaca paper takes stop, trailing stop, bracket and OCO orders on stocks and ETFs. Trailing stops need a trail of 0.1% or more. Alpaca paper takes stop-limit orders and percent-of-account sizing on spot crypto. An exit alert can flatten a position. A bots list in the alert picks which bots trade.

Revoke the key any time

Connecting Alpaca lets Nyria read your account and place the orders your alerts trigger.

Alpaca doesn't warrant or endorse Nyria. Before connecting, read the Alpaca integration docs.

From the sources

Full walkthrough: Alpaca automated trading.

Questions

How do I automate TradingView alerts to Alpaca?

Connect Alpaca in Nyria, create a strategy with TradingView as the source and paste its webhook URL into a TradingView alert. Each alert becomes an Alpaca order, and the strategy stays inactive until a test alert reads correctly. Full steps: TradingView to Alpaca.

Can I run a strategy on Alpaca paper?

Yes. Alpaca issues separate paper and live API keys. Connect both and test on paper first.

What can Nyria trade on Alpaca?

US stocks and ETFs in whole shares, and options up to 4 legs. Plus the crypto spot pairs Alpaca lists. Futures aren't offered.

What does Nyria do with the Alpaca key?

It reads the account, fills in your account number and places and cancels orders. The key is encrypted at rest. Revoke it in the Alpaca dashboard any time.

Do I need a server to send TradingView alerts to Alpaca?

No. Nyria hosts the webhook URL and runs in the cloud with nothing to install. It places each order at Alpaca with the API key you paste in.

Which hours does Nyria trade at Alpaca?

Stocks and options run in the regular session, with no extended hours. Alpaca stops new orders on contracts expiring that day after 3:15 pm ET. The cutoff is 3:30 pm ET for broad-based ETFs such as SPY and QQQ. Nyria skips such an entry instead of sending an order Alpaca would refuse.

Test for free on paper first

Free on paper, no card required. Then run the same strategy on Alpaca.