Historical Data
Subscribe to Historical Data
Request streaming historical bar data for a contract. Only a maximum of 5 concurrent historical data requests are available at a time. Historical data will respond once with the requested data; the subscription must still be cancelled after data is received.
Request
smh+{{conid}}+{"exchange":"exchange", "period":"period", "bar":"bar", "outsideRth": bool, "source":"source", "format":"format"}
Properties
The leading topic message indicating a request to retrieve historical bar data.
A single contract identifier. Contracts use SMART routing by default. To specify an exchange, use the format conId@EXCHANGE.
The exchange from which to request data.
Total duration for which bars will be requested.
Supported Values
{1-30}min, {1-8}h, {1-1000}d, {1-792}w, {1-182}m, {1-15}y
Interval of time for each bar.
Supported Values
1min, 2min, 3min, 5min, 10min, 15min, 30min, 1h, 2h, 3h, 4h, 8h, 1d, 1w, 1m
Set to true to include data outside regular trading hours. Defaults to false.
The type of market data to return.
Supported Values
"midpoint", "trades", "bid_ask", "bid", "ask"
The format in which bar values are returned.
Supported Values
%o (open), %c (close), %h (high), %l (low), %v (volume)
Response
Properties
Request identifier for the specific historical data request. Used when cancelling the subscription.
Symbol for the requested contract.
Company long name.
Price multiplier based on $0.01.
Starting time of the response in epoch format.
Highest high value, volume value, or outside RTH volume for the period.
Lowest low value, volume value, or outside RTH volume for the period.
Period covered by the request.
Length of the bar response string.
Internal IBKR message indicating market data availability.
Indicates any delay in the market data feed.
Indicates whether the data contains information outside regular trading hours.
Indicates whether volume is returned as lots, multipliers, or as-is.
Internal IBKR message.
Internal IBKR message.
Indicates whether the contract supports negative values.
Internal IBKR message version.
Array of bar objects within the requested period.
Opening value for the bar’s duration.
Closing value for the bar’s duration.
Highest value for the bar’s duration.
Lowest value for the bar’s duration.
Total volume for the bar.
Epoch time of the bar.
Total number of bars returned within data.
Restates the requesting topic.
Unsubscribe from Historical Data
umh+{{serverId}}
Request to cancel a historical data subscription using the serverId returned in the initial response. Cancelling frees one of the five available concurrent subscriptions.
Request
Properties
Unsubscribes the user from historical bar data for the given server identifier.
The serverId value returned in the initial smh response.
Response Example
Unsubscribing from historical data does not deliver any acknowledgement. There will be an end to the historical data stream for the given serverId, and one of the five concurrent subscriptions will become available again.

