Alpaca websocket data will not stream

Connection works. Authentication works.

Streaming does not work.

After sending the listen action, it responds with listening and with an empty list of streams. Here is my wscat to demo the issue, using the exact example from the documentation:

$$ wscat --connect wss://api.alpaca.markets/stream
Connected (press CTRL+C to quit)
> { "action": "authenticate", "data": { "key_id": "***", "secret_key": "***" } }
< {"stream":"authorization","data":{"action":"authenticate","status":"authorized"}}
> { "action": "listen", "data": { "streams": ["T.SPY", "Q.SPY", "AM.SPY"] } }
< {"stream":"listening","data":{"streams":[]}}

Notice above it returns {"streams":[]}. Why?

PS: Polygon’s websocket streaming works fine.

The URL is data.alpaca.markets

Okay, I think I have it sorted out. Please verify:

  • wss://data.alpaca.markets/stream is for streaming market data. Both LIVE and PAPER api keys work on this same URL. It seems to allow two simultaneous connections (one LIVE and one PAPER, which is nice).
  • wss://api.alpaca.markets/stream is for streaming account updates for the LIVE account.
  • wss://paper-api.alpaca.markets/stream is for streaming account updates for the PAPER account.
1 Like