期货

大约 19 分钟

获取期货交易所列表

对应的请求类:FutureExchangeRequest

参数

参数类型是否必填描述
secTypestringyes合约类型。"FUT": 期货, "FOP": 期货期权(暂未提供期货期权的行情)
langstringno语言参数,对返回值中的"name"字段有影响,取值范围为:"zh_CN", "en_US"

返回

FutureExchangeItem 对象列表

FutureExchangeItem 对象具体字段说明如下:

名称类型说明
codestring交易所代码
namestring交易所名称
zoneIdstring交易时区

示例

FutureExchangeResponse response = client.execute(FutureExchangeRequest.newRequest(SecType.FUT.name()));
System.out.println(response.getFutureExchangeItems());

返回示例

[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'}]

根据合约代码查询期货合约

对应的请求类:FutureContractByConCodeRequest

遇到第一通知日、最后交易日如何处理:不管是进入第一通知日还是最后结算日后,主要交易月份都会转移到次月合约,使得将到期月份的流动性变差,因此建议不管是多单还是空单,在第一通知日前与最后交易日临近前,转仓或交易次月合约。

参数

参数类型是否必填描述
contractCodestringyes合约的symbol,如 CN1901
langstringno语言参数,对返回值中的"name"字段有影响,取值范围为:"zh_CN", "en_US"

返回

FutureContractItem 对象

FutureContractItem 对象具体字段说明如下:

名称类型说明
typestring期货合约对应的交易品种, 如 CL
tradeboolean是否可交易
continuousboolean是否连续合约
namestring合约的名字,有简体和英文名,根据参数lang来返回
currencystring交易的货币
ibCodestring交易合约代码,下单时使用。如:CL
contractCodestring合约代码,如,CL1901
contractMonthstring合约的交割月份
lastTradingDatestring指合约到期月份最后交易的日期,最后交易日后尚未清算的期货合约,须通过相关『现货商品』或『现金结算』方式平仓,目前大部分期货商品最后交易日通常就是结算日。有些商品第一通知日跟最后交易日是同一天,如欧元
对于现金交割的期货只要没过最后交易时间都可以正常开仓,非现金交割的期货是按照最后交易时间和第一通知日其中较小者,在其前三个交易日开始就限制开仓
firstNoticeDatestring第一通知日,指实物交割合约可以进行实物交割的日期,合约在第一通知日后无法开多仓。已有的多仓会在第一通知日之前(通常为前三个交易日)会被强制平仓。非实物交割合约(如指数合约)该字段为空
lastBiddingCloseTimelong竞价截止时间
multiplierdouble合约乘数,期货价格乘以合约乘数后,才是合约的面值,可以根据实物价格除上合约乘数,估算期货的合理价格
exchangestring交易所代码
minTickdouble期货价格变动的最小报价单位,比如当前期货价格为 2000,minTick为100,则正确的报价包括 2100,2200,而 2005不满足要求

示例

FutureContractResponse response = client.execute(FutureContractByConCodeRequest.newRequest("CN2203"));
System.out.println(response.getFutureContractItem());

响应示例

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}

获取交易所下的可交易合约

对应的请求类:FutureContractByExchCodeRequest

参数

参数类型是否必填描述
exchangeCodestringyes交易所代码
langstringno语言参数,对返回值中的"name"字段有影响,取值范围为:"zh_CN", "en_US"

返回

FutureContractItem 对象列表

FutureContractItem 对象具体字段说明如下:

名称类型说明
typestring期货合约对应的交易品种, 如 CL
tradeboolean是否可交易
continuousboolean是否连续合约
namestring合约的名字,有简体和英文名,根据参数lang来返回
currencystring交易的货币
ibCodestring交易合约代码,下单时使用。如:CL
contractCodestring合约代码,如, CL1901
contractMonthstring合约的交割月份
lastTradingDatestring指合约到期月份最后交易的日期,最后交易日后尚未清算的期货合约,须通过相关『现货商品』或『现金结算』方式平仓,目前大部分期货商品最后交易日通常就是结算日。有些商品第一通知日跟最后交易日是同一天,如欧元
对于现金交割的期货只要没过最后交易时间都可以正常开仓,非现金交割的期货是按照最后交易时间和第一通知日其中较小者,在其前三个交易日开始就限制开仓
firstNoticeDatestring第一通知日,指实物交割合约可以进行实物交割的日期,合约在第一通知日后无法开多仓。已有的多仓会在第一通知日之前(通常为前三个交易日)会被强制平仓。非实物交割合约(如指数合约)该字段为空
lastBiddingCloseTimelong竞价截止时间
multiplierdouble合约乘数,期货价格乘以合约乘数后,才是合约的面值,可以根据实物价格除上合约乘数,估算期货的合理价格
exchangestring交易所代码
minTickdouble期货价格变动的最小报价单位,比如当前期货价格为 2000,minTick为100,则正确的报价包括 2100,2200,而 2005不满足要求

请求示例:

FutureBatchContractResponse response = client.execute(FutureContractByExchCodeRequest.newRequest("CME"));
System.out.println(response.getFutureContractItems());

响应示例:

[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}
]

查询指定品种的全部合约

对应的请求类:FutureContractsRequest

参数

参数类型是否必填描述
typestringyes期货合约对应的交易品种, 如 CL
langstringyes语言参数,对返回值中的"name"字段有影响,取值范围为:"zh_CN", "en_US"

返回

FutureContractItem 对象列表

FutureContractItem 对象具体字段说明如下:

名称类型说明
typestring期货合约对应的交易品种, 如 CL
tradeboolean是否可交易
continuousboolean是否连续合约
namestring合约的名字,有简体和英文名,根据参数lang来返回
currencystring交易的货币
ibCodestring交易合约代码,下单时使用。如:CL
contractCodestring合约代码,如, CL1901
contractMonthstring合约的交割月份
lastTradingDatestring指合约到期月份最后交易的日期,最后交易日后尚未清算的期货合约,须通过相关『现货商品』或『现金结算』方式平仓,目前大部分期货商品最后交易日通常就是结算日。有些商品第一通知日跟最后交易日是同一天,如欧元
对于现金交割的期货只要没过最后交易时间都可以正常开仓,非现金交割的期货是按照最后交易时间和第一通知日其中较小者,在其前三个交易日开始就限制开仓
firstNoticeDatestring第一通知日,指实物交割合约可以进行实物交割的日期,合约在第一通知日后无法开多仓。已有的多仓会在第一通知日之前(通常为前三个交易日)会被强制平仓。非实物交割合约(如指数合约)该字段为空
lastBiddingCloseTimelong竞价截止时间
multiplierdouble合约乘数,期货价格乘以合约乘数后,才是合约的面值,可以根据实物价格除上合约乘数,估算期货的合理价格
exchangestring交易所代码
minTickdouble期货价格变动的最小报价单位,比如当前期货价格为 2000,minTick为100,则正确的报价包括 2100,2200,而 2005不满足要求

请求示例:

    FutureContractsResponse contractResponse = client.execute(FutureContractsRequest.newRequest("CN"));
    System.out.println(contractResponse.getFutureContractItems());

响应示例:

[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}]

查询指定品种的连续合约

对应的请求类:FutureContinuousContractRequest

参数

参数类型是否必填描述
typestringyes期货合约对应的交易品种, 如 CL
langstringyes语言参数,对返回值中的"name"字段有影响,取值范围为:"zh_CN", "en_US"

返回

FutureContractItem 对象

FutureContractItem 对象具体字段说明如下:

名称类型说明
typestring期货合约对应的交易品种, 如 CL
tradeboolean是否可交易
continuousboolean是否连续合约
namestring合约的名字,有简体和英文名,根据参数lang来返回
currencystring交易的货币
ibCodestring交易合约代码,下单时使用。如:CL
contractCodestring合约代码,如, CL1901
contractMonthstring合约的交割月份
lastTradingDatestring指合约到期月份最后交易的日期,最后交易日后尚未清算的期货合约,须通过相关『现货商品』或『现金结算』方式平仓,目前大部分期货商品最后交易日通常就是结算日。有些商品第一通知日跟最后交易日是同一天,如欧元
对于现金交割的期货只要没过最后交易时间都可以正常开仓,非现金交割的期货是按照最后交易时间和第一通知日其中较小者,在其前三个交易日开始就限制开仓
firstNoticeDatestring第一通知日,指实物交割合约可以进行实物交割的日期,合约在第一通知日后无法开多仓。已有的多仓会在第一通知日之前(通常为前三个交易日)会被强制平仓。非实物交割合约(如指数合约)该字段为空
lastBiddingCloseTimelong竞价截止时间
multiplierdouble合约乘数,期货价格乘以合约乘数后,才是合约的面值,可以根据实物价格除上合约乘数,估算期货的合理价格
exchangestring交易所代码
minTickdouble期货价格变动的最小报价单位,比如当前期货价格为 2000,minTick为100,则正确的报价包括 2100,2200,而 2005不满足要求

请求示例:

FutureContractResponse cl = client.execute(FutureContinuousContractRequest.newRequest("CL"));
System.out.println(cl.getFutureContractItem());

响应示例:

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}

查询指定品种的当前合约

对应的请求类:FutureCurrentContractRequest

说明

查询指定品种的当前合约,即合约主连

输入参数:

参数类型是否必填描述
typestringyes期货合约对应的交易品种, 如 CL
langstringno语言参数,对返回值中的"name"字段有影响,取值范围为:"zh_CN", "en_US"

返回

FutureContractItem 对象

FutureContractItem 对象具体字段说明如下:

名称类型说明
typestring期货合约对应的交易品种, 如 CL
tradeboolean是否可交易
continuousboolean是否连续合约
namestring合约的名字,有简体和英文名,根据参数lang来返回
currencystring交易的货币
ibCodestring交易合约代码,下单时使用。如:CL
contractCodestring合约代码,如, CL1901
contractMonthstring合约的交割月份
lastTradingDatestring指合约到期月份最后交易的日期,最后交易日后尚未清算的期货合约,须通过相关『现货商品』或『现金结算』方式平仓,目前大部分期货商品最后交易日通常就是结算日。有些商品第一通知日跟最后交易日是同一天,如欧元
对于现金交割的期货只要没过最后交易时间都可以正常开仓,非现金交割的期货是按照最后交易时间和第一通知日其中较小者,在其前三个交易日开始就限制开仓
firstNoticeDatestring第一通知日,指实物交割合约可以进行实物交割的日期,合约在第一通知日后无法开多仓。已有的多仓会在第一通知日之前(通常为前三个交易日)会被强制平仓。非实物交割合约(如指数合约)该字段为空
lastBiddingCloseTimelong竞价截止时间
multiplierdouble合约乘数,期货价格乘以合约乘数后,才是合约的面值,可以根据实物价格除上合约乘数,估算期货的合理价格
exchangestring交易所代码
minTickdouble期货价格变动的最小报价单位,比如当前期货价格为 2000,minTick为100,则正确的报价包括 2100,2200,而 2005不满足要求

请求示例

FutureContractResponse response = client.execute(FutureCurrentContractRequest.newRequest("CL"));
System.out.println(response.getFutureContractItem());

返回示例

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}

查询指定期货合约的交易时间

对应的请求类:FutureTradingDateRequest

参数

参数类型是否必填描述
contractCodestringyes期货合约代码,如CL1901
tradingDatelongyes交易日时间戳

返回

FutureTradingDateItem 对象

FutureTradingDateItem 具体字段说明如下:

名称类型说明
tradingTimesarray交易时间
biddingTimesarray竞价时间
timeSectionstring所在交易时区

请求示例

FutureTradingDateResponse response = client.execute(FutureTradingDateRequest.newRequest("ES2203", System.currentTimeMillis()));
System.out.println(response.getFutureTradingDateItem());

响应示例

FutureTradingDateItem{biddingTimes=[TimeSection{start=1644873300000, end=1644874200000}], tradingTimes=[TimeSection{start=1644793200000, end=1644873300000}, TimeSection{start=1644874200000, end=1644876000000}], timeSection='America/Chicago'}

获取期货K线数据

对应的请求类:FutureKlineRequest

说明

提供了热门合约近10年的日级别K线数据,以及全部合约2017年8月至今的分钟级数据。

返回结果是从endTime开始按时间倒序的数据集合。

对于1分钟K线,如果在这1分钟内没有成交,这一分钟K线数据会空缺;在最近的这一分钟内有成交后接口才能拉取到这1分钟的K线数据,如果在第50秒时产生第一笔交易,在50秒之前拉取不到最新点的数据。

参数

参数类型是否必填描述
contractCodesarrayyes合约代码列表,支持查询主连合约,如,CL1901/CLmain
periodstringyesK线周期,取值范围:"min", "3min", "5min", "10min","15min", "30min", "45min", "60min","2hour", "3hour", "4hour", "6hour","day", "week", "month"
beginTimelongyes开始时间(包含)
endTimelongyes结束时间(不包含)
limitintno请求条数限制,默认200,最大限制:1000
pageTokenstringno分页查询token(只支持单个合约,指定endTime的查询),使用pageToken分页拉取数据时其他查询条件不能改变

返回

FutureKlineBatchItem 对象列表

FutureKlineBatchItem具体字段说明如下:

字段类型说明
contractCodestring合约代码
nextPageTokenstring查询下一页的token(只支持单个合约代码,endTime不为null和-1时才有效),如果没有更多数据返回null
itemsarrayK线数组,字段参考下面说明

其中K线数据items属性如下:

名称类型说明
lastTimelong最新价的成交时间
volumelong成交手数
openInterestno未平仓合约数量
opendouble开盘价
closedouble收盘价
timelong时间
highdouble最高价
lowdouble最低价
settlementdouble结算价,在未生成结算价时返回0

示例

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());

返回示例

{
        "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示例

    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);
    }

期货实时行情

对应的请求类:FutureRealTimeQuoteRequest

说明

获取期货实时行情

参数

参数类型是否必填描述
contractCodesarrayyes合约代码列表,支持查询主连合约,如,CL1901/CLmain

返回

FutureRealTimeItem 对象列表

FutureRealTimeItem 具体字段说明如下:

名称类型说明
contractCodestring合约代码
latestPricedouble最新成交价格
latestSizedouble最新价的成交量
latestTimelong最新价的成交时间
bidPricedouble买盘价(一档)
bidSizelong买盘数量(一档)
askPricedouble卖盘价(一档)
askSizelong卖盘数量(一档)
volumelong当日累计成交手数
openInterestno未平仓合约数量
opendouble开盘价
highdouble最高价
lowdouble最低价
settlementdouble结算价,在未生成结算价时返回0
limitUpdouble涨停价
limitDowndouble跌停价

示例

List<String> contractCodes = new ArrayList<>();
contractCodes.add("CL1902");

FutureRealTimeQuoteResponse response = client.execute(FutureRealTimeQuoteRequest.newRequest(contractCodes));
System.out.println(response.getFutureRealTimeItems());

返回示例

{
    "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
    }]
}

获取期货逐笔数据

对应的请求类:FutureTickRequest

说明

获取期货逐笔成交数据,逐笔记录的index每天从下标0处开始。

参数

参数类型是否必填描述
contractCodestringyes期货合约代码,如:CL1901
beginIndexlongyes起始索引,首次请求时beginIndex和endIndex可以设置为-1,首次请求会返回最新的逐笔数据,后续可以传上次返回的最新索引值+1
endIndexlongyes结束索引,如果结束索引和起始索引的差值大于1000,会按照最大1000条返回。当结束索引或起始索引其中一个设置为-1时,会从非-1的一端开始查询,并返回limit条逐笔数据。
limitIntno默认为200,最大限制为1000条

begin_index 和 end_index参数使用说明

查询方式beginIndexendIndex描述
从前往后查逐笔记录具体数值-1举例:beginIndex=10,endIndex=-1,limit=20,返回从10到29的20条记录。
从后往前查询逐笔记录-1具体数值举例:beginIndex=-1,endIndex=29,limit=20,返回从10到29的20条记录。
查询最新逐笔记录-1-1返回limit条最新的逐笔记录。
查询区间索引具体数值具体数值举例:beginIndex=10, endIndex=100 ,会返回包含10到100的 91条记录。如果limit设置为20,则会返回10到29的20条记录。

返回

FutureTickBatchItem 对象

FutureTickBatchItem具体字段说明如下:

名称类型说明
contractCodestring合约代码
indexinteger索引
pricedouble成交价
volumelong成交量
timelong时间

示例

List<String> contractCodes = new ArrayList<>();
contractCodes.add("CL1902");

FutureTickResponse response = client.execute(FutureTickRequest.newRequest("CL2209", 10L, 100L,20));
System.out.println(response.getFutureTickItems());

返回示例

{
	"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
}

查询期货主连的历史合约

对应的请求类:FutureHistoryMainContractRequest

参数

参数类型是否必填描述
contractCodesarrayyes期货主合约代码列表,如ESmain
beginTimelongyes开始时间(不包含)
endTimelongyes结束时间(包含)

返回

FutureHistoryMainContractItem 对象

FutureHistoryMainContractItem 具体字段说明如下:

名称类型说明
contractCodestring期货主合约代码
mainReferItemsarray主合约的历史合约列表,FutureHistoryContractItem字段参考下面说明

其中历史合约数据mainReferItems属性如下:

名称类型说明
timelong日期时间戳
referContractCodestring主连合约对应的期货合约

请求示例

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());
}

响应示例

{
    "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
}
上次编辑于: