Historical ticks
get_historical_ticksFetch individual historical trades, quote changes, or midpoints (time and sales) for a contract. Page with start or end timestamps to retrieve up to 1000 ticks per request until the range is covered.
Instructions
Return individual historical trades, quote changes or midpoints (time and sales).
Give exactly one of `start` (ticks after it) or `end` (ticks before it). IBKR sends
at most 1000 ticks per request, with one-second timestamps, and may add a few to
finish the last second. When `truncated` is true there are probably more: page on
with start set to the last tick's time (or end set to the first tick's time); ticks
in that same second can repeat.
Needs market-data permissions for the instrument. Paced like small bars (about 60
requests per 10 minutes; BID_ASK counts double), so prefer get_historical_bars for
anything longer than minutes of activity.
Errors: not_found (no ticks in the range), invalid_request (both or neither
of start/end), rate_limit, ib_api_error 162 (pacing, permissions).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end | No | Return the ticks up to this time (ISO 8601; no offset means UTC). | |
| count | No | How many ticks, 1-1000 (IBKR's maximum). | |
| start | No | Return ticks from this time on (ISO 8601; no offset means UTC). Give exactly one of start and end. | |
| use_rth | No | True: regular trading hours only. False: include pre-market, after-hours and overnight data. | |
| contract | Yes | The instrument. A con_id alone is unambiguous; otherwise give symbol and sec_type, plus expiry, strike and right for options. | |
| ignore_size | No | BID_ASK only: skip ticks where only the sizes changed. | |
| what_to_show | No | TRADES (price, size, exchange, conditions), BID_ASK (bid/ask and sizes; counts double for pacing) or MIDPOINT. | TRADES |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end | No | Requested end (UTC), if given. | |
| count | Yes | How many ticks were requested. | |
| start | No | Requested start (UTC), if given. | |
| ticks | Yes | ||
| use_rth | Yes | ||
| contract | Yes | ||
| truncated | No | True when IBKR returned the full count, so more ticks probably exist: page on with start set to the last tick's time (or end set to the first tick's time). | |
| what_to_show | Yes |