Futures
Get the list of futures exchanges
Corresponding request class: FutureExchangeRequest
Parameter
parameter | type | required | description |
---|---|---|---|
secType | string | yes | Contract type. "FUT": futures, "FOP": futures options (the market for futures options is not yet available) |
lang | string | no | Language parameter, which affects the "name" field in the return value, and the value range is: "zh_CN", "en_US" |
Response
List of FutureExchangeItem
objects
The specific fields of the FutureExchangeItem
object are described as follows:
name | type | description |
---|---|---|
code | string | exchange code |
name | string | exchange name |
zoneId | string | Transaction time zone |
Example
FutureExchangeResponse response = client.execute(FutureExchangeRequest.newRequest(SecType.FUT.name()));
System.out.println(response.getFutureExchangeItems());
Response example
[FutureExchangeItem{code='CME', name='CME', zoneId='America/Chicago'}, FutureExchangeItem{code='NYMEX', name='NYMEX', zoneId='America/New_York'}, FutureExchangeItem{code ='COMEX', name='COMEX', zoneId='America/New_York'}, FutureExchangeItem{code='SGX', name='SGX', zoneId='Singapore'}, FutureExchangeItem{code='HKEX', name ='HKEX', zoneId='Asia/Hong_Kong'}, FutureExchangeItem{code='CBOT', name='CBOT', zoneId='America/Chicago'}, FutureExchangeItem{code='CBOE', name='CBOE' , zoneId='America/Chicago'}]
Query the futures contract according to the contract code
Corresponding request class: FutureContractByConCodeRequest
How to deal with the first notice day and the last trading day: Whether it is the first notice day or the final settlement day, the main trading month will be transferred to the next month contract, which will make the liquidity of the expiring month worse, so it is recommended not to Whether it is a long order or a short order, before the first notice day and the last trading day is approaching, transfer or trade the next month's contract.
Parameter
parameter | type | required | description |
---|---|---|---|
contractCode | string | yes | symbol of the contract, such as CN1901 |
lang | string | no | Language parameter, which affects the "name" field in the return value, and the value range is: "zh_CN", "en_US" |
Response
FutureContractItem
object
The specific fields of the FutureContractItem
object are described as follows:
name | type | description |
---|---|---|
type | string | The trading variety corresponding to the futures contract, such as CL |
trade | boolean | whether it can be traded |
continuous | boolean | whether the contract is continuous |
name | string | The name of the contract, there are simplified and English names, returned according to the parameter lang |
currency | string | The currency of the transaction |
ibCode | string | Transaction contract code, used when placing an order. Such as: CL |
contractCode | string | Contract code, for example, CL1901 |
contractMonth | string | contract delivery month |
lastTradingDate | string | refers to the last trading date of the contract expiration month. Futures contracts that have not been cleared after the last trading day must be closed through the relevant "spot commodity" or "cash settlement". At present, the last trading day of most futures commodities is usually settlement day. For some commodities, the first notification day is the same day as the last trading day, such as the euro For cash-settled futures, as long as the last trading time has not passed, positions can be opened normally. Non-cash-settled futures are based on The lesser of the last trading time and the first notice day, limit the opening of positions in the first three trading days |
firstNoticeDate | string | The first notice date refers to the date when the physical delivery contract can be delivered. The contract cannot open long positions after the first notice date. Existing long positions will be forced to close before the first notice day (usually the first three trading days). This field is empty for non-physical delivery contracts (such as index contracts) |
lastBiddingCloseTime | long | Bidding closing time |
multiplier | double | contract multiplier, the futures price multiplied by the contract multiplier is the face value of the contract, and the reasonable price of the futures can be estimated by dividing the physical price by the contract multiplier |
exchange | string | exchange symbol |
minTick | double | The minimum quotation unit for futures price changes. For example, if the current futures price is 2000 and minTick is 100, the correct quotation includes 2100, 2200, and 2005 does not meet the requirements |
Example
FutureContractResponse response = client.execute(FutureContractByConCodeRequest.newRequest("CN2203"));
System.out.println(response.getFutureContractItem());
Response Example
FutureContractItem{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}
Get the tradable contracts under the exchange
Corresponding request class: FutureContractByExchCodeRequest
Parameter
parameter | type | required | description |
---|---|---|---|
exchangeCode | string | yes | exchange code |
lang | string | no | Language parameter, which affects the "name" field in the return value, and the value range is: "zh_CN", "en_US" |
Response
List of FutureContractItem
objects
The specific fields of the FutureContractItem
object are described as follows:
name | type | description |
---|---|---|
type | string | The trading variety corresponding to the futures contract, such as CL |
trade | boolean | whether it can be traded |
continuous | boolean | whether the contract is continuous |
name | string | The name of the contract, there are simplified and English names, returned according to the parameter lang |
currency | string | The currency of the transaction |
ibCode | string | Transaction contract code, used when placing an order. Such as: CL |
contractCode | string | Contract code, for example, CL1901 |
contractMonth | string | contract delivery month |
lastTradingDate | string | refers to the last trading date of the contract expiration month. Futures contracts that have not been cleared after the last trading day must be closed through the relevant "spot commodity" or "cash settlement". At present, the last trading day of most futures commodities is usually settlement day. For some commodities, the first notification day is the same day as the last trading day, such as the euro For cash-settled futures, as long as the last trading time has not passed, positions can be opened normally. Non-cash-settled futures are based on The lesser of the last trading time and the first notice day, limit the opening of positions in the first three trading days |
firstNoticeDate | string | The first notice date refers to the date when the physical delivery contract can be delivered. The contract cannot open long positions after the first notice date. Existing long positions will be forced to close before the first notice day (usually the first three trading days). This field is empty for non-physical delivery contracts (such as index contracts) |
lastBiddingCloseTime | long | Bidding closing time |
multiplier | double | contract multiplier, the futures price multiplied by the contract multiplier is the face value of the contract, and the reasonable price of the futures can be estimated by dividing the physical price by the contract multiplier |
exchange | string | exchange symbol |
minTick | double | The minimum quotation unit for futures price changes. For example, if the current futures price is 2000 and minTick is 100, the correct quotation includes 2100, 2200, and 2005 does not meet the requirements |
Example
FutureBatchContractResponse response = client.execute(FutureContractByExchCodeRequest.newRequest("CME"));
System.out.println(response.getFutureContractItems());
Response example
[FutureContractItem{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},
FutureContractItem{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},
FutureContractItem{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},
FutureContractItem{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},
FutureContractItem{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},
FutureContractItem{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}
]
Query all contracts of the specified symbol
Corresponding request class: FutureContractsRequest
Parameter
parameter | type | required | description |
---|---|---|---|
type | string | yes | the trading variety corresponding to the futures contract, such as CL |
lang | string | yes | Language parameter, which affects the "name" field in the return value, and the value range is: "zh_CN", "en_US" |
Response
List of FutureContractItem
objects
The specific fields of the FutureContractItem
object are described as follows:
name | type | description |
---|---|---|
type | string | The trading variety corresponding to the futures contract, such as CL |
trade | boolean | whether it can be traded |
continuous | boolean | whether the contract is continuous |
name | string | The name of the contract, there are simplified and English names, returned according to the parameter lang |
currency | string | The currency of the transaction |
ibCode | string | Transaction contract code, used when placing an order. Such as: CL |
contractCode | string | Contract code, for example, CL1901 |
contractMonth | string | contract delivery month |
lastTradingDate | string | refers to the last trading date of the contract expiration month. Futures contracts that have not been cleared after the last trading day must be closed through the relevant "spot commodity" or "cash settlement". At present, the last trading day of most futures commodities is usually settlement day. For some commodities, the first notification day is the same day as the last trading day, such as the euro For cash-settled futures, as long as the last trading time has not passed, positions can be opened normally. Non-cash-settled futures are based on The lesser of the last trading time and the first notice day, limit the opening of positions in the first three trading days |
firstNoticeDate | string | The first notice date refers to the date when the physical delivery contract can be delivered. The contract cannot open long positions after the first notice date. Existing long positions will be forced to close before the first notice day (usually the first three trading days). This field is empty for non-physical delivery contracts (such as index contracts) |
lastBiddingCloseTime | long | Bidding closing time |
multiplier | double | contract multiplier, the futures price multiplied by the contract multiplier is the face value of the contract, and the reasonable price of the futures can be estimated by dividing the physical price by the contract multiplier |
exchange | string | exchange symbol |
minTick | double | The minimum quotation unit for futures price changes. For example, if the current futures price is 2000 and minTick is 100, the correct quotation includes 2100, 2200, and 2005 does not meet the requirements |
Example
FutureContractsResponse contractResponse = client.execute(FutureContractsRequest.newRequest("CN"));
System.out.println(contractResponse.getFutureContractItems());
Response example
[FutureContractItem{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},
FutureContractItem{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},
FutureContractItem{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},
FutureContractItem{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},
FutureContractItem{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 the continuous contract of the specified symbol
Corresponding request class: FutureContinuousContractRequest
Parameter
parameter | type | required | description |
---|---|---|---|
type | string | yes | the trading variety corresponding to the futures contract, such as CL |
lang | string | yes | Language parameter, which affects the "name" field in the return value, and the value range is: "zh_CN", "en_US" |
Response
FutureContractItem
object
The specific fields of the FutureContractItem
object are described as follows:
name | type | description |
---|---|---|
type | string | The trading variety corresponding to the futures contract, such as CL |
trade | boolean | whether it can be traded |
continuous | boolean | whether the contract is continuous |
name | string | The name of the contract, there are simplified and English names, returned according to the parameter lang |
currency | string | The currency of the transaction |
ibCode | string | Transaction contract code, used when placing an order. Such as: CL |
contractCode | string | Contract code, for example, CL1901 |
contractMonth | string | contract delivery month |
lastTradingDate | string | refers to the last trading date of the contract expiration month. Futures contracts that have not been cleared after the last trading day must be closed through the relevant "spot commodity" or "cash settlement". At present, the last trading day of most futures commodities is usually settlement day. For some commodities, the first notification day is the same day as the last trading day, such as the euro For cash-settled futures, as long as the last trading time has not passed, positions can be opened normally. Non-cash-settled futures are based on The lesser of the last trading time and the first notice day, limit the opening of positions in the first three trading days |
firstNoticeDate | string | The first notice date refers to the date when the physical delivery contract can be delivered. The contract cannot open long positions after the first notice date. Existing long positions will be forced to close before the first notice day (usually the first three trading days). This field is empty for non-physical delivery contracts (such as index contracts) |
lastBiddingCloseTime | long | Bidding closing time |
multiplier | double | contract multiplier, the futures price multiplied by the contract multiplier is the face value of the contract, and the reasonable price of the futures can be estimated by dividing the physical price by the contract multiplier |
exchange | string | exchange symbol |
minTick | double | The minimum quotation unit for futures price changes. For example, if the current futures price is 2000 and minTick is 100, the correct quotation includes 2100, 2200, and 2005 does not meet the requirements |
Example
FutureContractResponse cl = client.execute(FutureContinuousContractRequest.newRequest("CL"));
System.out.println(cl.getFutureContractItem());
Example Response
FutureContractItem{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 the current contract of the specified symbol
Corresponding request class: FutureCurrentContractRequest
Description
Query the current contract of the specified product, that is, the main chain of the contract
Parameter
parameter | type | required | description |
---|---|---|---|
type | string | yes | the trading variety corresponding to the futures contract, such as CL |
lang | string | no | Language parameter, which affects the "name" field in the return value, and the value range is: "zh_CN", "en_US" |
Response
FutureContractItem
object
The specific fields of the FutureContractItem
object are described as follows:
name | type | description |
---|---|---|
type | string | The trading variety corresponding to the futures contract, such as CL |
trade | boolean | whether it can be traded |
continuous | boolean | whether the contract is continuous |
name | string | The name of the contract, there are simplified and English names, returned according to the parameter lang |
currency | string | The currency of the transaction |
ibCode | string | Transaction contract code, used when placing an order. Such as: CL |
contractCode | string | Contract code, for example, CL1901 |
contractMonth | string | contract delivery month |
lastTradingDate | string | refers to the last trading date of the contract expiration month. Futures contracts that have not been cleared after the last trading day must be closed through the relevant "spot commodity" or "cash settlement". At present, the last trading day of most futures commodities is usually settlement day. For some commodities, the first notification day is the same day as the last trading day, such as the euro For cash-settled futures, as long as the last trading time has not passed, positions can be opened normally. Non-cash-settled futures are based on The lesser of the last trading time and the first notice day, limit the opening of positions in the first three trading days |
firstNoticeDate | string | The first notice date refers to the date when the physical delivery contract can be delivered. The contract cannot open long positions after the first notice date. Existing long positions will be forced to close before the first notice day (usually the first three trading days). This field is empty for non-physical delivery contracts (such as index contracts) |
lastBiddingCloseTime | long | Bidding closing time |
multiplier | double | contract multiplier, the futures price multiplied by the contract multiplier is the face value of the contract, and the reasonable price of the futures can be estimated by dividing the physical price by the contract multiplier |
exchange | string | exchange symbol |
minTick | double | The minimum quotation unit for futures price changes. For example, if the current futures price is 2000 and minTick is 100, the correct quotation includes 2100, 2200, and 2005 does not meet the requirements |
Example
FutureContractResponse response = client.execute(FutureCurrentContractRequest.newRequest("CL"));
System.out.println(response.getFutureContractItem());
Response example
FutureContractItem{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 the trading time of the specified futures contract
Corresponding request class: FutureTradingDateRequest
Parameter
parameter | type | required | description |
---|---|---|---|
contractCode | string | yes | futures contract code, such as CL1901 |
tradingDate | long | yes | time stamp of trading day |
Response
FutureTradingDateItem
object
The specific fields of FutureTradingDateItem
are described as follows:
name | type | description |
---|---|---|
tradingTimes | array | trading time |
biddingTimes | array | bidding time |
timeSection | string | The transaction time zone |
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' }
Get futures K-line data
Corresponding request class: FutureKlineRequest
Description
It provides daily K-line data of popular contracts in the past 10 years, as well as minute-level data of all contracts from August 2017 to the present.
The returned result is a collection of data in reverse chronological order starting from endTime.
For the 1-minute K-line, if there is no transaction within this 1 minute, the K-line data of this minute will be blank; the interface can only pull the K-line data of this 1 minute after there is a transaction within the latest minute. The first transaction is generated at 50 seconds, and the latest data cannot be pulled before 50 seconds.
Parameter
parameter | type | required | description |
---|---|---|---|
contractCodes | array | yes | Contract code list, support to query the main contract, such as CL1901/CLmain |
period | string | yes | K line period, value range: "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 query token (only supports a single contract, specified endTime query), other query conditions cannot be changed when using pageToken to pull data by paging |
Response
List of FutureKlineBatchItem
objects
The specific fields of FutureKlineBatchItem
are described as follows:
| Field | Type | Description | | ------------- | ------ | ---------------------------- ----------------------------------- | | contractCode | string | contract code | | nextPageToken | string | Query the token of the next page (only supports a single contract code, it is valid only when endTime is not null and -1), and returns null if there is no more data | | items | array | K-line array, please refer to the description below for the fields |
Among them, the attributes of K-line data items are as follows:
name | type | description |
---|---|---|
lastTime | long | The transaction time of the latest price |
volume | long | |
openInterest | no | amount of 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 if no settlement price is 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);
}
Futures real-time market
Corresponding request class: FutureRealTimeQuoteRequest
Description
Get real-time futures quotes
Parameter
parameter | type | required | description |
---|---|---|---|
contractCodes | array | yes | Contract code list, support to query the main contract, such as CL1901/CLmain |
Response
List of FutureRealTimeItem
objects
The specific fields of FutureRealTimeItem
are described as follows:
name | type | description |
---|---|---|
contractCode | string | contract code |
latestPrice | double | latest transaction price |
latestSize | double | the volume of the latest price |
latestTime | long | The transaction time of the latest price |
bidPrice | double | bid price (first file) |
bidSize | long | Bid size (one level) |
askPrice | double | ask price (one file) |
askSize | long | Amount of sell orders (one file) |
volume | long | Cumulative number of lots traded on the day |
openInterest | no | amount of open interest |
open | double | opening price |
high | double | highest price |
low | double | lowest price |
settlement | double | settlement price, returns 0 if no settlement price is generated |
limitUp | double | limit up price |
limitDown | double | 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,
"settlement": 49.88,
"high": 49.59,
"low": 49.14,
"latestTime": 1545102035000,
"open": 49.16,
"limitUp": 55.88,
"limitDown": 43.88
}]
}
Get futures tick-by-tick data
Corresponding request class: FutureTickRequest
Description
Obtain futures transaction data one by one, and the index recorded one by one starts from subscript 0 every day.
Parameter
parameter | type | required | description |
---|---|---|---|
contractCode | string | yes | futures contract code, such as: CL1901 |
beginIndex | long | yes | Starting index, beginIndex and endIndex can be set to -1 when the first request is made, the first request will return the latest item-by-item data, subsequent upload the latest index value +1 returned last time |
endIndex | long | yes | End index, If the difference between the end index and the start index is greater than 1000, it will return a maximum of 1000. When either the end index or the start index is set to -1, the query will be started from the end other than -1, and limit items of item-by-item data will be returned. |
limit | Int | no | The default is 200, the maximum limit is 1000 |
begin_index and end_index parameter usage instructions
| Query method | beginIndex | endIndex | Description | | -------------------- | ---------- | -------- | -------- -------------------------------------------------- -- | | Check records one by one from front to back | Specific value | -1 | For example: beginIndex=10, endIndex=-1, limit=20, return 20 records from 10 to 29. | | Query record by record from back to front | -1 | Specific value | For example: beginIndex=-1, endIndex=29, limit=20, return 20 records from 10 to 29. | | Query the latest record by record | -1 | -1 | Return the latest record by limit. | | Query interval index | specific value | specific value | For example: beginIndex=10, endIndex=100, 91 records including 10 to 100 will be returned. If limit is set to 20, 20 records from 10 to 29 will be returned. |
Response
FutureTickBatchItem
object
The specific fields of FutureTickBatchItem
are described as follows:
name | type | description |
---|---|---|
contractCode | string | contract code |
index | integer | index |
price | double | transaction price |
volume | long | 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 main's historical contract codes
Description
Get futures main's historical contract codes
Argument
Argument | Type | Required | Description |
---|---|---|---|
contractCodes | list | yes | futures code list |
begin_time | long | yes | Begin time(exclude), millisecond timestamp |
end_time | long | yes | End time(include), millisecond timestamp |
ResponseFutureHistoryMainContractItem
object list
Structured as below:
Name | Type | Description |
---|---|---|
contractCode | string | futures main contract code |
mainReferItems | List<FutureHistoryContractItem> | a list that contains FutureHistoryContractItem. FutureHistoryContractItem is an array that contains historical futures contract code. Data included are listed as below |
FutureHistoryContractItem object has the following attributes:
Name | Type | Description |
---|---|---|
time | long | timestamp |
referContractCode | string | futures main's historical contract code |
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
}