Stream Read Limit - read limited at 16385 bytes

I’m running a unlimited plan account and subscribing to bars for ~4k symbols:

print('length of tickers = ', len(tickers))
>>>length of tickers =  4334
stream.subscribe_bars(print_bar, *tickers)

Results in the following error: websocket connection to: wss:// websocket error, restarting connection: code = 1009 (message too big), reason = read limited at 16385 bytes

Per the documentation - Real-time data - Documentation | Alpaca
Unlimited plan:

  • There is no limit for the number of channels at a time for trades, quotes and minute bars( trades , quotes and bars ).

Does anyone have any suggestions on how to get around this? Many applications for this api are going to involve scanning for criteria across a large number of tickers.

For others here, there is a threshold on how big of a subscription message you can send. So when trying to subscribe to a lot of tickers (~1000 or more), we have to subscribe to all tickers using the by passing in ‘*’ and then filter the streamed results to only the tickers we’re interested in.

Each subscription request is a ‘change’ request in fact. So you can just split your whole list of tickers on smaller chunks (with 100 items in each for example) and send several subscription requests.