Call this method to start receiving historical data results through the historicalData() event.
For a information about historical data request limitations, see Historical Data Limitations.
Public Overridable Sub reqHistoricalDataEx(ByVal tickerId As Integer, ByVal contract As TWSLib.IContract, ByVal endDateTime As String, ByVal duration As String, ByVal barSize As String, ByVal whatToShow As String, ByVal useRTH As Integer, ByVal formatDate As Integer)
Parameter |
Description |
tickerId |
The Id for the request. Must be a unique value. When the data is received, it will be identified by this Id. This is also used when canceling the historical data request. |
contract |
This structure contains a description of the contract for which market data is being requested. |
endDateTime |
Use the format yyyymmdd hh:mm:ss tmz, where the time zone is allowed (optionally) after a space at the end. |
durationStr |
This is the time span the request will cover, and is specified using the format: <integer> <unit>, i.e., 1 D, where valid units are: · S (seconds) · D (days) · W (weeks) · M (months) · Y (years) Note: If no unit is specified, seconds are used. Also, note "years" is currently limited to one. |
barSize |
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. |