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.

Hi again,

I used LatestQuotes end point and worked fine, thanks again.

I noticed volume data is not available with LatestQuotes. Is there a way to get volume data ?

Thanks,

-tansu

@tansu You asked about volume data for quotes. There isn’t any. Quotes are really just a single limit order. The quotes on Alpaca are all National Best Bid Offer (NBBO) quotes which means they are the single 1) most recent and 2) best (ie highest buy or “bid” and lowest “sell” or ask) limit order sitting on some trading venue (eg an exchange). The “size” in the quote data is simply the number of round lots (ie lots of 100 shares) which the order is for. Alpaca doesn’t offer any aggregated quote data to show the total of available quotes.

Does that make sense?

Thanks for the reply.

-tansu