Broker API HubMenu

Alpaca unsubscribe

messageunsubscribeAlpaca WebSocket streamsWebSocketMarket data

Removes symbols from the connection's subscriptions, by channel. The reply is the whole list that remains.

Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.

Independent and unofficialdocs.alpaca.marketschecked

This is a message of the Alpaca WebSocket streams, not an HTTP endpoint. It has no method and no path: it is sent as JSON, or as MessagePack where the client asks for it, over an open WebSocket connection.

The message

Name
unsubscribe
Direction
Request, sent by the client
Carried by
WebSocket. Every message is a JSON array of objects, each with a T field naming its type; control messages (success, error, subscription) come one to an array. The client must authenticate within 10 seconds of connecting, with a message or with headers in the handshake. The connection limit depends on the plan and is 1 for many; a second connection is answered with error 406.
Stocks, IEX feed (free plan)
wss://stream.data.alpaca.markets/v2/iex
Stocks, SIP feed (Algo Trader Plus)
wss://stream.data.alpaca.markets/v2/sip
Stocks, 15 minute delayed SIP
wss://stream.data.alpaca.markets/v2/delayed_sip
Test stream outside market hours, symbol FAKEPACA
wss://stream.data.alpaca.markets/v2/test
Crypto, Alpaca US
wss://stream.data.alpaca.markets/v1beta3/crypto/us

Fields

The vendor's page does not say which of these fields are required or always present.

NameTypeDescription
actionstringNames the message: unsubscribe.
tradesarray of stringsSymbols to stop receiving on the trades channel.
quotesarray of stringsSymbols to stop receiving on the quotes channel.
barsarray of stringsSymbols to stop receiving on the bars channel.
updatedBarsarray of stringsSymbols to stop receiving on the updatedBars channel.
dailyBarsarray of stringsSymbols to stop receiving on the dailyBars channel.
statusesarray of stringsSymbols to stop receiving on the statuses channel.
luldsarray of stringsSymbols to stop receiving on the lulds channel.
imbalancesarray of stringsSymbols to stop receiving on the imbalances channel.
orderbooksarray of stringsSymbols to stop receiving on the orderbooks channel.

What arrives

subscription: The whole subscription list after the change, in the same shape as the answer to subscribe.

NameTypeDescription
Trequired or not: not statedstringsubscription.

Sample

Written by this site from the fields recorded on this page. It has not been run against a terminal, a server or an account, and the values in it are placeholders. No credential is typed into it: where a field holds one, the placeholder says where it comes from. Nothing is entered on this site.

{
  "action": "unsubscribe",
  "quotes": ["AAPL"]
}

Limits that apply at Alpaca

LimitValueScopeSource
client_order_id length128POST /v2/orders and PATCH /v2/orders/{order_id}docs.alpaca.marketschecked
Crypto order size200,000Crypto spot orders, buy or selldocs.alpaca.marketschecked
Market data historical API, Basic plan200Market Data API historical calls, Basic (free) plandocs.alpaca.marketschecked
Market data points per page10,000Market Data API historical bars, trades and quotes, counted across all symbolsdocs.alpaca.marketschecked
Market data historical API, Algo Trader Plus10,000Market Data API historical calls, Algo Trader Plus plan (99 US dollars a month)docs.alpaca.marketschecked
GTC order age90Orders with time in force gtcdocs.alpaca.marketschecked
Trading API request rateHTTP 429 above the limit, with X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers on replies; no figure on the pages openedTrading API, per accountdocs.alpaca.marketschecked
Market data WebSocket authentication timeout10Market data WebSocket, from connecting to the auth messagedocs.alpaca.marketschecked
Market data WebSocket connectionsDepends on the subscription; 1 for many subscriptions and with none. A second connection is answered with error 406 connection limit exceededMarket data WebSocket, per accountdocs.alpaca.marketschecked
Market data WebSocket symbols, Basic plan30Market data WebSocket, US equities, Basic (free) plan; Algo Trader Plus is unlimiteddocs.alpaca.marketschecked