---
title: "Historical OHLC Bar Data"
method: GET
path: "/iserver/marketdata/history"
tags: ["tradingMarketData"]
---

# Historical OHLC Bar Data

`GET /iserver/marketdata/history`

Request historical data for an instrument in the form of OHLC bars.

## Query parameters

- `conid` integer, required
- `period` string, required
- `bar` string, required
- `exchange` string
- `outsideRth` boolean
- `startTime` string — UTC datetime string in format YYYYMMDD-hh:mm:ss.
- `direction` '-1' | '1'
- `source` string

## Response `200`

Historical data query successfully returned data.

- union
  - IserverHistoryBidAskResponse — Object containing the requested historical data and related metadata.
    - `serverId` string — Internal use. Identifier of the request.
    - `symbol` string — Symbol of the request instrument.
    - `text` string — Description or company name of the instrument.
    - `priceFactor` integer — Internal use. Used to scale Client Portal chart Y-axis.
    - `startTime` string — UTC date and time of the start (chronologically earlier) of the complete period in format YYYYMMDD-hh:mm:ss.
    - `high` string — Internal use. Delivers highest price value in total interval. Used for chart scaling. A string constructed as 'highestPrice*priceFactor/totalVolume*volumeFactor/minutesFromStartTime'.
    - `low` string — Internal use. Delivers lowest price value in total interval. Used for chart scaling. A string constructed as 'lowestPrice*priceFactor/totalVolume*volumeFactor/minutesFromStartTime'.
    - `timePeriod` string — The client-specified period value.
    - `barLength` integer — The client-specified bar width, represented in seconds.
    - `mdAvailability` string — A three-character string reflecting the nature of available data. R = Realtime, D = Delayed, Z = Frozen, Y = Frozen Delayed, N = Not Subscribed. P = Snapshot, p = Consolidated. B = Top of book.
    - `outsideRth` boolean — Indicates whether data from outside regular trading hours is included in the response.
    - `tradingDayDuration` integer — Length of instrument's trading day in seconds.
    - `volumeFactor` integer — Internal use. Used to scale volume histograms.
    - `priceDisplayRule` integer — Internal use. Governs application of pricing display rule.
    - `priceDisplayValue` string — Internal use. Governs rendering of displayed pricing.
    - `chartPanStartTime` string — Internal use. UTC datetime string used to center Client Portal charts. Format YYYYMMDD-hh:mm:ss.
    - `direction` '-1' — Indicates how the period is applied in relation to the startTime. Value will always be -1, indicating that the period extends from the startTime forward into the future.
    - `negativeCapable` boolean — Indicates whether instrument is capable of negative pricing.
    - `messageVersion` integer — Internal use. Reflects the version of the response schema used.
    - `travelTime` integer — Internal time in flight to serve the request.
    - `data` SingleHistoricalBarBidAsk[] — Array containing OHLC bars for the requested period.
      - `o` number, double — Opening value of the bar. Indicates the time average bid during the bar.
      - `c` number, double — Closing value of the bar. Indicates the time average ask during the bar.
      - `h` number, double — High value of the bar. Indicates the highest ask price during the bar.
      - `l` number, double — Low value of the bar. Indicates the lowest bid price during the bar.
      - `v` number, double — Volume value of the bar. Always returns 0.
      - `t` integer — Unix timestamp of the start (chronologically earlier) of the bar.
    - `points` integer — Count of the number of bars returned in the data array.
    - `mktDataDelay` integer — Number of milliseconds taken to satisfy this historical data request.
  - IserverHistoryLastResponse — Object containing the requested historical data and related metadata.
    - `serverId` string — Internal use. Identifier of the request.
    - `symbol` string — Symbol of the request instrument.
    - `text` string — Description or company name of the instrument.
    - `priceFactor` integer — Internal use. Used to scale Client Portal chart Y-axis.
    - `startTime` string — UTC date and time of the start (chronologically earlier) of the complete period in format YYYYMMDD-hh:mm:ss.
    - `high` string — Internal use. Delivers highest price value in total interval. Used for chart scaling. A string constructed as 'highestPrice*priceFactor/totalVolume*volumeFactor/minutesFromStartTime'.
    - `low` string — Internal use. Delivers lowest price value in total interval. Used for chart scaling. A string constructed as 'lowestPrice*priceFactor/totalVolume*volumeFactor/minutesFromStartTime'.
    - `timePeriod` string — The client-specified period value.
    - `barLength` integer — The client-specified bar width, represented in seconds.
    - `mdAvailability` string — A three-character string reflecting the nature of available data. R = Realtime, D = Delayed, Z = Frozen, Y = Frozen Delayed, N = Not Subscribed. P = Snapshot, p = Consolidated. B = Top of book.
    - `outsideRth` boolean — Indicates whether data from outside regular trading hours is included in the response.
    - `tradingDayDuration` integer — Length of instrument's trading day in seconds.
    - `volumeFactor` integer — Internal use. Used to scale volume histograms.
    - `priceDisplayRule` integer — Internal use. Governs application of pricing display rule.
    - `priceDisplayValue` string — Internal use. Governs rendering of displayed pricing.
    - `chartPanStartTime` string — Internal use. UTC datetime string used to center Client Portal charts. Format YYYYMMDD-hh:mm:ss.
    - `direction` '-1' — Indicates how the period is applied in relation to the startTime. Value will always be -1, indicating that the period extends from the startTime forward into the future.
    - `negativeCapable` boolean — Indicates whether instrument is capable of negative pricing.
    - `messageVersion` integer — Internal use. Reflects the version of the response schema used.
    - `travelTime` integer — Internal time in flight to serve the request.
    - `data` SingleHistoricalBarLast[] — Array containing OHLC bars for the requested period.
      - `o` number, double — Opening value of the bar. Indicates first traded price of the bar.
      - `c` number, double — Closing value of the bar. Indicates the final traded price of the bar.
      - `h` number, double — High value of the bar. Indicates the highest traded price of the bar.
      - `l` number, double — Low value of the bar. Indicates the lowest traded price of the bar.
      - `v` number, double — Volume value of the bar, returned only for "Last" barType.
      - `t` integer — Unix timestamp of the start (chronologically earlier) of the bar.
    - `points` integer — Count of the number of bars returned in the data array.
    - `mktDataDelay` integer — Number of milliseconds taken to satisfy this historical data request.
  - IserverHistoryMidpointResponse — Object containing the requested historical data and related metadata.
    - `serverId` string — Internal use. Identifier of the request.
    - `symbol` string — Symbol of the request instrument.
    - `text` string — Description or company name of the instrument.
    - `priceFactor` integer — Internal use. Used to scale Client Portal chart Y-axis.
    - `startTime` string — UTC date and time of the start (chronologically earlier) of the complete period in format YYYYMMDD-hh:mm:ss.
    - `high` string — Internal use. Delivers highest price value in total interval. Used for chart scaling. A string constructed as 'highestPrice*priceFactor/totalVolume*volumeFactor/minutesFromStartTime'.
    - `low` string — Internal use. Delivers lowest price value in total interval. Used for chart scaling. A string constructed as 'lowestPrice*priceFactor/totalVolume*volumeFactor/minutesFromStartTime'.
    - `timePeriod` string — The client-specified period value.
    - `barLength` integer — The client-specified bar width, represented in seconds.
    - `mdAvailability` string — A three-character string reflecting the nature of available data. R = Realtime, D = Delayed, Z = Frozen, Y = Frozen Delayed, N = Not Subscribed. P = Snapshot, p = Consolidated. B = Top of book.
    - `outsideRth` boolean — Indicates whether data from outside regular trading hours is included in the response.
    - `tradingDayDuration` integer — Length of instrument's trading day in seconds.
    - `volumeFactor` integer — Internal use. Used to scale volume histograms.
    - `priceDisplayRule` integer — Internal use. Governs application of pricing display rule.
    - `priceDisplayValue` string — Internal use. Governs rendering of displayed pricing.
    - `chartPanStartTime` string — Internal use. UTC datetime string used to center Client Portal charts. Format YYYYMMDD-hh:mm:ss.
    - `direction` '-1' — Indicates how the period is applied in relation to the startTime. Value will always be -1, indicating that the period extends from the startTime forward into the future.
    - `negativeCapable` boolean — Indicates whether instrument is capable of negative pricing.
    - `messageVersion` integer — Internal use. Reflects the version of the response schema used.
    - `travelTime` integer — Internal time in flight to serve the request.
    - `data` SingleHistoricalBarMidpoint[] — Array containing OHLC bars for the requested period.
      - `o` number, double — Opening value of the bar. Indicates the starting midpoint price traded price during the bar.
      - `c` number, double — Closing value of the bar. Indicates the last midpoint price traded price during the bar.
      - `h` number, double — High value of the bar. Indicates the highest midpoint price traded price during the bar.
      - `l` number, double — Low value of the bar. Indicates the lowest midpoint price traded price during the bar.
      - `v` number, double — Volume value of the bar. Always returns 0.
      - `t` integer — Unix timestamp of the start (chronologically earlier) of the bar.
    - `points` integer — Count of the number of bars returned in the data array.
    - `mktDataDelay` integer — Number of milliseconds taken to satisfy this historical data request.

## Other responses

- `400` — Missing, empty, non-numeric, or out-of-range parameter. The `error` field is always prefixed with `Bad Request:`.
- `401` — Missing, invalid, or unparseable Authorization token.
- `500` — internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
- `503` — service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned

---

[API](https://skmtc.net/interactivebrokers/apis/api-reference.md) · [All operations](https://skmtc.net/interactivebrokers/apis/api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/interactivebrokers/api-reference/revisions/67f9f562c2c6/schema)
