Use a single call to get multiple data endpoints for multiple symbols
Batch calls allow you to pull data for multiple symbols and endpoints in a single call. There are also some market-wide stats/info endpoints you can include in batch calls. The endpoint path for a batch call is always “/stock/market/batch.”
Batch Call Query String
The query string for a batch call contains:
-
A token parameter, as always
-
Types parameter (required) – this is a comma-separated list of the different endpoints you want returned as part of the batch call. More information on types is below under the "Types" header.
-
Symbols parameter (optional): For any of the “By Symbol” types listed below, you can specify which symbols you want data for in this parameter. The value of the parameter should be a comma-separated list of symbols (up to 100). So if you wanted data only for AAPL and GOOG you would include “symbols=goog,aapl” in your query string. (NOTE: If you do not include a symbols parameter the default behavior is to return the data for ALL relevant symbols. Please be cautious when using this behavior as it can drive up credit usage quickly.)
-
Other parameters for your selected types – you can specify any of the query parameters for your given types within the query string of the batch call. For example, if you wanted to get a 5-year chart in the batch call you would need to include “chart” in your types parameter and include a parameter of “range=5y” in your query string.
Types
Types can be symbol-specific or market-wide stats/info. Supported batch call types include:
-
By Symbol: chart (historical and intraday prices), list (for getting latest quotes), news, ohlc, peers, previous, price, price-target, recommendation-trends, splits, upcoming-events, upcoming-earnings, upcoming-dividends, upcoming-splits, upcoming-ipos
-
Market-Wide: collections, today-earnings, today-ipos, volume (market volume), sector-performance
Example Batch Call
Putting it all together, here’s an example of a test batch call that fetches news, 5-year historical prices, and 5 years of splits data for AAPL, GOOG, and FB: