Receiving historical data from the API has the same market data subscription requirement as receiving streaming top-of-book live data Live Market Data. The API historical data functionality pulls certain types of data from TWS charts or the historical Time&Sales Window. So if data is not available for a specific instrument, data type, or period within a TWS chart it will also not be available from the API. Unlike TWS, which can create 'delayed charts' for most instruments without any market data subscriptions that have data up until 10-15 minutes prior to the current moment; the API always requires Level 1 streaming real time data to return historical data.
- In general, a smart-routed historical data requests will require subscriptions to all exchanges on which a instrument trades.
- For instance, a historical data request for a pink sheet (OTC) stock which trades on ARCAEDGE will require the subscription "OTC Global Equities" or "Global OTC Equities and OTC Markets" for ARCAEDGE in addition to the regular subscription (e.g. "OTC Markets").
- When retrieving historical data from the TWS, be aware of the Historical Data Limitations.
Types of Historical Data Available
Finding earliest date historical data is available for an instrument
Note about Interactive Brokers' historical data:
- Historical data at IB is filtered for trade types which occur away from the NBBO such as combo legs, block trades, and derivative trades. For that reason the daily volume from the (unfiltered) real time data functionality will generally be larger than the (filtered) historical volume reported by historical data functionality. Also, differences are expected in other fields such as the VWAP between the real time and historical data feeds.
Changes in the date/time field
With the release of TWS 10.17 and TWS API 10.18 clients now can send date/time in different formats:
-
API allows UTC format "yyyymmdd-hh:mm:ss" in date/time fields.
Example: 20220930-15:00:00
-
API allows date/time field format with instrument's exchange timezone (for all non-operator fields) and operator's time zone (for all fields).
Example: IBM 20220930-15:00:00 US/Eastern