中文

Futures

Get Futures Exchange List

Corresponding Request Class: FutureExchangeRequest

Parameters

ParameterTypeRequiredDescription
secTypestringYesSecurity type. "FUT": Futures, "FOP": Futures Options (futures options quotes not yet provided)
langstringNoLanguage parameter, affects the "name" field in return values. Valid values: "zh_CN", "en_US"

Return

List of FutureExchangeItem objects

FutureExchangeItem object field descriptions:

NameTypeDescription
codestringExchange code
namestringExchange name
zoneIdstringTrading 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

ParameterTypeRequiredDescription
exchangeCodestringYesExchange code
langstringNoLanguage parameter, affects the "name" field in return values. Valid values: "zh_CN", "en_US"

Return

List of FutureContractItem objects

FutureContractItem object field descriptions:

NameTypeDescription
typestringFutures contract trading variety, e.g., CL
tradebooleanWhether tradable
continuousbooleanWhether continuous contract
namestringContract name, available in Chinese and English, returned based on lang parameter
currencystringTrading currency
ibCodestringTrading contract code used for placing orders, e.g., CL
contractCodestringContract code, e.g., CL1901
contractMonthstringContract delivery month
lastTradingDatestringLast 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
firstNoticeDatestringFirst 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)
lastBiddingCloseTimelongBidding close time
multiplierdoubleContract 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
exchangestringExchange code
minTickdoubleMinimum 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
productWorthstringContract size
deliveryModestringDelivery mode
productTypestringContract 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

ParameterTypeRequiredDescription
contractCodestringYesContract symbol, e.g., CN1901
langstringNoLanguage parameter, affects the "name" field in return values. Valid values: "zh_CN", "en_US"

Return

FutureContractItem object

FutureContractItem object field descriptions:

NameTypeDescription
typestringFutures contract trading variety, e.g., CL
tradebooleanWhether tradable
continuousbooleanWhether continuous contract
namestringContract name, available in Chinese and English, returned based on lang parameter
currencystringTrading currency
ibCodestringTrading contract code used for placing orders, e.g., CL
contractCodestringContract code, e.g., CL1901
contractMonthstringContract delivery month
lastTradingDatestringLast 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
firstNoticeDatestringFirst 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)
lastBiddingCloseTimelongBidding close time
multiplierdoubleContract 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
exchangestringExchange code
minTickdoubleMinimum 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:

ParameterTypeRequiredDescription
typestringYesFutures contract trading variety, e.g., CL
langstringNoLanguage parameter, affects the "name" field in return values. Valid values: "zh_CN", "en_US"

Return

FutureContractItem object

FutureContractItem object field descriptions:

NameTypeDescription
typestringFutures contract trading variety, e.g., CL
tradebooleanWhether tradable
continuousbooleanWhether continuous contract
namestringContract name, available in Chinese and English, returned based on lang parameter
currencystringTrading currency
ibCodestringTrading contract code used for placing orders, e.g., CL
contractCodestringContract code, e.g., CL1901
contractMonthstringContract delivery month
lastTradingDatestringLast 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
firstNoticeDatestringFirst 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)
lastBiddingCloseTimelongBidding close time
multiplierdoubleContract 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
exchangestringExchange code
minTickdoubleMinimum 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
productWorthstringContract size
deliveryModestringDelivery mode
productTypestringContract 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

ParameterTypeRequiredDescription
typestringYesFutures contract trading variety, e.g., CL
langstringYesLanguage parameter, affects the "name" field in return values. Valid values: "zh_CN", "en_US"

Return

List of FutureContractItem objects

FutureContractItem object field descriptions:

NameTypeDescription
typestringFutures contract trading variety, e.g., CL
tradebooleanWhether tradable
continuousbooleanWhether continuous contract
namestringContract name, available in Chinese and English, returned based on lang parameter
currencystringTrading currency
ibCodestringTrading contract code used for placing orders, e.g., CL
contractCodestringContract code, e.g., CL1901
contractMonthstringContract delivery month
lastTradingDatestringLast 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
firstNoticeDatestringFirst 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)
lastBiddingCloseTimelongBidding close time
multiplierdoubleContract 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
exchangestringExchange code
minTickdoubleMinimum 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
productWorthstringContract size
deliveryModestringDelivery mode
productTypestringContract 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

ParameterTypeRequiredDescription
typestringYesFutures contract trading variety, e.g., CL
langstringYesLanguage parameter, affects the "name" field in return values. Valid values: "zh_CN", "en_US"

Return

FutureContractItem object

FutureContractItem object field descriptions:

NameTypeDescription
typestringFutures contract trading variety, e.g., CL
tradebooleanWhether tradable
continuousbooleanWhether continuous contract
namestringContract name, available in Chinese and English, returned based on lang parameter
currencystringTrading currency
ibCodestringTrading contract code used for placing orders, e.g., CL
contractCodestringContract code, e.g., CL1901
contractMonthstringContract delivery month
lastTradingDatestringLast 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
firstNoticeDatestringFirst 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)
lastBiddingCloseTimelongBidding close time
multiplierdoubleContract 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
exchangestringExchange code
minTickdoubleMinimum 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
productWorthstringContract size
deliveryModestringDelivery mode
productTypestringContract 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

ParameterTypeRequiredDescription
contractCodesarrayYesList of futures main contract codes, e.g., ESmain
beginTimelongYesStart time (exclusive)
endTimelongYesEnd time (inclusive)

Returns

FutureHistoryMainContractItem object

FutureHistoryMainContractItem field descriptions:

NameTypeDescription
contractCodestringFutures main contract code
mainReferItemsarrayHistorical contract list of main contract, see FutureHistoryContractItem field description below

Historical contract data mainReferItems attributes:

NameTypeDescription
timelongDate timestamp
referContractCodestringFutures 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

ParameterTypeRequiredDescription
contractCodestringYesFutures contract code, e.g., CL1901
tradingDatelongYesTrading date timestamp

Returns

FutureTradingDateItem object

FutureTradingDateItem field descriptions:

NameTypeDescription
tradingTimesarrayTrading hours
biddingTimesarrayBidding hours
timeSectionstringTrading 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

ParameterTypeRequiredDescription
contractCodesarrayYesList of contract codes, supports main contracts, e.g., CL1901/CLmain

Returns

List of FutureRealTimeItem objects

FutureRealTimeItem field descriptions:

NameTypeDescription
contractCodestringContract code
latestPricedoubleLatest trade price
latestSizedoubleVolume of latest price
latestTimelongTime of latest price
bidPricedoubleBid price (level 1)
bidSizelongBid quantity (level 1)
askPricedoubleAsk price (level 1)
askSizelongAsk quantity (level 1)
volumelongDaily cumulative traded contracts
openInterestnoOpen interest
openInterestChangenoChange in open interest
opendoubleOpening price
highdoubleHighest price
lowdoubleLowest price
settlementdoubleSettlement price, returns 0 when not generated
limitUpdoubleDaily limit up price
limitDowndoubleDaily 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

ParameterTypeRequiredDescription
contractCodesarrayYesList of contract codes, supports main contracts, e.g., CL1901/CLmain

Returns

List of FutureDepthItem objects

FutureDepthItem field descriptions:

NameTypeDescription
contractCodestringContract code
contractIdstringContract ID
askList<FutureDepthAskBidItem>Ask levels
bidList<FutureDepthAskBidItem>Bid levels

FutureDepthAskBidItem field descriptions:

NameTypeDescription
priceBigDecimalOrder price
volumeLongOrder 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

ParameterTypeRequiredDescription
contractCodestringYesFutures contract code, e.g., CL1901
beginIndexlongYesStart 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
endIndexlongYesEnd 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.
limitIntNoDefault is 200, maximum limit is 1000 records

beginIndex and endIndex Parameter Usage

Query MethodbeginIndexendIndexDescription
Query tick records forwardSpecific value-1Example: beginIndex=10, endIndex=-1, limit=20, returns 20 records from 10 to 29.
Query tick records backward-1Specific valueExample: beginIndex=-1, endIndex=29, limit=20, returns 20 records from 10 to 29.
Query latest tick records-1-1Returns limit latest tick records.
Query range indexSpecific valueSpecific valueExample: 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:

NameTypeDescription
contractCodestringContract code
indexintegerIndex
pricedoubleTrade price
volumelongTrade volume
timelongTime

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

ParameterTypeRequiredDescription
contractCodesarrayYesList of contract codes, supports main contracts, e.g., CL1901/CLmain
periodstringYesK-line period, values: "min", "3min", "5min", "10min","15min", "30min", "45min", "60min","2hour", "3hour", "4hour", "6hour","day", "week", "month"
beginTimelongYesStart time (inclusive)
endTimelongYesEnd time (exclusive)
limitintNoRequest limit, default 200, maximum limit: 1000
pageTokenstringNoPagination 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:

FieldTypeDescription
contractCodestringContract code
nextPageTokenstringToken for querying next page (only valid for single contract code with non-null endTime not equal to -1), returns null if no more data
itemsarrayK-line array, see field descriptions below

K-line data items attributes:

NameTypeDescription
lastTimelongTime of latest price trade
volumelongTraded contracts
openInterestnoOpen interest
opendoubleOpening price
closedoubleClosing price
timelongTime
highdoubleHighest price
lowdoubleLowest price
settlementdoubleSettlement 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);
    }