Skip to content

Guide

Does Alpaca have an API?

Yes. Alpaca has a Trading API. It signs each request with a key ID and a secret key. You generate the pair in the Alpaca dashboard, for paper or live. Nyria connects Alpaca with that pair. A TradingView alert can't call the API itself. It posts to Nyria's webhook, and the bot places the order.

Official documentation

Connect Alpaca in five steps

  1. 1

    Open an Alpaca account

    Sign up at alpaca.markets. A paper account is free and starts with simulated cash.

  2. 2

    Generate your keys

    In the Alpaca dashboard, switch to Paper or Live. Select Generate New Keys. Copy the key ID and the secret. Alpaca shows the secret once.

  3. 3

    Connect Alpaca in Nyria

    Select Integrations, then the Alpaca card. Pick the paper or the live account option to match the key. Paste both values.

  4. 4

    Point TradingView at Nyria

    Create a strategy with TradingView as the source. Under Notifications, tick Webhook URL, paste the strategy's URL, then select Apply.

  5. 5

    Test on paper first

    Deploy a bot on the Alpaca paper account and set a budget per entry. Add a live bot on the same strategy later.

What the API does

  • The Trading API places and manages orders at Alpaca.
  • A key ID and a secret key sign each request.
  • Paper and live accounts have separate keys.
  • Live requests go to api.alpaca.markets. Paper goes to paper-api.alpaca.markets.
  • Paper trading is free for every Alpaca user.

Why an alert can't call it

  • A TradingView alert can't call the Alpaca API itself.
  • It sends a webhook. Something has to place the order.
  • Nyria is that receiver, and it never places an order by itself.
  • Your alerts and strategy rules decide every entry and exit.

How Nyria connects Alpaca

  • You paste the key ID and the secret once.
  • Nyria checks them with Alpaca and fills in the account number.
  • A paper key works only on paper. A live key works only on live.
  • Nyria trades stocks, options up to 4 legs and crypto spot at Alpaca.
  • A budget per entry sets the order size.

What it can't do

  • Trade fractional shares. Stocks go in whole shares.
  • Let an alert set the order size.
  • Trade crypto perpetuals. Alpaca doesn't offer them.
  • Move money.

Questions

Can a TradingView alert call the Alpaca API?
No. An alert sends a webhook. Nyria receives it and places the order.
Do I need to write code for the Alpaca API?
No. Generate a key in the dashboard and paste it into Nyria.
Can one key trade paper and live?
No. Each account has its own key. A paper key works only on paper.
Can I test before using real money?
Yes. Connect an Alpaca paper key, or use Nyria Paper. Both are free.
What happens to my key if I disconnect?
Removing the account deletes Nyria's copy. The key still works at Alpaca until you regenerate it.
Does an Alpaca key expire?
No. Alpaca keys don't expire on a schedule. Regenerating a key voids the old pair.

Next

More TradingView to Alpaca guides

Try a paper bot first

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