get_historical_data()
get_historical_data()
The get_historical_data() function retrieves historical bar data for a given contract. Bars are returned as a list of Bar objects covering the requested duration and bar size.
Request Arguments
Contract Object for the instrument to retrieve market data for.
The request’s end date and time, formatted as "YYYYMMDD HH:mm:ss TMZ". Pass an empty string to indicate the current moment. Must be left as an empty string when requesting continuous futures contracts or certain whatToShow values such as ADJUSTED_LAST.
The total timespan the bars should cover. See Duration for details.
The time span covered by each bar. See Bar Sizes for details.
Determines what kind of data should be returned. See whatToShow for more details.
Define if data should only be returned from the regular trading session or if extended trading hours should be included. Default: True, returning only regular trading session data.
Determine the return structure of the date. Pass 1 to return a datetime formatted string or 2 to return an epoch Unix timestamp. Default: 1.
Duration to wait for the response until termination. Function-specific timeout default of 30 seconds.
Response Object
Requesting historical bars will return a list containing all Bar objects for the requested duration. Please be aware that directly printing this information may result in the memory address being displayed.

