WebAPI server support several historical requests:
•Time and sales historical_2.TimeAndSalesRequest (historical quotes).
•Time bars historical_2.TimeBarRequest (historical bars at fixed time intervals). These bars have 2 types:
o Intraday: bars with requested interval that fits into 24-hour period.
o Historical: bars with requested interval grater than or equal to 1 day.
•Non-timed bars historical_2.NonTimedBarRequest (bars that are not tied to specific time intervals). These include the following bar types:
o Constant volume: bars that are reported after reaching requested volume size.
o Point and figure: stacked column bars that are reported based on price rises (Xs) and falls (Os) of fixed amount
o Renko: bars that are reported after price rises or falls by fixed amount. Similar to Point and Figure bars but there can’t be more than 1 bar on each column.
o Range: bars that are reported after price movement by requested amount in some direction.
o Tick: bars that are reported based on price ticks (price change and/or number of transactions).
•Volume profile historical_2.VolumeProfileRequest (volume traded at a specific price in a given time period)
About contract_id used in requests
contract_id is taken from previously
received metadata_2.SymbolResolutionReport
message for a symbol or any other metadata response providing metadata_2.ContractMetadata.
Note:
contract_id
value does not persist between sessions and should be re-resolved using
appropriate client message such as metadata_2.SymbolResolutionRequest
About request_id used in requests
request_id is a required parameter - it’s used for uniquely identifying the following reports as well as for cancelling request in progress or dropping request with active subscription.
About relative times and scaled prices used in reports
Please refer on how to:
•convert scaled prices
•convert relative times (*_utc_time)
Client message:
{
"time_and_sales_requests": [
{
"request_id": 1,
"time_and_sales_parameters": {
"contract_id": 1,
"level": 3,
"from_utc_time": -10,
"include_off_market_trades": true,
"include_trade_attributes": true
},
"request_type": 1
}
]
}
Server response:
{
"time_and_sales_reports": [
{
"request_id": 1,
"result_code": 0,
"quotes": [
{
"type": 2,
"quote_utc_time": 2363664,
"scaled_price": 6521,
"volume": {
"significand": 10
}
},
{
"type": 2,
"scaled_price": 6521,
"volume": {
"significand": 1
}
},
{
"type": 0,
"quote_utc_time": 2363564,
"scaled_price": 6521,
"sales_condition": 4,
"volume": {
"significand": 9
}
}
],
"is_report_complete": true,
"off_market_trades_included": true,
"trade_attributes_included": true
}
]
}
Note that flags "off_market_trades_included": true and "trade_attributes_included": true does not indicate that current response includes corresponding entities. It does mean that once these entities are available, they will be reported.
There may also be corrections quotes inside a time_and_sales_reports. These quotes will have INDICATOR_INSERTION or INDICATOR_DELETION indicators (see Quote for details) and quote_utc_time that is time when correction took place.
Client message:
{
"time_bar_requests": [
{
"request_id": 1,
"time_bar_parameters": {
"contract_id": 1,
"bar_unit": 8,
"unit_number": 10,
"bar_count": 5
},
"request_type": 1
}
]
}
Server response:
{
"time_bar_reports": [
{
"request_id": 1,
"status_code": 0,
"time_bars": [
{
"bar_utc_time": 4571000,
"scaled_open_price": 6521,
"scaled_high_price": 6521,
"scaled_low_price": 6521,
"scaled_close_price": 6521,
"trade_date": -42829000,
"tick_volume": 0,
"volume": {
"significand": 50
}
},
{
"bar_utc_time": 3971000,
"scaled_open_price": 6521,
"scaled_high_price": 6521,
"scaled_low_price": 6521,
"scaled_close_price": 6521,
"tick_volume": 0,
"volume": {
"significand": 100
}
},
{
"bar_utc_time": 3371000,
"scaled_open_price": 6521,
"scaled_high_price": 6521,
"scaled_low_price": 6521,
"scaled_close_price": 6521,
"tick_volume": 0,
"volume": {
"significand": 100
}
},
{
"bar_utc_time": 2771000,
"scaled_open_price": 6521,
"scaled_high_price": 6521,
"scaled_low_price": 6521,
"scaled_close_price": 6521,
"tick_volume": 0,
"volume": {
"significand": 100
}
},
{
"bar_utc_time": 2171000,
"scaled_open_price": 6521,
"scaled_high_price": 6521,
"scaled_low_price": 6521,
"scaled_close_price": 6521,
"tick_volume": 0,
"volume": {
"significand": 100
}
}
],
"up_to_utc_time": 4917223,
"is_report_complete": true
}
]
}
Here the interval between bars is exactly 10 minutes (600000 milliseconds), as was requested.
Note: Time bars in the server’s response are sorted in backward time direction - the first bar is the most recent one.
Client message:
{
"non_timed_bar_requests": [
{
"request_id": 1,
"request_type": 1,
"contract_id": 1,
"bar_range": {
"count": 5,
"time_direction": 1
},
"constant_volume_bar_parameters": {
"volume_level": {
"significand": 3
}
}
}
]
}
Server response:
{
"non_timed_bar_reports": [
{
"request_id": 1,
"status_code": 0,
"up_to_utc_time": 620307,
"is_report_complete": true,
"constant_volume_bars": [
{
"bar_utc_time": 594376,
"index": 2,
"trade_date": -42829000,
"scaled_open_price": 6521,
"scaled_high_price": 6521,
"scaled_low_price": 6521,
"scaled_close_price": 6521,
"tick_volume": 1,
"volume": {
"significand": 3
}
},
{
"index": 1,
"scaled_open_price": 6521,
"scaled_high_price": 6521,
"scaled_low_price": 6521,
"scaled_close_price": 6521,
"tick_volume": 1,
"volume": {
"significand": 3
}
},
{
"scaled_open_price": 6521,
"scaled_high_price": 6521,
"scaled_low_price": 6521,
"scaled_close_price": 6521,
"tick_volume": 1,
"volume": {
"significand": 3
}
},
{
"bar_utc_time": 533364,
"index": 3,
"scaled_open_price": 6521,
"scaled_high_price": 6521,
"scaled_low_price": 6521,
"scaled_close_price": 6521,
"tick_volume": 3,
"volume": {
"significand": 3
}
},
{
"index": 2,
"scaled_open_price": 6521,
"scaled_high_price": 6521,
"scaled_low_price": 6521,
"scaled_close_price": 6521,
"tick_volume": 1,
"volume": {
"significand": 3
}
}
]
}
]
}
Here each bar has constant volume equal to 3, as was requested.
Client message:
{
"non_timed_bar_requests": [
{
"request_id": 1,
"request_type": 2,
"contract_id": 1,
"bar_range": {
"count": 5,
"time_direction": 1
},
"point_and_figure_parameters": {
"box_size": 3,
"reversal": 1
}
}
]
}
Server response:
{
"non_timed_bar_reports": [
{
"request_id": 1,
"status_code": 0,
"up_to_utc_time": 1021771,
"is_report_complete": true,
"point_and_figure_bars": [
{
"bar_utc_time": -416864676,
"trade_date": -474829000,
"pf_scaled_open_price": 677050,
"pf_scaled_high_price": 677100,
"pf_scaled_low_price": 677100,
"pf_scaled_close_price": 677050,
"scaled_high_price": 677050,
"scaled_low_price": 677050,
"tick_volume": 1,
"up": false,
"volume": {
"significand": 96
}
},
{
"bar_utc_time": -416894700,
"pf_scaled_open_price": 677975,
"pf_scaled_high_price": 677925,
"pf_scaled_low_price": 677925,
"pf_scaled_close_price": 677975,
"scaled_high_price": 677975,
"scaled_low_price": 677975,
"tick_volume": 1,
"up": true,
"volume": {
"significand": 4
}
},
{
"bar_utc_time": -417925692,
"pf_scaled_open_price": 677925,
"pf_scaled_high_price": 677925,
"pf_scaled_low_price": 677100,
"pf_scaled_close_price": 677050,
"scaled_high_price": 677925,
"scaled_low_price": 677050,
"tick_volume": 2,
"up": false,
"volume": {
"significand": 98
}
},
{
"bar_utc_time": -423106896,
"pf_scaled_open_price": 678000,
"pf_scaled_high_price": 678000,
"pf_scaled_low_price": 677925,
"pf_scaled_close_price": 677950,
"scaled_high_price": 678000,
"scaled_low_price": 677950,
"tick_volume": 3,
"up": true,
"volume": {
"significand": 361
}
},
{
"bar_utc_time": -423347548,
"pf_scaled_open_price": 678000,
"pf_scaled_high_price": 678000,
"pf_scaled_low_price": 677550,
"pf_scaled_close_price": 677500,
"scaled_high_price": 678000,
"scaled_low_price": 677500,
"tick_volume": 2,
"up": false,
"volume": {
"significand": 70
}
}
]
}
]
}
Here each bar has price increment (any of pf_scaled_* fields) that is multiple of 3.
Client message:
{
"non_timed_bar_requests": [
{
"request_id": 1,
"request_type": 1,
"contract_id": 1,
"bar_range": {
"count": 5,
"time_direction": 1
},
"renko_bar_parameters": {
"brick_size": 3
}
}
]
}
Server response:
{
"non_timed_bar_reports": [
{
"request_id": 1,
"status_code": 0,
"up_to_utc_time": 1522875,
"is_report_complete": true,
"renko_bars": [
{
"bar_utc_time": -416864676,
"index": 1,
"trade_date": -474829000,
"scaled_open_price": 677075,
"scaled_high_price": 677075,
"scaled_low_price": 677050,
"scaled_close_price": 677050,
"up": false,
"tick_volume": 1,
"volume": {
"significand": 96
}
},
{
"scaled_open_price": 677750,
"scaled_high_price": 677750,
"scaled_low_price": 677100,
"scaled_close_price": 677100,
"scaled_renko_high_price": 677775,
"scaled_renko_low_price": 677100,
"up": false,
"tick_volume": 0
},
{
"bar_utc_time": -416894700,
"index": 1,
"scaled_open_price": 677950,
"scaled_high_price": 677975,
"scaled_low_price": 677775,
"scaled_close_price": 677775,
"scaled_renko_high_price": 677850,
"scaled_renko_low_price": 677775,
"up": false,
"tick_volume": 1,
"volume": {
"significand": 4
}
},
{
"scaled_open_price": 677275,
"scaled_high_price": 677925,
"scaled_low_price": 677275,
"scaled_close_price": 677925,
"scaled_renko_high_price": 677925,
"scaled_renko_low_price": 677250,
"up": true,
"tick_volume": 0
},
{
"bar_utc_time": -417885612,
"index": 1,
"scaled_open_price": 677075,
"scaled_high_price": 677250,
"scaled_low_price": 677050,
"scaled_close_price": 677250,
"scaled_renko_high_price": 677250,
"scaled_renko_low_price": 677175,
"up": true,
"tick_volume": 1,
"volume": {
"significand": 96
}
}
]
}
]
}
Here each bar has price increment difference from previous one (any of scaled_renko_* fields) that is multiple of 3.
Client message:
{
"non_timed_bar_requests": [
{
"request_id": 1,
"request_type": 1,
"contract_id": 1,
"bar_range": {
"count": 5,
"time_direction": 1
},
"range_bar_parameters": {
"range_size": 100
}
}
]
}
Server response:
{
"non_timed_bar_reports": [
{
"request_id": 1,
"status_code": 0,
"up_to_utc_time": 2697327,
"is_report_complete": true,
"range_bars": [
{
"bar_utc_time": -406626164,
"trade_date": -458865000,
"scaled_open_price": 678000,
"scaled_high_price": 678000,
"scaled_low_price": 677050,
"scaled_close_price": 677050,
"scaled_volume": 399,
"tick_volume": 7
},
{
"bar_utc_time": -430927792,
"scaled_open_price": 678050,
"scaled_high_price": 678100,
"scaled_low_price": 677500,
"scaled_close_price": 678000,
"scaled_volume": 326,
"tick_volume": 6
}
],
"reached_start_of_data": true
}
]
}
Here each bar has price increment difference from previous one (any of scaled_* fields) that is multiple of 100.
Client message:
{
"non_timed_bar_requests": [
{
"request_id": 1,
"request_type": 1,
"contract_id": 2,
"bar_range": {
"count": 5,
"time_direction": 1
},
"tick_bar_parameters": {}
}
]
}
Server response:
{
"non_timed_bar_reports": [
{
"request_id": 1,
"status_code": 0,
"up_to_utc_time": 4164751,
"is_report_complete": true,
"tick_bars": [
{
"bar_utc_time": -416864676,
"trade_date": -474829000,
"scaled_close_price": 677050,
"volume": {
"significand": 96
}
},
{
"bar_utc_time": -416894700,
"scaled_close_price": 677975,
"volume": {
"significand": 4
}
},
{
"bar_utc_time": -417885612,
"scaled_close_price": 677050,
"volume": {
"significand": 96
}
},
{
"bar_utc_time": -417925692,
"index": 2,
"scaled_close_price": 677925,
"volume": {
"significand": 2
}
},
{
"index": 1,
"scaled_close_price": 677950,
"volume": {
"significand": 1
}
}
]
}
]
}
Here each bar is the result of price change of the source contract.
Client message:
{
"volume_profile_requests": [
{
"request_id": 1,
"volume_profile_parameters": {
"contract_id": 1,
"start_utc_time": -100000,
"end_utc_time": -10
},
"request_type": 1
}
]
}
Server response:
{
"volume_profile_reports": [
{
"request_id": 1,
"result_code": 0,
"volume_profile_items": [
{
"scaled_price": 6521,
"volume": {
"significand": 20
},
"ask_volume": {
"significand": 15
},
"bid_volume": {
"significand": 5
},
"tick_volume": 1,
"ask_tick_volume": {
"significand": 5,
"exponent": -1
},
"bid_tick_volume": {
"significand": 5,
"exponent": -1
}
}
],
"is_report_complete": true,
"last_quotes_cumulative_statistics": {
"scaled_last_ask_price": 6521
}
}
]
}
Here each price type has a volume field that was accumulated over the requested period.
Corrections support for bar requests
Corrected bars may be sent from time to time if there were some corrections of underlying contract (insertion or deletion of quotes). In such cases bar_utc_time of corrected bar(s) shall be used to apply these corrections to previously received bars set.
Updating of current bar (for bar subscriptions)
In the case of the active bar subscription, current bar is automatically updated and reported based on the quote market data of the underlying contract.
Continuation support for bar requests
WebAPI server supports 2 types of ContinuationParameters that can be applied to bar requests:
•Active continuation (underlying contract is switched when the most active flag changes). For example, the initial contract F.US.EPU25 is switched to F.US.EPH26. See is_most_active field of metadata_2.ContractMetadata. Some types of requests support equalized active continuation for the close process of previous and current segments (please refer to the protocol comments for details).
•Standard continuation. (the underlying contract is switched to the following one after expiration). For example, the initial contract F.US.EPU25 is switched to F.US.EPZ25.
Example of client request and server response with continuation parameters:
Client message:
{
"time_bar_requests": [
{
"request_id": 1,
"time_bar_parameters": {
"contract_id": 2,
"bar_unit": 8,
"unit_number": 10,
"continuation_parameters": {
"continuation_type": 1
},
"bar_count": 5
},
"request_type": 1
}
]
}
Server response:
{
"time_bar_reports": [
{
"request_id": 1,
"status_code": 0,
"time_bars": [
{
"bar_utc_time": 7571000,
"scaled_open_price": 6521,
"scaled_high_price": 6521,
"scaled_low_price": 6521,
"scaled_close_price": 6521,
"trade_date": -42829000,
"tick_volume": 1,
"continuation_segment": {
"cqg_short_contract_symbol": "CLEG36",
"contract_id": 1,
"contract_symbol": "F.US.CLEG36"
},
"volume": {
"significand": 60
}
},
{
"bar_utc_time": 6971000,
"scaled_open_price": 6521,
"scaled_high_price": 6521,
"scaled_low_price": 6521,
"scaled_close_price": 6521,
"tick_volume": 0,
"volume": {
"significand": 100
}
},
{
"bar_utc_time": 6371000,
"scaled_open_price": 6521,
"scaled_high_price": 6521,
"scaled_low_price": 6521,
"scaled_close_price": 6521,
"tick_volume": 0,
"volume": {
"significand": 100
}
},
{
"bar_utc_time": 5771000,
"scaled_open_price": 6521,
"scaled_high_price": 6521,
"scaled_low_price": 6521,
"scaled_close_price": 6521,
"tick_volume": 0,
"volume": {
"significand": 100
}
},
{
"bar_utc_time": 5171000,
"scaled_open_price": 6521,
"scaled_high_price": 6521,
"scaled_low_price": 6521,
"scaled_close_price": 6521,
"tick_volume": 0,
"volume": {
"significand": 90
}
}
],
"up_to_utc_time": 7964107,
"is_report_complete": true
}
]
}
ContinuationSegment continuation_segment here contains information about currently used contract symbol for building this and the following bars until the next switch happens.
Entitlements affecting historical requests
Depending on your trader’s entitlements:
•Some of the historical request types may be disabled.
•You may get delayed instead of real-time responses. This can be checked using market_data_delay and end_of_day_delay fields of metadata_2.ContractMetadata.
•Delayed bar requests may not support certain types of continuation. See details in protocol comments for ContinuationParameters.
•If neither of real-time and delayed entitlement is active for your trader historical requests can receive end of day data only or be completely rejected.
•Some of the historical requests may not be supported for delayed or end of day contracts (for example historical_2.VolumeProfileRequest).