Getting realtime stock data for all symbols

Hi,

We are trying to get realtime ASK/BID prices for all (US_EQUITY and ACTIVE, ~11600 stocks) stocks and use subscribeForQuotes method with ~11600 symbol parameters.

Is there a better way for this?

Regards,

@tansu Streaming quotes for all symbols is A LOT of data. You will find it difficult, if not impossible, for your system to actually ingest and process all that data. I would recommend simply calling the latest_quotes endpoint. You can include multiple symbols in a single call. There is a practical limit of about 4000 symbols per call so one would need to make 2-3 calls. That is by far the simplest approach.

As a side note, you may want to look at a smaller subset of symbols. Just because a symbol is ‘tradable’ doesn’t mean you would always want to trade it. The majority of the ‘active’ symbols are things you may not want or shouldn’t be trading. Many are OTC and a lot are rights, warrants, limited partnerships, publicly traded partnerships (which have a tax withholding), ADRs, etc. Below is the filter I use to get a more ‘reasonable’ list of about 3500 symbols which you may want to consider. The ‘fractionable’ attribute is a simple shortcut set by the Alpaca Trading team and excludes extremely low volume symbols as well as many of the asset types above.

[asset.symbol for asset in asset_list if \
                    asset.fractionable 
                    and asset.exchange != "OTC" 
                    and asset.shortable \
                    and 'ptp_with_exception' not in asset.attributes \
                    and 'ptp_no_exception' not in asset.attributes \
                    and asset.maintenance_margin_requirement == 30]

Thanks for your reply.