void reqHistoricalData (TickerID id, const Contract &contract, String endDateTime, String durationStr, long barSizeSetting String whatToShow, int useRTH, int formatDate)
Parameter |
Description |
id |
The id of the request. Must be a unique value. When the market data returns, it will be identified by this tag. This is also used when canceling the market data. |
contract |
This object contains a description of the contract for which market data is being requested. |
endDateTime |
Defines a query end date and time at any point during the past 6 mos. Valid values include any date/time within the past six months in the format: yyyymmdd HH:mm:ss ttt where "ttt" is the optional time zone. |
durationStr |
Set the query duration up to one week, using a time unit of seconds, days or weeks. Valid values include any integer followed by a space and then S (seconds), D (days) or W (week). If no unit is specified, seconds is used. |
barSizeSetting |
Specifies the size of the bars that will be returned (within IB/TWS limits). Valid values include: Bar Size 1 sec 5 secs 15 secs 30 secs 1 min 2 mins 3 mins 5 mins 15 mins 30 mins 1 hour 1 day |
whatToShow |
Determines the nature of data being extracted. Valid values include: · TRADES · MIDPOINT · BID · ASK · BID_ASK · HISTORICAL_VOLATILITY · OPTION_IMPLIED_VOLATILITY |
useRTH |
Determines whether to return all data available during the requested time span, or only data that falls within regular trading hours. Valid values include: · 0 - all data is returned even where the market in question was outside of its regular trading hours. · 1 - only data within the regular trading hours is returned, even if the requested time span falls partially or completely outside of the RTH. |
formatDate |
Determines the date format applied to returned bars. Valid values include: · 1
- dates applying to bars returned in the format: · 2 - dates are returned as a long integer specifying the number of seconds since 1/1/1970 GMT. |
For a information about historical data request limitations, see Historical Data Limitations.