History (bulk)
Many assets over many dates, in one request
History returns one row per asset per date, with the fields you choose, for a list of tickers or a whole group of assets over a date range. It's for research and backtests: seven years of weekly P/E for every stock is one request, read in pages, instead of 409 Universe calls. It costs the same credits as those separate calls would.
Parameters
Send either tickers or a group (asset_class, member_of, held_by), not both. With neither, you get every asset. For a long ticker list, send the same parameters as a JSON body with POST.
| Parameter | Default | Description |
|---|---|---|
tickers | — | Up to 5,000, as a comma-separated list or a JSON array. Unknown tickers are listed in unknown_tickers and cost nothing |
asset_class | all | stock, etf or crypto |
member_of, held_by | — | Members of an index, or holdings of a fund, on each row's date, as in Search |
fields | — | Required unless ohlcv=true. Up to 30 fields from Schema, as in Universe. ticker, date and asset_id always come. Market fields aren't available here; get them from Market and join on date |
timeframe | daily | daily or weekly |
start, end | your plan's first date, today | Inclusive dates, YYYY-MM-DD. How far back you can read depends on your plan |
ohlcv | false | true adds the price bar to each row: ohlcv_open, ohlcv_high, ohlcv_low, ohlcv_close, ohlcv_volume, as on OHLCV |
adjustment | split | With ohlcv: split, split_dividend or raw. See OHLCV |
limit | the page size | Rows per page. A page holds up to 20,000 rows on Free and Plus and 90,000 on Pro and Commercial, fewer with many fields. A larger limit is lowered, not refused; page_size says what was used |
page_token | — | A token from the first page, to read another page. See Pages |
dry_run | false | true returns the price and the number of pages, without rows and without charging |
Rows
Rows come grouped by asset, then in date order. ticker is the symbol the asset had on that date, so a 2020 row for today's META says FB. Group by asset_id, which never changes for an asset and never joins two companies that shared a symbol. Delisted assets keep their rows.
A row for date D includes everything known by 04:00 UTC the next morning, so a backtest acting on it should trade at the next session's open.
Pages
The first page carries pages (how many there are) and page_tokens, one token for each of the others. Send the same request with page_token to read one. Pages hold whole assets, so you can fetch them in any order, up to four at a time; in token order they keep the asset and date order.
When a single asset has more rows than a page holds, its page continues with next_page_token: send it as page_token until it comes back null. Tokens last 24 hours and only work for your account.
Credits
The whole request is charged once, on the first page; the other pages are free. It costs exactly what the same data would cost through separate calls:
- A group (or every asset): one Universe call per date, so dates × 25 credits per 10 fields, however many assets.
- A ticker list: per ticker, 1 credit per 50 dates (a Summary range call), plus 1 per 100 dates with
ohlcv(OHLCV bars). At most the Universe price for the same dates.
ohlcv=true counts as 5 fields in the Universe price. Use dry_run=true to see the price before you pay it.
| Request | Credits | The same as |
|---|---|---|
tickers=AAPL, 7 years weekly (409 dates), any fields | 9 | 9 Summary range calls |
asset_class=stock, 7 years weekly, 10 fields | 10,225 | 409 Universe calls at 25 |
| 500 tickers, 5 years daily (about 1,258 sessions), 10 fields | 13,000 | 500 × 26 Summary range calls |
| Every asset, 3 years weekly, 10 fields | about 3,900 | about 157 Universe calls at 25 |
Limits
- Up to 5,000 tickers and 30 fields per request.
- Up to 2 million rows per request on Free, 6 million on Plus, and 25 million on Pro and Commercial. Split anything larger by dates, asset class or tickers.
- Up to 40 pages per 10 seconds per API key. This is counted separately from your other calls, so a large pull doesn't slow them down.
Response fields
| Field | Type | Description |
|---|---|---|
rows | object[] | The rows, with the keys in fields. See Rows |
fields | string[] | ticker, date, asset_id, your fields, then the ohlcv_* keys |
scope | string | tickers or universe. With tickers, also tickers_requested and unknown_tickers; with a group, asset_class and membership |
start, end | string | The first and last dates covered |
cost | object | On the first page and a dry run: credits charged, plus the counts behind them (dates, rows, assets) and both prices (by_date for Universe calls, by_ticker for per-ticker calls). Later pages say credits: 0 |
pages, page_tokens | integer, string[] | First page only: how many pages, and a token for each of the others |
row_count, has_more, next_page_token | integer, boolean, string | null | Rows on this page, and whether this page continues |
page_size, limit_note | integer, string | Rows per page, and a note when your limit was lowered |
adjustment | string | With ohlcv: the price basis used |
history_start, plan | string | Your plan's first readable date, and your plan |
knowledge_cutoff, band_contract | string | As on Universe |
Errors
| Status | error.type | Cause | What to do |
|---|---|---|---|
400 | invalid_parameter | No fields, an unknown field, too many tickers or fields, tickers together with a group, start after end, adjustment without ohlcv, or a bad page_token. | Read the message: it names the problem. |
400 | request_too_large | More rows than your plan allows in one request. The message gives the row count and price. | Split it by dates, asset class or tickers. |
402 | insufficient_credit_balance | Not enough credits for the whole request. Nothing is charged. | Check the price with dry_run=true, then add credits or narrow the request. |
403 | tier_restricted | start is before your plan's first readable date. | Start at history_start or later, or upgrade. |
404 | ticker_not_found | None of the tickers exist. | Check the symbols, or find them with Search. |
404 | no_data | No rows in the range for these assets. Not charged. | Widen the range, or try the other timeframe. |
413, 415 | payload_too_large, unsupported_media_type | A POST body over 256 KB, or not sent as JSON. | Send a smaller list with Content-Type: application/json. |
429 | rate_limit_exceeded | More than 40 pages in 10 seconds. | Wait 10 seconds. Fetch at most four pages at a time. |
429 | too_many_concurrent_queries | Requests for more than 15 fields, or with member_of or held_by, share a limited pool, and it's busy. | Wait for the Retry-After seconds and send it again. |
Errors aren't charged. Authentication and other rate-limit errors are on Authentication and Errors & Caching.