Skip to navigation

Request Reference

View as Markdown

Subscribe Quote

Endpoint: md/subscribeQuote

Parameters:

{ "symbol": "ESM7" | 123456 }

Data message

{
"e":"md",
"d": {
"quotes": [ // "quotes" may contain multiple quote objects
{
"timestamp":"2021-04-13T04:59:06.588Z",
"contractId":123456,
"entries": {
"Bid": { "price":18405.123, "size":7.123 },
"TotalTradeVolume": { "size":4118.123 },
"Offer": { "price":18410.012, "size":12.35 },
"LowPrice": { "price":18355.23 },
"Trade": { "price":18405.023, "size":2.10 },
"OpenInterest": { "size":40702.024 },
"OpeningPrice": { "price":18515.123 },
"HighPrice": { "price":18520.125 },
"SettlementPrice": { "price":18520.257 }
}
}
]
}
}

Unsubscribe Quote

Endpoint: md/unsubscribeQuote

Parameters:

{ "symbol": "ESM7" | 123456 }

Subscribe DOM

Endpoint: md/subscribeDOM

Parameters:

{ "symbol": "ESM7" | 123456 }

Data message

{
"e":"md",
"d": {
"doms": [ // "doms" may contain multiple DOM objects
{
"contractId":123456, // ID of the DOM contract
"timestamp":"2021-04-13T11:33:57.488Z",
"bids": [ // Actual depth of "bids" may vary depending on available data
{"price":2335.25,"size":33.54},
...
{"price":2333,"size":758.21}
],
"offers": [ // Actual depth of "offers" may vary depending on available data
{"price":2335.5,"size":255.12},
...
{"price":2337.75,"size":466.64}
]
}
]
}
}

Unsubscribe DOM

Endpoint: md/unsubscribeDOM

Parameters:

{ "symbol": "ESM7" | 123456 }

Subscribe Histogram

Endpoint: md/subscribeHistogram

Parameters:

{ "symbol": "ESM7" | 123456 }

Data message

{
"e":"md",
"d": {
"histograms": [ // "histograms" may contain multiple histogram objects
{
"contractId":123456, // ID of the histogram contract
"timestamp":"2017-04-13T11:33:57.412Z",
"tradeDate": {
"year":2022,
"month":4,
"day":13
},
"base":2338.75,
"items": { // Actual number of histogram items may depend on data
"-14":5906.67,
...
"2":1234.55,
},
"refresh":false
}
]
}
}

Unsubscribe Histogram

Endpoint: md/unsubscribeHistogram

Parameters:

{ "symbol": "ESM7" | 123456 }

Get Chart

A client application may have multiple charts for the same contract, so the response for a md/getChart request contains a subscription ID to properly track and unsubscribe from a real-time chart subscription. If you’re using JavaScript, don’t forget to check the section on charts in our API’s comprehensive JavaScript tutorial.

Endpoint: md/getChart

Parameters:

{
"symbol":"ESM7" | 123456,
"chartDescription": {
"underlyingType":"MinuteBar", // Available values: Tick, DailyBar, MinuteBar, Custom, DOM
"elementSize":15,
"elementSizeUnit":"UnderlyingUnits", // Available values: UnderlyingUnits, Volume, Range, MomentumRange, OFARange, Renko, PointAndFigure, Seconds
"withHistogram": true | false
},
"timeRange": {
// All fields in "timeRange" are optional, but at least one is required
"closestTimestamp":"2017-04-13T11:33Z",
"closestTickId":123,
"asFarAsTimestamp":"2017-04-13T11:33Z",
"asMuchAsElements":66
},
}

Parameter Notes

  • underlyingType: the bar type. MinuteBar is time-based (the most common), DailyBar is daily OHLCV, Tick is tick-based, Custom covers Renko, range, and similar bars, and DOM is depth-of-market snapshots (rarely used for charting).
  • elementSize: the size of each bar. Its meaning depends on elementSizeUnit. For example, 5 under MinuteBar and UnderlyingUnits is a 5-minute bar, and 100 under Tick is a 100-tick bar.
  • elementSizeUnit: UnderlyingUnits is the native unit of the underlyingType (minutes for MinuteBar, days for DailyBar, ticks for Tick). MinuteBar and DailyBar must use UnderlyingUnits. Seconds forces time-based sizing in seconds and is used with Tick for sub-minute bars, such as a 15-second bar. A tick chart is Tick with elementSize 1 and UnderlyingUnits.
  • withHistogram: when true, the response includes volume-at-price histogram data. For histograms it is best to subscribe separately via md/subscribeHistogram.

Response

A md/getChart response returns a subscription ID in both the historicalId and realtimeId fields. To cancel the chart, pass either one to md/cancelChart. Store the ID if you may need to cancel it. The mode field reports whether the feed is RealTime or Delayed.

{
"s":200,
"i":13,
"d":{
"mode":"RealTime", // "RealTime" or "Delayed"
"historicalId":31,
"realtimeId":31
}
}

Data message

{
"e":"chart",
"d": {
"charts": [ // "charts" may contain multiple chart objects
{
"id":9, // "id" matches either historicalId or realtimeId values from response
"td":20170413, // Trade date as a number with value YYYYMMDD
"bars": [ // "bars" may contain multiple bar objects
{
"timestamp":"2017-04-13T11:00:00.000Z",
"open":2334.25,
"high":2334.5,
"low":2333,
"close":2333.75,
"upVolume":4712.234,
"downVolume":201.124,
"upTicks":1333.567,
"downTicks":82.890,
"bidVolume":2857.123,
"offerVolume":2056.224
}
]
}
]
}
}

Data Size Limits

The data-size limit per md/getChart request is flexible rather than a fixed hard cap, and it can vary from day to day. In practice, MinuteBar and Tick requests tend to return at most about two months of data per request. Historical depth differs by bar type: MinuteBar data generally goes back to January 1, 2017 for most continuous contracts, while raw tick history generally covers only about the last two months. For more on accessing historical data, see this community thread.

To load more history than a single request returns, paginate backward through the data. For the backfill loop and the timeRange strategies that control how much history you load, see Charting Best Practices.

Cancel Chart

Endpoint: md/cancelChart

Parameters:

{
"subscriptionId": 123456 // A subscription ID from the md/getChart response: realtimeId or historicalId, for the subscription you want to cancel
}