Earliest historical data
get_head_timestampDetermine how far back IBKR has historical data for an instrument before requesting bars, preventing empty results and helping set the correct start date.
Instructions
Return the earliest date and time IBKR has historical data for an instrument.
Use it before long get_historical_bars requests, or when they come back empty, to
learn how far back the data goes for this `what_to_show`. Needs market-data
permissions for the instrument; counts toward IBKR's historical-data limits.
Errors: not_found (no such contract, or no data of that type).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| 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. | |
| what_to_show | No | Data the values are built from. TRADES (not for forex), MIDPOINT, BID, ASK, BID_ASK (counts double for pacing), ADJUSTED_LAST (split/dividend adjusted; end must be empty), HISTORICAL_VOLATILITY and OPTION_IMPLIED_VOLATILITY (stocks, indexes), REBATE_RATE and FEE_RATE (stock loan), YIELD_BID, YIELD_ASK, YIELD_BID_ASK, YIELD_LAST (bonds), AGGTRADES (crypto). | TRADES |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| use_rth | Yes | ||
| contract | Yes | ||
| earliest | Yes | Earliest available data (UTC). | |
| what_to_show | Yes |