Skip to content
  • Create a strategy with a custom webhook as its alert source. My strategies, then Create strategy: a strategy name typed in, Custom webhook picked as its alert source, then Next to what it trades, where Stocks is picked.
Alpaca logo

Alerts to orders

Automate webhook alerts to Alpaca

Nyria lets you auto trade each webhook alert in your Alpaca account.

Stocks and ETFsOptions up to 4 legsCrypto spot
My strategies, then Create strategy: a strategy name typed in, Custom webhook picked as its alert source, then Next to what it trades, where Stocks is picked

Setup steps

Have your script or service POST its alert to a Nyria strategy's webhook URL. Then connect your Alpaca account in Nyria with an API key. Each alert becomes an order in your own Alpaca account. Test it free on Nyria Paper or on an Alpaca paper account first.

  1. 1Connect Alpaca. In the Alpaca dashboard, switch to Paper or Live and select Generate New Keys. Copy the API key ID and the Secret key. Alpaca shows the secret once. In Nyria, open Integrations and select the Alpaca card. Select Connect paper account or Connect live account, then Accept and continue. Paste both values.
  2. 2Create a strategy. In Nyria, select Create strategy and pick Webhook as the alert source. Choose stocks, options or crypto as the asset type. Set what an entry and an exit do on each side.
  3. 3Point your service at the URL. Copy the webhook URL from the strategy's Integration tab. Send an HTTPS POST from a script, a cron job or a no-code tool. Zapier and Make, for example. The token is the only authentication, so keep the URL private. Rotate token replaces it.
  4. 4Send a test alert. Post a body such as {"ticker": "AAPL", "action": "buy"} with curl. Nyria answers 200 OK and the alert shows on the Logs tab. Bots on the strategy act on it. Test while only a paper bot is deployed.
  5. 5Deploy a bot. On the strategy, select Deploy bot. Pick the Alpaca account on the Account step and set a Budget per entry. Live bots need a Nyria Pro plan or a Premium strategy you have bought. The next alert becomes an order.

What a webhook alert must say

Nyria needs the ticker, the side, and whether it opens or closes a position. It reads plain text or JSON in your own wording. There is no template to follow. For options, Provided in alert reads the strike, expiry and call or put. From my rules picks the contract.

A webhook POSTs JSON or text. The smallest JSON body has two fields, ticker and action. A plain-text body such as AAPL long entry works too. The token in the URL is the only authentication. There is no Authorization header to set.

An alert cannot set the size: each bot's budget per entry does. Exits come from your exit alerts.

A stock entry

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

Buy NVDA. The alert carries no size. Each bot sizes it from its budget per entry.

A coin entry

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

Buy BTC spot at Alpaca in the pairs it lists, sized by each bot's budget per entry.

What Alpaca does with it

Alpaca connects with an API key, not a sign-in. A paper key works only on paper and a live key only on live. The same strategy can run on both.

Options go to Alpaca as single legs or spreads up to 4 legs. A spread is one order. Options trading must be turned on in the Alpaca account. Alpaca paper reaches Options Level 3, which covers four-leg structures.

Alpaca trades crypto spot in the pairs it lists. A crypto alert can open and close a coin position. Crypto orders go to Alpaca as good till canceled.

Each alert becomes a market or a limit order, as the strategy sets it. Duration is Day, GTC or fill or kill. 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.

Questions

Is there a rate limit on a webhook?
Each webhook takes 10 alerts at once, then one per second. An alert over that limit is dropped with a 429.
Can a webhook buy crypto at Alpaca?
Yes. Send a ticker and an action. Nyria buys spot in the pairs Alpaca lists, and an exit alert closes it.
Can Zapier or Make post to an Alpaca strategy?
Yes. Any HTTPS POST works, from a script, a cron job or a no-code tool. Alpaca itself connects with an API key.
Can one webhook feed a paper and a live Alpaca bot?
Yes. The same strategy can run on both. A paper key works only on paper and a live key only on live.
How does Nyria store my Alpaca key?
The key is stored encrypted at rest. It reads the account and places and cancels orders. Revoke it in the Alpaca dashboard any time.
Can I test before trading real money at Alpaca?
An Alpaca paper account connects the same way as a live one. The same strategy can run on both, each bot in its own size.
How fast does an alert become an order?
Sub-second, alert to order.

From the sources

Next

Webhook alerts, by account

Alpaca orders, by alert source

Send your first webhook alert

Trade and test free on paper. No card required.