Futures
Get Futures Exchange List
Corresponding Request Class: FutureExchangeRequest
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| secType | string | Yes | Security type. "FUT": Futures, "FOP": Futures Options (futures options quotes not yet provided) |
| lang | string | No | Language parameter, affects the "name" field in return values. Valid values: "zh_CN", "en_US" |
Return
List of FutureExchangeItem objects
FutureExchangeItem object field descriptions:
| Name | Type | Description |
|---|---|---|
| code | string | Exchange code |
| name | string | Exchange name |
| zoneId | string | Trading timezone |
Example
FutureExchangeResponse response = client.execute(FutureExchangeRequest.newRequest(SecType.FUT.name()));
System.out.println(response.getFutureExchangeItems());Return Example
[
{
"code": "SGX",
"name": "SGX",
"zoneId": "Singapore"
},
{
"code": "HKEX",
"name": "HKEX",
"zoneId": "Asia/Hong_Kong"
},
{
"code": "CBOE",
"name": "CBOE",
"zoneId": "America/Chicago"
}
]Get Tradable Contracts by Exchange
Corresponding Request Class: FutureContractByExchCodeRequest
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| exchangeCode | string | Yes | Exchange code |
| lang | string | No | Language parameter, affects the "name" field in return values. Valid values: "zh_CN", "en_US" |
Return
List of FutureContractItem objects
FutureContractItem object field descriptions:
| Name | Type | Description |
|---|---|---|
| type | string | Futures contract trading variety, e.g., CL |
| trade | boolean | Whether tradable |
| continuous | boolean | Whether continuous contract |
| name | string | Contract name, available in Chinese and English, returned based on lang parameter |
| currency | string | Trading currency |
| ibCode | string | Trading contract code used for placing orders, e.g., CL |
| contractCode | string | Contract code, e.g., CL1901 |
| contractMonth | string | Contract delivery month |
| lastTradingDate | string | Last trading date of the contract's expiration month. Futures contracts not settled after the last trading date must be closed through related 'spot commodities' or 'cash settlement'. Currently, the last trading date for most futures commodities is usually the settlement date. For some commodities like Euro, the first notice date and last trading date are the same For cash-settled futures, positions can be opened normally as long as the last trading time hasn't passed. For non-cash-settled futures, opening positions is restricted starting three trading days before the earlier of the last trading time and first notice date |
| firstNoticeDate | string | First notice date, the date when physical delivery contracts can proceed with physical delivery. Contracts cannot open long positions after the first notice date. Existing long positions will be forcibly closed before the first notice date (usually three trading days prior). This field is empty for non-physical delivery contracts (e.g., index contracts) |
| lastBiddingCloseTime | long | Bidding close time |
| multiplier | double | Contract multiplier. The futures price multiplied by the contract multiplier gives the contract's face value. The reasonable futures price can be estimated by dividing the physical price by the contract multiplier |
| exchange | string | Exchange code |
| minTick | double | Minimum price movement unit for futures prices. For example, if the current futures price is 2000 and minTick is 100, then valid quotes include 2100, 2200, while 2005 does not meet requirements |
| productWorth | string | Contract size |
| deliveryMode | string | Delivery mode |
| productType | string | Contract type |
Request Example:
FutureBatchContractResponse response = client.execute(FutureContractByExchCodeRequest.newRequest("CME"));
System.out.println(response.getFutureContractItems());Response Example:
[
{
"type": "MEUR",
"name": "E-Micro EUR/USD - main",
"ibCode": "M6E",
"contractCode": "MEURmain",
"contractMonth": "",
"exchangeCode": "GLOBEX",
"multiplier": 12500,
"minTick": 0.0001,
"lastTradingDate": "",
"firstNoticeDate": "",
"lastBiddingCloseTime": 0,
"currency": "USD",
"continuous": false,
"trade": true
},
{
"type": "MEUR",
"name": "E-Micro EUR/USD - Jun 2022",
"ibCode": "M6E",
"contractCode": "MEUR2206",
"contractMonth": "202206",
"exchangeCode": "GLOBEX",
"multiplier": 12500,
"minTick": 0.0001,
"lastTradingDate": "20220613",
"firstNoticeDate": "",
"lastBiddingCloseTime": 0,
"currency": "USD",
"continuous": false,
"trade": true
},
{
"type": "MEUR",
"name": "E-Micro EUR/USD - Mar 2022",
"ibCode": "M6E",
"contractCode": "MEUR2203",
"contractMonth": "202203",
"exchangeCode": "GLOBEX",
"multiplier": 12500,
"minTick": 0.0001,
"lastTradingDate": "20220314",
"firstNoticeDate": "",
"lastBiddingCloseTime": 0,
"currency": "USD",
"continuous": false,
"trade": true
},
{
"type": "CHF",
"name": "Swiss Franc - Jun 2022",
"ibCode": "CHF",
"contractCode": "CHF2206",
"contractMonth": "202206",
"exchangeCode": "GLOBEX",
"multiplier": 125000,
"minTick": 0.0001,
"lastTradingDate": "20220613",
"firstNoticeDate": "",
"lastBiddingCloseTime": 0,
"currency": "USD",
"continuous": false,
"trade": true
},
{
"type": "CHF",
"name": "Swiss Franc - main",
"ibCode": "CHF",
"contractCode": "CHFmain",
"contractMonth": "",
"exchangeCode": "GLOBEX",
"multiplier": 125000,
"minTick": 0.0001,
"lastTradingDate": "",
"firstNoticeDate": "",
"lastBiddingCloseTime": 0,
"currency": "USD",
"continuous": false,
"trade": true
},
{
"type": "CHF",
"name": "Swiss Franc - Dec 2022",
"ibCode": "CHF",
"contractCode": "CHF2212",
"contractMonth": "202212",
"exchangeCode": "GLOBEX",
"multiplier": 125000,
"minTick": 0.0001,
"lastTradingDate": "20221219",
"firstNoticeDate": "",
"lastBiddingCloseTime": 0,
"currency": "USD",
"continuous": false,
"trade": true
}
]Get Futures Contract by Code
Corresponding Request Class: FutureContractByConCodeRequest
How to handle first notice date and last trading date: Whether entering the first notice date or after the last settlement date, the main trading month will shift to the next month contract, making the expiring month's liquidity worse. Therefore, it is recommended to roll over or trade the next month contract before the first notice date and close to the last trading date, regardless of long or short positions.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| contractCode | string | Yes | Contract symbol, e.g., CN1901 |
| lang | string | No | Language parameter, affects the "name" field in return values. Valid values: "zh_CN", "en_US" |
Return
FutureContractItem object
FutureContractItem object field descriptions:
| Name | Type | Description |
|---|---|---|
| type | string | Futures contract trading variety, e.g., CL |
| trade | boolean | Whether tradable |
| continuous | boolean | Whether continuous contract |
| name | string | Contract name, available in Chinese and English, returned based on lang parameter |
| currency | string | Trading currency |
| ibCode | string | Trading contract code used for placing orders, e.g., CL |
| contractCode | string | Contract code, e.g., CL1901 |
| contractMonth | string | Contract delivery month |
| lastTradingDate | string | Last trading date of the contract's expiration month. Futures contracts not settled after the last trading date must be closed through related 'spot commodities' or 'cash settlement'. Currently, the last trading date for most futures commodities is usually the settlement date. For some commodities like Euro, the first notice date and last trading date are the same For cash-settled futures, positions can be opened normally as long as the last trading time hasn't passed. For non-cash-settled futures, opening positions is restricted starting three trading days before the earlier of the last trading time and first notice date |
| firstNoticeDate | string | First notice date, the date when physical delivery contracts can proceed with physical delivery. Contracts cannot open long positions after the first notice date. Existing long positions will be forcibly closed before the first notice date (usually three trading days prior). This field is empty for non-physical delivery contracts (e.g., index contracts) |
| lastBiddingCloseTime | long | Bidding close time |
| multiplier | double | Contract multiplier. The futures price multiplied by the contract multiplier gives the contract's face value. The reasonable futures price can be estimated by dividing the physical price by the contract multiplier |
| exchange | string | Exchange code |
| minTick | double | Minimum price movement unit for futures prices. For example, if the current futures price is 2000 and minTick is 100, then valid quotes include 2100, 2200, while 2005 does not meet requirements |
Example
FutureContractResponse response = client.execute(FutureContractByConCodeRequest.newRequest("CN2203"));
System.out.println(response.getFutureContractItem());Response Example
{
"type": "CL",
"name": "Light Crude Oil - Mar 2022",
"ibCode": "CL",
"contractCode": "CL2203",
"contractMonth": "202203",
"exchangeCode": "NYMEX",
"multiplier": "1000",
"minTick": 0.01,
"lastTradingDate": "20220222",
"firstNoticeDate": "20220224",
"lastBiddingCloseTime": 0,
"currency": "USD",
"continuous": false,
"trade": true
}Query Current Contract for Specified Variety
Corresponding Request Class: FutureCurrentContractRequest
Description
Query the current contract for a specified variety, i.e., the main continuous contract.
Input Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| type | string | Yes | Futures contract trading variety, e.g., CL |
| lang | string | No | Language parameter, affects the "name" field in return values. Valid values: "zh_CN", "en_US" |
Return
FutureContractItem object
FutureContractItem object field descriptions:
| Name | Type | Description |
|---|---|---|
| type | string | Futures contract trading variety, e.g., CL |
| trade | boolean | Whether tradable |
| continuous | boolean | Whether continuous contract |
| name | string | Contract name, available in Chinese and English, returned based on lang parameter |
| currency | string | Trading currency |
| ibCode | string | Trading contract code used for placing orders, e.g., CL |
| contractCode | string | Contract code, e.g., CL1901 |
| contractMonth | string | Contract delivery month |
| lastTradingDate | string | Last trading date of the contract's expiration month. Futures contracts not settled after the last trading date must be closed through related 'spot commodities' or 'cash settlement'. Currently, the last trading date for most futures commodities is usually the settlement date. For some commodities like Euro, the first notice date and last trading date are the same For cash-settled futures, positions can be opened normally as long as the last trading time hasn't passed. For non-cash-settled futures, opening positions is restricted starting three trading days before the earlier of the last trading time and first notice date |
| firstNoticeDate | string | First notice date, the date when physical delivery contracts can proceed with physical delivery. Contracts cannot open long positions after the first notice date. Existing long positions will be forcibly closed before the first notice date (usually three trading days prior). This field is empty for non-physical delivery contracts (e.g., index contracts) |
| lastBiddingCloseTime | long | Bidding close time |
| multiplier | double | Contract multiplier. The futures price multiplied by the contract multiplier gives the contract's face value. The reasonable futures price can be estimated by dividing the physical price by the contract multiplier |
| exchange | string | Exchange code |
| minTick | double | Minimum price movement unit for futures prices. For example, if the current futures price is 2000 and minTick is 100, then valid quotes include 2100, 2200, while 2005 does not meet requirements |
| productWorth | string | Contract size |
| deliveryMode | string | Delivery mode |
| productType | string | Contract type |
Request Example
FutureContractResponse response = client.execute(FutureCurrentContractRequest.newRequest("CL"));
System.out.println(response.getFutureContractItem());Return Example
{
"type": "CL",
"name": "Light Crude Oil - Mar 2022",
"ibCode": "CL",
"contractCode": "CL2203",
"contractMonth": "202203",
"exchangeCode": "NYMEX",
"multiplier": 1000,
"minTick": 0.01,
"lastTradingDate": "20220222",
"firstNoticeDate": "20220224",
"lastBiddingCloseTime": 0,
"currency": "USD",
"continuous": false,
"trade": true
}Query All Contracts for Specified Variety
Corresponding Request Class: FutureContractsRequest
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| type | string | Yes | Futures contract trading variety, e.g., CL |
| lang | string | Yes | Language parameter, affects the "name" field in return values. Valid values: "zh_CN", "en_US" |
Return
List of FutureContractItem objects
FutureContractItem object field descriptions:
| Name | Type | Description |
|---|---|---|
| type | string | Futures contract trading variety, e.g., CL |
| trade | boolean | Whether tradable |
| continuous | boolean | Whether continuous contract |
| name | string | Contract name, available in Chinese and English, returned based on lang parameter |
| currency | string | Trading currency |
| ibCode | string | Trading contract code used for placing orders, e.g., CL |
| contractCode | string | Contract code, e.g., CL1901 |
| contractMonth | string | Contract delivery month |
| lastTradingDate | string | Last trading date of the contract's expiration month. Futures contracts not settled after the last trading date must be closed through related 'spot commodities' or 'cash settlement'. Currently, the last trading date for most futures commodities is usually the settlement date. For some commodities like Euro, the first notice date and last trading date are the same For cash-settled futures, positions can be opened normally as long as the last trading time hasn't passed. For non-cash-settled futures, opening positions is restricted starting three trading days before the earlier of the last trading time and first notice date |
| firstNoticeDate | string | First notice date, the date when physical delivery contracts can proceed with physical delivery. Contracts cannot open long positions after the first notice date. Existing long positions will be forcibly closed before the first notice date (usually three trading days prior). This field is empty for non-physical delivery contracts (e.g., index contracts) |
| lastBiddingCloseTime | long | Bidding close time |
| multiplier | double | Contract multiplier. The futures price multiplied by the contract multiplier gives the contract's face value. The reasonable futures price can be estimated by dividing the physical price by the contract multiplier |
| exchange | string | Exchange code |
| minTick | double | Minimum price movement unit for futures prices. For example, if the current futures price is 2000 and minTick is 100, then valid quotes include 2100, 2200, while 2005 does not meet requirements |
| productWorth | string | Contract size |
| deliveryMode | string | Delivery mode |
| productType | string | Contract type |
Request Example:
FutureContractsResponse contractResponse = client.execute(FutureContractsRequest.newRequest("CN"));
System.out.println(contractResponse.getFutureContractItems());Response Example:
[
{
"type": "CN",
"name": "China A50 Index - Aug 2022",
"ibCode": "XINA50",
"contractCode": "CN2208",
"contractMonth": "202208",
"exchangeCode": "SGX",
"multiplier": 1,
"minTick": 1,
"lastTradingDate": "20220830",
"firstNoticeDate": "",
"lastBiddingCloseTime": 0,
"currency": "USD",
"continuous": false,
"trade": true
},
{
"type": "CN",
"name": "China A50 Index - Sep 2022",
"ibCode": "XINA50",
"contractCode": "CN2209",
"contractMonth": "202209",
"exchangeCode": "SGX",
"multiplier": 1,
"minTick": 1,
"lastTradingDate": "20220929",
"firstNoticeDate": "",
"lastBiddingCloseTime": 0,
"currency": "USD",
"continuous": false,
"trade": true
},
{
"type": "CN",
"name": "China A50 Index - Oct 2022",
"ibCode": "XINA50",
"contractCode": "CN2210",
"contractMonth": "202210",
"exchangeCode": "SGX",
"multiplier": 1,
"minTick": 1,
"lastTradingDate": "20221028",
"firstNoticeDate": "",
"lastBiddingCloseTime": 0,
"currency": "USD",
"continuous": false,
"trade": true
},
{
"type": "CN",
"name": "China A50 Index - Dec 2022",
"ibCode": "XINA50",
"contractCode": "CN2212",
"contractMonth": "202212",
"exchangeCode": "SGX",
"multiplier": 1,
"minTick": 1,
"lastTradingDate": "20221229",
"firstNoticeDate": "",
"lastBiddingCloseTime": 0,
"currency": "USD",
"continuous": false,
"trade": true
},
{
"type": "CN",
"name": "China A50 Index - Mar 2023",
"ibCode": "XINA50",
"contractCode": "CN2303",
"contractMonth": "202303",
"exchangeCode": "SGX",
"multiplier": 1,
"minTick": 1,
"lastTradingDate": "20230330",
"firstNoticeDate": "",
"lastBiddingCloseTime": 0,
"currency": "USD",
"continuous": false,
"trade": true
}
]Query Continuous Contract for Specified Variety
Corresponding Request Class: FutureContinuousContractRequest
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| type | string | Yes | Futures contract trading variety, e.g., CL |
| lang | string | Yes | Language parameter, affects the "name" field in return values. Valid values: "zh_CN", "en_US" |
Return
FutureContractItem object
FutureContractItem object field descriptions:
| Name | Type | Description |
|---|---|---|
| type | string | Futures contract trading variety, e.g., CL |
| trade | boolean | Whether tradable |
| continuous | boolean | Whether continuous contract |
| name | string | Contract name, available in Chinese and English, returned based on lang parameter |
| currency | string | Trading currency |
| ibCode | string | Trading contract code used for placing orders, e.g., CL |
| contractCode | string | Contract code, e.g., CL1901 |
| contractMonth | string | Contract delivery month |
| lastTradingDate | string | Last trading date of the contract's expiration month. Futures contracts not settled after the last trading date must be closed through related 'spot commodities' or 'cash settlement'. Currently, the last trading date for most futures commodities is usually the settlement date. For some commodities like Euro, the first notice date and last trading date are the same For cash-settled futures, positions can be opened normally as long as the last trading time hasn't passed. For non-cash-settled futures, opening positions is restricted starting three trading days before the earlier of the last trading time and first notice date |
| firstNoticeDate | string | First notice date, the date when physical delivery contracts can proceed with physical delivery. Contracts cannot open long positions after the first notice date. Existing long positions will be forcibly closed before the first notice date (usually three trading days prior). This field is empty for non-physical delivery contracts (e.g., index contracts) |
| lastBiddingCloseTime | long | Bidding close time |
| multiplier | double | Contract multiplier. The futures price multiplied by the contract multiplier gives the contract's face value. The reasonable futures price can be estimated by dividing the physical price by the contract multiplier |
| exchange | string | Exchange code |
| minTick | double | Minimum price movement unit for futures prices. For example, if the current futures price is 2000 and minTick is 100, then valid quotes include 2100, 2200, while 2005 does not meet requirements |
| productWorth | string | Contract size |
| deliveryMode | string | Delivery mode |
| productType | string | Contract type |
Request Example:
FutureContractResponse cl = client.execute(FutureContinuousContractRequest.newRequest("CL"));
System.out.println(cl.getFutureContractItem());Response Example:
{
"type": "ES",
"name": "E-mini S&P 500 - main",
"ibCode": "ES",
"contractCode": "ESmain",
"contractMonth": "",
"exchangeCode": "GLOBEX",
"multiplier": 50,
"minTick": 0.25,
"lastTradingDate": "",
"firstNoticeDate": "",
"lastBiddingCloseTime": 0,
"currency": "USD",
"continuous": false,
"trade": true
}Query Historical Contracts of Futures Main Contracts
Corresponding Request Class: FutureHistoryMainContractRequest
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| contractCodes | array | Yes | List of futures main contract codes, e.g., ESmain |
| beginTime | long | Yes | Start time (exclusive) |
| endTime | long | Yes | End time (inclusive) |
Returns
FutureHistoryMainContractItem object
FutureHistoryMainContractItem field descriptions:
| Name | Type | Description |
|---|---|---|
| contractCode | string | Futures main contract code |
| mainReferItems | array | Historical contract list of main contract, see FutureHistoryContractItem field description below |
Historical contract data mainReferItems attributes:
| Name | Type | Description |
|---|---|---|
| time | long | Date timestamp |
| referContractCode | string | Futures contract corresponding to main continuous contract |
Request Example
List<String> contractCodes = new ArrayList<>();
contractCodes.add("ESmain");
FutureHistoryMainContractRequest request = FutureHistoryMainContractRequest.newRequest(contractCodes,
"2023-06-01", "2023-10-05", TimeZoneId.NewYork);
FutureHistoryMainContractResponse response = client.execute(request);
if (response.isSuccess()) {
System.out.println(JSONObject.toJSONString(response));
} else {
System.out.println(response.getMessage());
}Response Example
{
"code":0,
"data":[
{
"contractCode":"ESmain",
"mainReferItems":[
{
"referContractCode":"ES2312",
"time":1696453200000
},
{
"referContractCode":"ES2312",
"time":1696366800000
},
{
"referContractCode":"ES2312",
"time":1696280400000
},
{
"referContractCode":"ES2312",
"time":1696021200000
},
{
"referContractCode":"ES2312",
"time":1695934800000
},
{
"referContractCode":"ES2312",
"time":1695848400000
},
{
"referContractCode":"ES2312",
"time":1695762000000
},
{
"referContractCode":"ES2312",
"time":1695675600000
},
{
"referContractCode":"ES2312",
"time":1695416400000
},
{
"referContractCode":"ES2312",
"time":1695330000000
},
{
"referContractCode":"ES2312",
"time":1695243600000
},
{
"referContractCode":"ES2312",
"time":1695157200000
},
{
"referContractCode":"ES2312",
"time":1695070800000
},
{
"referContractCode":"ES2312",
"time":1694811600000
},
{
"referContractCode":"ES2312",
"time":1694725200000
},
{
"referContractCode":"ES2312",
"time":1694638800000
},
{
"referContractCode":"ES2312",
"time":1694552400000
},
{
"referContractCode":"ES2312",
"time":1694466000000
},
{
"referContractCode":"ES2309",
"time":1694206800000
},
{
"referContractCode":"ES2309",
"time":1694120400000
},
{
"referContractCode":"ES2309",
"time":1694034000000
},
{
"referContractCode":"ES2309",
"time":1693947600000
},
{
"referContractCode":"ES2309",
"time":1693602000000
},
{
"referContractCode":"ES2309",
"time":1693515600000
},
{
"referContractCode":"ES2309",
"time":1693429200000
},
{
"referContractCode":"ES2309",
"time":1693342800000
},
{
"referContractCode":"ES2309",
"time":1693256400000
},
{
"referContractCode":"ES2309",
"time":1692997200000
},
{
"referContractCode":"ES2309",
"time":1692910800000
},
{
"referContractCode":"ES2309",
"time":1692824400000
},
{
"referContractCode":"ES2309",
"time":1692738000000
},
{
"referContractCode":"ES2309",
"time":1692651600000
},
{
"referContractCode":"ES2309",
"time":1692392400000
},
{
"referContractCode":"ES2309",
"time":1692306000000
},
{
"referContractCode":"ES2309",
"time":1692219600000
},
{
"referContractCode":"ES2309",
"time":1692133200000
},
{
"referContractCode":"ES2309",
"time":1692046800000
},
{
"referContractCode":"ES2309",
"time":1691787600000
},
{
"referContractCode":"ES2309",
"time":1691701200000
},
{
"referContractCode":"ES2309",
"time":1691614800000
},
{
"referContractCode":"ES2309",
"time":1691528400000
},
{
"referContractCode":"ES2309",
"time":1691442000000
},
{
"referContractCode":"ES2309",
"time":1691182800000
},
{
"referContractCode":"ES2309",
"time":1691096400000
},
{
"referContractCode":"ES2309",
"time":1691010000000
},
{
"referContractCode":"ES2309",
"time":1690923600000
},
{
"referContractCode":"ES2309",
"time":1690837200000
},
{
"referContractCode":"ES2309",
"time":1690578000000
},
{
"referContractCode":"ES2309",
"time":1690491600000
},
{
"referContractCode":"ES2309",
"time":1690405200000
},
{
"referContractCode":"ES2309",
"time":1690318800000
},
{
"referContractCode":"ES2309",
"time":1690232400000
},
{
"referContractCode":"ES2309",
"time":1689973200000
},
{
"referContractCode":"ES2309",
"time":1689886800000
},
{
"referContractCode":"ES2309",
"time":1689800400000
},
{
"referContractCode":"ES2309",
"time":1689714000000
},
{
"referContractCode":"ES2309",
"time":1689627600000
},
{
"referContractCode":"ES2309",
"time":1689368400000
},
{
"referContractCode":"ES2309",
"time":1689282000000
},
{
"referContractCode":"ES2309",
"time":1689195600000
},
{
"referContractCode":"ES2309",
"time":1689109200000
},
{
"referContractCode":"ES2309",
"time":1689022800000
},
{
"referContractCode":"ES2309",
"time":1688763600000
},
{
"referContractCode":"ES2309",
"time":1688677200000
},
{
"referContractCode":"ES2309",
"time":1688590800000
},
{
"referContractCode":"ES2309",
"time":1688404500000
},
{
"referContractCode":"ES2309",
"time":1688158800000
},
{
"referContractCode":"ES2309",
"time":1688072400000
},
{
"referContractCode":"ES2309",
"time":1687986000000
},
{
"referContractCode":"ES2309",
"time":1687899600000
},
{
"referContractCode":"ES2309",
"time":1687813200000
},
{
"referContractCode":"ES2309",
"time":1687554000000
},
{
"referContractCode":"ES2309",
"time":1687467600000
},
{
"referContractCode":"ES2309",
"time":1687381200000
},
{
"referContractCode":"ES2309",
"time":1687294800000
},
{
"referContractCode":"ES2309",
"time":1686949200000
},
{
"referContractCode":"ES2309",
"time":1686862800000
},
{
"referContractCode":"ES2309",
"time":1686776400000
},
{
"referContractCode":"ES2309",
"time":1686690000000
},
{
"referContractCode":"ES2309",
"time":1686603600000
},
{
"referContractCode":"ES2306",
"time":1686344400000
},
{
"referContractCode":"ES2306",
"time":1686258000000
},
{
"referContractCode":"ES2306",
"time":1686171600000
},
{
"referContractCode":"ES2306",
"time":1686085200000
},
{
"referContractCode":"ES2306",
"time":1685998800000
},
{
"referContractCode":"ES2306",
"time":1685739600000
},
{
"referContractCode":"ES2306",
"time":1685653200000
}
]
}
],
"message":"success",
"sign":"H/m3GVmsGstQNJxnQrF4nNwkJ3EBJEIBTHMdxzvRKVdM5XtB+PhxlVJBSYclHSRkFn13ckgEr13pzGTrGYjM7cT5zXTTNn0wS0WtVsJoycaUoWqr8KT8P6B6cHq0Sj5LVA5nZlNpno33dplWMWNX3urDf6OiGtQ6J9/ZJcZnvxM=",
"success":true,
"timestamp":1696499214141
}Query Trading Hours for Specified Futures Contract
Corresponding Request Class: FutureTradingDateRequest
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| contractCode | string | Yes | Futures contract code, e.g., CL1901 |
| tradingDate | long | Yes | Trading date timestamp |
Returns
FutureTradingDateItem object
FutureTradingDateItem field descriptions:
| Name | Type | Description |
|---|---|---|
| tradingTimes | array | Trading hours |
| biddingTimes | array | Bidding hours |
| timeSection | string | Trading timezone |
Request Example
FutureTradingDateResponse response = client.execute(FutureTradingDateRequest.newRequest("ES2203", System.currentTimeMillis()));
System.out.println(response.getFutureTradingDateItem());
Response Example
FutureTradingDateItem{biddingTimes=[TimeSection{start=1644873300000, end=1644874200000}], tradingTimes=[TimeSection{start=1644793200000, end=1644873300000}, TimeSection{start=1644874200000, end=1644876000000}], timeSection='America/Chicago'}Futures Real-time Quotes
Corresponding Request Class: FutureRealTimeQuoteRequest
Description
Get futures real-time quotes
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| contractCodes | array | Yes | List of contract codes, supports main contracts, e.g., CL1901/CLmain |
Returns
List of FutureRealTimeItem objects
FutureRealTimeItem field descriptions:
| Name | Type | Description |
|---|---|---|
| contractCode | string | Contract code |
| latestPrice | double | Latest trade price |
| latestSize | double | Volume of latest price |
| latestTime | long | Time of latest price |
| bidPrice | double | Bid price (level 1) |
| bidSize | long | Bid quantity (level 1) |
| askPrice | double | Ask price (level 1) |
| askSize | long | Ask quantity (level 1) |
| volume | long | Daily cumulative traded contracts |
| openInterest | no | Open interest |
| openInterestChange | no | Change in open interest |
| open | double | Opening price |
| high | double | Highest price |
| low | double | Lowest price |
| settlement | double | Settlement price, returns 0 when not generated |
| limitUp | double | Daily limit up price |
| limitDown | double | Daily limit down price |
Example
List<String> contractCodes = new ArrayList<>();
contractCodes.add("CL1902");
FutureRealTimeQuoteResponse response = client.execute(FutureRealTimeQuoteRequest.newRequest(contractCodes));
System.out.println(response.getFutureRealTimeItems());Response Example
{
"code": 0,
"timestamp": 1545102059229,
"message": "success",
"data": [{
"contractCode": "CN1901",
"askPrice": 49.4,
"askSize": 2,
"bidPrice": 49.39,
"bidSize": 4,
"latestSize": 1,
"latestPrice": 49.39,
"volume": -18140,
"openInterest": 72189,
"openInterestChange": 0,
"settlement": 49.88,
"high": 49.59,
"low": 49.14,
"latestTime": 1545102035000,
"open": 49.16,
"limitUp": 55.88,
"limitDown": 43.88
}]
}Get Futures Market Depth Data
Corresponding Request Class: FutureDepthRequest
Description
Get futures market depth data.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| contractCodes | array | Yes | List of contract codes, supports main contracts, e.g., CL1901/CLmain |
Returns
List of FutureDepthItem objects
FutureDepthItem field descriptions:
| Name | Type | Description |
|---|---|---|
| contractCode | string | Contract code |
| contractId | string | Contract ID |
| ask | List<FutureDepthAskBidItem> | Ask levels |
| bid | List<FutureDepthAskBidItem> | Bid levels |
FutureDepthAskBidItem field descriptions:
| Name | Type | Description |
|---|---|---|
| price | BigDecimal | Order price |
| volume | Long | Order volume |
Example
FutureDepthRequest request = FutureDepthRequest.newRequest(Collections.singletonList("XWmain"));
FutureRealTimeQuoteResponse response = client.execute(request);
System.out.println(response.getFutureDepthItems());Response Example
{
"code" : 0,
"message" : "success",
"timestamp" : 1754983558519,
"sign" : "mfa4bnsB6ZNezDuPzqiKt7fIz/pVVfB/xcXoCPZh7q+4TXeXvAu6FgGd1NmsCMf10JQNXibes/+ayMrVxdT3VVsOqVfOAqaeyyB6cDISdIajArHlIVc16eCtv2s2ceoAL+XGFpNTJNof9TH0b9SzL5RYZy7xhVBe4MGGeXXdFfs=",
"data" : [ {
"lang" : null,
"contractId" : "b1846ff7d24744a3a6b16b11ebeb16ee",
"contractCode" : "XWmain",
"ask" : [ {
"price" : 5.12000,
"volume" : 4
}, {
"price" : 5.12125,
"volume" : 5
}, {
"price" : 5.12250,
"volume" : 4
}],
"bid" : [ {
"price" : 5.11625,
"volume" : 7
}, {
"price" : 5.11500,
"volume" : 6
}, {
"price" : 5.11375,
"volume" : 4
}],
"account" : null
} ],
"success" : true
}Get Futures Tick-by-Tick Data
Corresponding Request Class: FutureTickRequest
Description
The index resets to 0 every day at 6:00 AM Beijing time. Tick-by-tick data from the previous day is cleared one minute before the earliest trading session (auction or trading) begins. New tick-by-tick data is recorded after the new trading session starts. This reset occurs only once per day, meaning multiple trading sessions within the same trading day do not trigger additional resets.
Caution
Once the previous day's tick-by-tick data is cleared, the API can no longer access this data. For example: GC2504 tick data can be accessed before 5:59 AM, but will reset to index 0 at 6:00 AM.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| contractCode | string | Yes | Futures contract code, e.g., CL1901 |
| beginIndex | long | Yes | Start index. For the first request, beginIndex and endIndex can be set to -1. The first request returns the latest tick data. Subsequent requests can pass the last returned index value + 1 |
| endIndex | long | Yes | End index. If the difference between end index and start index is greater than 1000, a maximum of 1000 records will be returned. When either end index or start index is set to -1, the query starts from the non-(-1) end and returns limit tick records. |
| limit | Int | No | Default is 200, maximum limit is 1000 records |
beginIndex and endIndex Parameter Usage
| Query Method | beginIndex | endIndex | Description |
|---|---|---|---|
| Query tick records forward | Specific value | -1 | Example: beginIndex=10, endIndex=-1, limit=20, returns 20 records from 10 to 29. |
| Query tick records backward | -1 | Specific value | Example: beginIndex=-1, endIndex=29, limit=20, returns 20 records from 10 to 29. |
| Query latest tick records | -1 | -1 | Returns limit latest tick records. |
| Query range index | Specific value | Specific value | Example: beginIndex=10, endIndex=100, returns 91 records from 10 to 100 inclusive. If limit is set to 20, returns 20 records from 10 to 29. |
Returns
FutureTickBatchItem object
FutureTickBatchItem field descriptions:
| Name | Type | Description |
|---|---|---|
| contractCode | string | Contract code |
| index | integer | Index |
| price | double | Trade price |
| volume | long | Trade volume |
| time | long | Time |
Example
List<String> contractCodes = new ArrayList<>();
contractCodes.add("CL1902");
FutureTickResponse response = client.execute(FutureTickRequest.newRequest("CL2209", 10L, 100L,20));
System.out.println(response.getFutureTickItems());Response Example
{
"code": 0,
"data": {
"contractCode": "CL2209",
"items": [{
"index": 10,
"price": 87.91,
"time": 1660600802000,
"volume": 6
}, {
"index": 11,
"price": 87.90,
"time": 1660600802000,
"volume": 1
}, {
"index": 12,
"price": 87.93,
"time": 1660600802000,
"volume": 1
}, {
"index": 13,
"price": 87.91,
"time": 1660600803000,
"volume": 4
}, {
"index": 14,
"price": 87.89,
"time": 1660600804000,
"volume": 1
}, {
"index": 15,
"price": 87.90,
"time": 1660600804000,
"volume": 1
}, {
"index": 16,
"price": 87.92,
"time": 1660600804000,
"volume": 2
}, {
"index": 17,
"price": 87.91,
"time": 1660600804000,
"volume": 1
}, {
"index": 18,
"price": 87.93,
"time": 1660600805000,
"volume": 8
}, {
"index": 19,
"price": 87.93,
"time": 1660600805000,
"volume": 10
}, {
"index": 20,
"price": 87.93,
"time": 1660600805000,
"volume": 7
}, {
"index": 21,
"price": 87.93,
"time": 1660600805000,
"volume": 8
}, {
"index": 22,
"price": 87.93,
"time": 1660600805000,
"volume": 7
}, {
"index": 23,
"price": 87.95,
"time": 1660600806000,
"volume": 1
}, {
"index": 24,
"price": 87.94,
"time": 1660600806000,
"volume": 1
}, {
"index": 25,
"price": 87.95,
"time": 1660600807000,
"volume": 1
}, {
"index": 26,
"price": 87.98,
"time": 1660600807000,
"volume": 1
}, {
"index": 27,
"price": 87.99,
"time": 1660600807000,
"volume": 1
}, {
"index": 28,
"price": 88.00,
"time": 1660600807000,
"volume": 1
}, {
"index": 29,
"price": 87.97,
"time": 1660600807000,
"volume": 2
}]
},
"message": "success",
"sign": "llqaLoA5mQZN+nx1pGq5/mp1Ds5Z77uCvD+wM4TM7jtyvW",
"success": true,
"timestamp": 1660620843648
}Get Futures K-line Data
Corresponding Request Class: FutureKlineRequest
Description
Provides daily K-line data for popular contracts over the past 10 years, and minute-level data for all contracts from August 2017 to present.
Results are returned in reverse chronological order starting from endTime.
For 1-minute K-line, if there are no trades within that minute, the K-line data for that minute will be missing. The interface can only retrieve K-line data for the latest minute after trades occur within that minute. If the first trade occurs at the 50th second, data cannot be retrieved before the 50th second.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| contractCodes | array | Yes | List of contract codes, supports main contracts, e.g., CL1901/CLmain |
| period | string | Yes | K-line period, values: "min", "3min", "5min", "10min","15min", "30min", "45min", "60min","2hour", "3hour", "4hour", "6hour","day", "week", "month" |
| beginTime | long | Yes | Start time (inclusive) |
| endTime | long | Yes | End time (exclusive) |
| limit | int | No | Request limit, default 200, maximum limit: 1000 |
| pageToken | string | No | Pagination token (only supports single contract, queries with specified endTime), when using pageToken pagination, other query conditions cannot change |
Returns
List of FutureKlineBatchItem objects
FutureKlineBatchItem field descriptions:
| Field | Type | Description |
|---|---|---|
| contractCode | string | Contract code |
| nextPageToken | string | Token for querying next page (only valid for single contract code with non-null endTime not equal to -1), returns null if no more data |
| items | array | K-line array, see field descriptions below |
K-line data items attributes:
| Name | Type | Description |
|---|---|---|
| lastTime | long | Time of latest price trade |
| volume | long | Traded contracts |
| openInterest | no | Open interest |
| open | double | Opening price |
| close | double | Closing price |
| time | long | Time |
| high | double | Highest price |
| low | double | Lowest price |
| settlement | double | Settlement price, returns 0 when not generated |
Example
List<String> contractCodes = new ArrayList<>();
contractCodes.add("CL1901");
FutureKlineResponse response = client.execute(
FutureKlineRequest.newRequest(contractCodes, FutureKType.min15, 1535634249489L,
1538807049489L, 200));
System.out.println(response.getFutureKlineItems());Response Example
{
"code": 0,
"timestamp": 1545105097358,
"message": "success",
"data": [{
"contractCode": "CL1901",
"items": [{
"lastTime": 1545083998000,
"volume": 124206,
"high": 51.87,
"openInterest": 90329,
"low": 4901,
"time": 1545084000000,
"close": 49.16,
"open": 51.25,
"settlement": 49.88
},
{
"lastTime": 1544824796000,
"volume": 434074,
"high": 52.95,
"openInterest": 131753,
"low": 5084,
"time": 1544824800000,
"close": 51.23,
"open": 52.83,
"settlement": 51.2
},
{
"lastTime": 1544738399000,
"volume": 593178,
"high": 53.27,
"openInterest": 186783,
"low": 5035,
"time": 1544738400000,
"close": 52.85,
"open": 51.2,
"settlement": 52.58
}
]
}]
}PageToken Example
List<String> contractCodes = new ArrayList<>();
contractCodes.add("NGmain");
// pagetoken only for single symbol and specified endTime
FutureKlineRequest request = FutureKlineRequest.newRequest(contractCodes, FutureKType.day,
1650920400000L, 1651870900000L, 3);
int count = 1;
while (true) {
FutureKlineResponse response = client.execute(request);
System.out.println("search time:" + count + ", success:" + response.isSuccess() + ", msg:" + response.getMessage());
if (!response.isSuccess()) {
break;
}
System.out.println(response.getFutureKlineItems());
if (response.getFutureKlineItems().size() == 0) {
break;
}
String nextPageToken = response.getFutureKlineItems().get(0).getNextPageToken();
if (nextPageToken == null) {
break;
}
count++;
// 10 times per minute
try {
TimeUnit.SECONDS.sleep(6);
} catch (InterruptedException e) {
e.printStackTrace();
}
// set nextPageToken and search next page data
request.withPageToken(nextPageToken);
}Updated 1 day ago
