期货
获取期货交易所列表
对应的请求类:TigerRequest(QuoteApiService.FUTURE_EXCHANGE)
参数
参数 | 类型 | 是否必填 | 描述 |
---|---|---|---|
secType | string | yes | 合约类型。"FUT": 期货, "FOP": 期货期权(暂未提供期货期权的行情) |
lang | string | no | 语言参数,对返回值中的"name"字段有影响,取值范围为:"zh_CN", "en_US" |
返回TigerOpenAPI.Quote.Response.FutureExchangeResponse
source
结构如下:
namespace TigerOpenAPI.Quote.Response
{
public class FutureExchangeResponse : TigerResponse
{
[JsonProperty(PropertyName = "data")]
public List<FutureExchangeItem> Data { get; set; }
}
}
返回数据可通过FutureExchangeResponse.Data
属性访问,返回FutureExchangeItem
对象,其中TigerOpenAPI.Quote.Response.FutureExchangeItem
属性如下:
名称 | 类型 | 说明 |
---|---|---|
code | string | 交易所代码 |
name | string | 交易所名称 |
zoneId | string | 交易时区 |
示例
static async Task<FutureExchangeResponse?> GetFutureExchangeAsync(QuoteClient quoteClient)
{
TigerRequest<FutureExchangeResponse> request = new TigerRequest<FutureExchangeResponse>()
{
ApiMethodName = QuoteApiService.FUTURE_EXCHANGE,
ModelValue = new FutureExchangeModel()
{
SecType = SecType.FUT.ToString()
}
};
return await quoteClient.ExecuteAsync(request);
}
返回示例
{
"data":[
{
"code":"CME",
"name":"CME",
"zoneId":"America/Chicago"
},
{
"code":"NYMEX",
"name":"NYMEX",
"zoneId":"America/New_York"
},
{
"code":"COMEX",
"name":"COMEX",
"zoneId":"America/New_York"
},
{
"code":"SGX",
"name":"SGX",
"zoneId":"Singapore"
},
{
"code":"HKEX",
"name":"HKEX",
"zoneId":"Asia/Hong_Kong"
},
{
"code":"CBOT",
"name":"CBOT",
"zoneId":"America/Chicago"
},
{
"code":"OSE",
"name":"OSE",
"zoneId":"Asia/Tokyo"
},
{
"code":"CBOE",
"name":"CBOE",
"zoneId":"America/Chicago"
},
{
"code":"EUREX",
"name":"EUREX",
"zoneId":"Europe/Berlin"
}
],
"code":0,
"message":"success",
"timestamp":1678156845303,
"sign":"NiuhaSKScUMdI92rpblUtp0c2KdHRID/7iG47J5YVxG2TLXcJFc36xbDNZAhhrTKAa701KJwMuFHXT04oIGz+KS8fBPoYf8R1oj9wfxoPkJo5RqjbYSZwspSlRyx+QrDo303AxruoEBr23kpKMVxIulXDdD22wd2zIBlJMctXJ8="
}
根据合约代码查询期货合约
对应的请求类:TigerRequest(QuoteApiService.FUTURE_CONTRACT_BY_CONTRACT_CODE)
遇到第一通知日、最后交易日如何处理:不管是进入第一通知日还是最后结算日后,主要交易月份都会转移到次月合约,使得将到期月份的流动性变差,因此建议不管是多单还是空单,在第一通知日前与最后交易日临近前,转仓或交易次月合约。
参数
参数 | 类型 | 是否必填 | 描述 |
---|---|---|---|
contractCode | string | yes | 合约的symbol,如 CN1901 |
lang | string | no | 语言参数,对返回值中的"name"字段有影响,取值范围为:"zh_CN", "en_US" |
返回TigerOpenAPI.Quote.Response.FutureContractResponse
source
结构如下:
namespace TigerOpenAPI.Quote.Response
{
public class FutureContractResponse : TigerResponse
{
[JsonProperty(PropertyName = "data")]
public FutureContractItem Data { get; set; }
}
}
返回数据可通过FutureContractResponse.Data
属性访问,返回FutureContractItem
对象,其中TigerOpenAPI.Quote.Response.FutureContractItem
属性如下:
名称 | 类型 | 说明 |
---|---|---|
type | string | 期货合约对应的交易品种, 如 CL |
trade | boolean | 是否可交易 |
continuous | boolean | 是否连续合约 |
name | string | 合约的名字,有简体和英文名,根据参数lang来返回 |
currency | string | 交易的货币 |
ibCode | string | 交易合约代码,下单时使用。如:CL |
contractCode | string | 合约代码,如,CL1901 |
contractMonth | string | 合约的交割月份 |
lastTradingDate | string | 指合约到期月份最后交易的日期,最后交易日后尚未清算的期货合约,须通过相关『现货商品』或『现金结算』方式平仓,目前大部分期货商品最后交易日通常就是结算日。有些商品第一通知日跟最后交易日是同一天,如欧元 对于现金交割的期货只要没过最后交易时间都可以正常开仓,非现金交割的期货是按照最后交易时间和第一通知日其中较小者,在其前三个交易日开始就限制开仓 |
firstNoticeDate | string | 第一通知日,指实物交割合约可以进行实物交割的日期,合约在第一通知日后无法开多仓。已有的多仓会在第一通知日之前(通常为前三个交易日)会被强制平仓。非实物交割合约(如指数合约)该字段为空 |
lastBiddingCloseTime | long | 竞价截止时间 |
multiplier | double | 合约乘数,期货价格乘以合约乘数后,才是合约的面值,可以根据实物价格除上合约乘数,估算期货的合理价格 |
exchange | string | 交易所代码 |
minTick | double | 期货价格变动的最小报价单位,比如当前期货价格为 2000,minTick为100,则正确的报价包括 2100,2200,而 2005不满足要求 |
示例
static async Task<FutureContractResponse?> GetFutureContractByContractCodeAsync(QuoteClient quoteClient)
{
TigerRequest<FutureContractResponse> request = new TigerRequest<FutureContractResponse>()
{
ApiMethodName = QuoteApiService.FUTURE_CONTRACT_BY_CONTRACT_CODE,
ModelValue = new FutureContractByConCodeModel() { ContractCode = "ES2306" }
};
return await quoteClient.ExecuteAsync(request);
}
响应示例
{
"data":{
"type":"ES",
"name":"E-mini S&P 500 - Jun 2023",
"ibCode":"ES",
"contractCode":"ES2306",
"contractMonth":"202306",
"exchangeCode":"GLOBEX",
"exchange":"CME",
"multiplier":50,
"minTick":0.25,
"lastTradingDate":"20230616",
"firstNoticeDate":"",
"lastBiddingCloseTime":0,
"currency":"USD",
"continuous":false,
"trade":true
},
"code":0,
"message":"success",
"timestamp":1678159174420,
"sign":"o8+JTngP120oV1XxeLxs3/KdE5/DD9rL6Yv3wOfqXspCWBijQZvQe/ZVlKnSN3w/e5MvtckyrqJ3vY/HSWdEndfEqMOoUvRRW8pFeAts6h3nFTyq53zwNi170hdlJqwGvYs5C94I0T2KHZ+bcBMpgWfRfQiJs8kCXuInRfkjOEo="
}
获取交易所下的可交易合约
对应的请求类:TigerRequest(QuoteApiService.FUTURE_CONTRACT_BY_EXCHANGE_CODE)
参数
参数 | 类型 | 是否必填 | 描述 |
---|---|---|---|
exchangeCode | string | yes | 交易所代码 |
lang | string | no | 语言参数,对返回值中的"name"字段有影响,取值范围为:"zh_CN", "en_US" |
返回TigerOpenAPI.Quote.Response.FutureContractsResponse
source
结构如下:
namespace TigerOpenAPI.Quote.Response
{
public class FutureContractsResponse : TigerResponse
{
[JsonProperty(PropertyName = "data")]
public List<FutureContractItem> Data { get; set; }
}
}
返回数据可通过FutureContractsResponse.Data
属性访问,返回FutureContractItem
对象,其中TigerOpenAPI.Quote.Response.FutureContractItem
属性如下:
名称 | 类型 | 说明 |
---|---|---|
type | string | 期货合约对应的交易品种, 如 CL |
trade | boolean | 是否可交易 |
continuous | boolean | 是否连续合约 |
name | string | 合约的名字,有简体和英文名,根据参数lang来返回 |
currency | string | 交易的货币 |
ibCode | string | 交易合约代码,下单时使用。如:CL |
contractCode | string | 合约代码,如, CL1901 |
contractMonth | string | 合约的交割月份 |
lastTradingDate | string | 指合约到期月份最后交易的日期,最后交易日后尚未清算的期货合约,须通过相关『现货商品』或『现金结算』方式平仓,目前大部分期货商品最后交易日通常就是结算日。有些商品第一通知日跟最后交易日是同一天,如欧元 对于现金交割的期货只要没过最后交易时间都可以正常开仓,非现金交割的期货是按照最后交易时间和第一通知日其中较小者,在其前三个交易日开始就限制开仓 |
firstNoticeDate | string | 第一通知日,指实物交割合约可以进行实物交割的日期,合约在第一通知日后无法开多仓。已有的多仓会在第一通知日之前(通常为前三个交易日)会被强制平仓。非实物交割合约(如指数合约)该字段为空 |
lastBiddingCloseTime | long | 竞价截止时间 |
multiplier | double | 合约乘数,期货价格乘以合约乘数后,才是合约的面值,可以根据实物价格除上合约乘数,估算期货的合理价格 |
exchange | string | 交易所代码 |
minTick | double | 期货价格变动的最小报价单位,比如当前期货价格为 2000,minTick为100,则正确的报价包括 2100,2200,而 2005不满足要求 |
请求示例:
static async Task<FutureContractsResponse?> GetFutureContractByExchangeCodeAsync(QuoteClient quoteClient)
{
TigerRequest<FutureContractsResponse> request = new TigerRequest<FutureContractsResponse>()
{
ApiMethodName = QuoteApiService.FUTURE_CONTRACT_BY_EXCHANGE_CODE,
ModelValue = new FutureContractByExchCodeModel() { ExchangeCode = "CME" }
};
return await quoteClient.ExecuteAsync(request);
}
响应示例:
{"data":[{"type":"MEUR","name":"E-Micro EUR/USD - main","ibCode":"M6E","contractCode":"MEURmain","contractMonth":"","exchangeCode":"GLOBEX","exchange":"CME","multiplier":12500.0,"minTick":0.0001,"lastTradingDate":"","firstNoticeDate":"","lastBiddingCloseTime":0,"currency":"USD","continuous":false,"trade":true},{"type":"MEUR","name":"E-Micro EUR/USD - Jun 2023","ibCode":"M6E","contractCode":"MEUR2306","contractMonth":"202306","exchangeCode":"GLOBEX","exchange":"CME","multiplier":12500.0,"minTick":0.0001,"lastTradingDate":"20230616","firstNoticeDate":"","lastBiddingCloseTime":0,"currency":"USD","continuous":false,"trade":true},{"type":"MEUR","name":"E-Micro EUR/USD - Mar 2023","ibCode":"M6E","contractCode":"MEUR2303","contractMonth":"202303","exchangeCode":"GLOBEX","exchange":"CME","multiplier":12500.0,"minTick":0.0001,"lastTradingDate":"20230313","firstNoticeDate":"","lastBiddingCloseTime":0,"currency":"USD","continuous":false,"trade":true},{"type":"NKD","name":"CME Nikkei/USD - Mar 2023","ibCode":"NKD","contractCode":"NKD2303","contractMonth":"202303","exchangeCode":"GLOBEX","exchange":"CME","multiplier":5.0,"minTick":5.0,"lastTradingDate":"20230309","firstNoticeDate":"","lastBiddingCloseTime":0,"currency":"USD","continuous":false,"trade":true}],"code":0,"message":"success","timestamp":1678169849775,"sign":"jE5c+XGvEUVOKBjiCmzM0zjlzsM7ASSvljfcKbJNom0+E0ivv8oenowoauJu0wHo45bjrX6sv7tWDEJInOKUYGpi4y69YivgNRsHvVKqS1qu14km/eqUYsrbvBO04xw9ttLqbtJqSYUF7gIi6By6f1bDTsoGdNMoS/ase5NxgoA="}
查询指定品种的全部合约
对应的请求类:TigerRequest(QuoteApiService.FUTURE_CONTRACTS)
参数
参数 | 类型 | 是否必填 | 描述 |
---|---|---|---|
type | string | yes | 期货合约对应的交易品种, 如 CL |
lang | string | yes | 语言参数,对返回值中的"name"字段有影响,取值范围为:"zh_CN", "en_US" |
返回TigerOpenAPI.Quote.Response.FutureContractsResponse
source
结构如下:
namespace TigerOpenAPI.Quote.Response
{
public class FutureContractsResponse : TigerResponse
{
[JsonProperty(PropertyName = "data")]
public List<FutureContractItem> Data { get; set; }
}
}
返回数据可通过FutureContractsResponse.Data
属性访问,返回FutureContractItem
对象列表,其中TigerOpenAPI.Quote.Response.FutureContractItem
属性如下:
名称 | 类型 | 说明 |
---|---|---|
type | string | 期货合约对应的交易品种, 如 CL |
trade | boolean | 是否可交易 |
continuous | boolean | 是否连续合约 |
name | string | 合约的名字,有简体和英文名,根据参数lang来返回 |
currency | string | 交易的货币 |
ibCode | string | 交易合约代码,下单时使用。如:CL |
contractCode | string | 合约代码,如, CL1901 |
contractMonth | string | 合约的交割月份 |
lastTradingDate | string | 指合约到期月份最后交易的日期,最后交易日后尚未清算的期货合约,须通过相关『现货商品』或『现金结算』方式平仓,目前大部分期货商品最后交易日通常就是结算日。有些商品第一通知日跟最后交易日是同一天,如欧元 对于现金交割的期货只要没过最后交易时间都可以正常开仓,非现金交割的期货是按照最后交易时间和第一通知日其中较小者,在其前三个交易日开始就限制开仓 |
firstNoticeDate | string | 第一通知日,指实物交割合约可以进行实物交割的日期,合约在第一通知日后无法开多仓。已有的多仓会在第一通知日之前(通常为前三个交易日)会被强制平仓。非实物交割合约(如指数合约)该字段为空 |
lastBiddingCloseTime | long | 竞价截止时间 |
multiplier | decimal | 合约乘数,期货价格乘以合约乘数后,才是合约的面值,可以根据实物价格除上合约乘数,估算期货的合理价格 |
exchange | string | 交易所代码 |
minTick | decimal | 期货价格变动的最小报价单位,比如当前期货价格为 2000,minTick为100,则正确的报价包括 2100,2200,而 2005不满足要求 |
请求示例:
static async Task<FutureContractsResponse?> GetFutureContractsAsync(QuoteClient quoteClient)
{
TigerRequest<FutureContractsResponse> request = new TigerRequest<FutureContractsResponse>()
{
ApiMethodName = QuoteApiService.FUTURE_CONTRACTS,
ModelValue = new FutureContractByTypeModel() { FutureType = "CL" }
};
return await quoteClient.ExecuteAsync(request);
}
响应示例:
{
"data":[
{
"type":"CL",
"name":"WTI Crude Oil - Apr 2023",
"ibCode":"CL",
"contractCode":"CL2304",
"contractMonth":"202304",
"exchangeCode":"NYMEX",
"exchange":"NYMEX",
"multiplier":1000,
"minTick":0.01,
"lastTradingDate":"20230321",
"firstNoticeDate":"20230323",
"lastBiddingCloseTime":0,
"currency":"USD",
"continuous":false,
"trade":true
},
{
"type":"CL",
"name":"WTI Crude Oil - May 2023",
"ibCode":"CL",
"contractCode":"CL2305",
"contractMonth":"202305",
"exchangeCode":"NYMEX",
"exchange":"NYMEX",
"multiplier":1000,
"minTick":0.01,
"lastTradingDate":"20230420",
"firstNoticeDate":"20230424",
"lastBiddingCloseTime":0,
"currency":"USD",
"continuous":false,
"trade":true
},
{
"type":"CL",
"name":"WTI Crude Oil - Jun 2023",
"ibCode":"CL",
"contractCode":"CL2306",
"contractMonth":"202306",
"exchangeCode":"NYMEX",
"exchange":"NYMEX",
"multiplier":1000,
"minTick":0.01,
"lastTradingDate":"20230522",
"firstNoticeDate":"20230524",
"lastBiddingCloseTime":0,
"currency":"USD",
"continuous":false,
"trade":true
},
{
"type":"CL",
"name":"WTI Crude Oil - Jul 2023",
"ibCode":"CL",
"contractCode":"CL2307",
"contractMonth":"202307",
"exchangeCode":"NYMEX",
"exchange":"NYMEX",
"multiplier":1000,
"minTick":0.01,
"lastTradingDate":"20230620",
"firstNoticeDate":"20230622",
"lastBiddingCloseTime":0,
"currency":"USD",
"continuous":false,
"trade":true
},
{
"type":"CL",
"name":"WTI Crude Oil - Aug 2023",
"ibCode":"CL",
"contractCode":"CL2308",
"contractMonth":"202308",
"exchangeCode":"NYMEX",
"exchange":"NYMEX",
"multiplier":1000,
"minTick":0.01,
"lastTradingDate":"20230720",
"firstNoticeDate":"20230724",
"lastBiddingCloseTime":0,
"currency":"USD",
"continuous":false,
"trade":true
}
],
"code":0,
"message":"success",
"timestamp":1678171088223,
"sign":"Ml3F875Gt3mrcWt+imu0ykdelwBqt8I1USav3CJtcb/HbRUENJKC09iSgMwMB8AIh+7acT+WsmKNXdR2lR3fYH79L4Er3h6JZKxE2CyOtfqqcqGaBWgZo142RyfpI9gzpJejTGus1rTGk5BMtl6a+zLdMfut9fBoy10BTFaZHI8="
}
查询指定品种的连续合约
对应的请求类:TigerRequest(QuoteApiService.FUTURE_CONTINUOUS_CONTRACTS)
参数
参数 | 类型 | 是否必填 | 描述 |
---|---|---|---|
type | string | yes | 期货合约对应的交易品种, 如 CL |
lang | string | yes | 语言参数,对返回值中的"name"字段有影响,取值范围为:"zh_CN", "en_US" |
返回TigerOpenAPI.Quote.Response.FutureContractResponse
source
结构如下:
namespace TigerOpenAPI.Quote.Response
{
public class FutureContractResponse : TigerResponse
{
[JsonProperty(PropertyName = "data")]
public FutureContractItem Data { get; set; }
}
}
返回数据可通过FutureContractResponse.Data
属性访问,返回FutureContractItem
对象,其中TigerOpenAPI.Quote.Response.FutureContractItem
属性如下:
名称 | 类型 | 说明 |
---|---|---|
type | string | 期货合约对应的交易品种, 如 CL |
trade | boolean | 是否可交易 |
continuous | boolean | 是否连续合约 |
name | string | 合约的名字,有简体和英文名,根据参数lang来返回 |
currency | string | 交易的货币 |
ibCode | string | 交易合约代码,下单时使用。如:CL |
contractCode | string | 合约代码,如, CL1901 |
contractMonth | string | 合约的交割月份 |
lastTradingDate | string | 指合约到期月份最后交易的日期,最后交易日后尚未清算的期货合约,须通过相关『现货商品』或『现金结算』方式平仓,目前大部分期货商品最后交易日通常就是结算日。有些商品第一通知日跟最后交易日是同一天,如欧元 对于现金交割的期货只要没过最后交易时间都可以正常开仓,非现金交割的期货是按照最后交易时间和第一通知日其中较小者,在其前三个交易日开始就限制开仓 |
firstNoticeDate | string | 第一通知日,指实物交割合约可以进行实物交割的日期,合约在第一通知日后无法开多仓。已有的多仓会在第一通知日之前(通常为前三个交易日)会被强制平仓。非实物交割合约(如指数合约)该字段为空 |
lastBiddingCloseTime | long | 竞价截止时间 |
multiplier | double | 合约乘数,期货价格乘以合约乘数后,才是合约的面值,可以根据实物价格除上合约乘数,估算期货的合理价格 |
exchange | string | 交易所代码 |
minTick | double | 期货价格变动的最小报价单位,比如当前期货价格为 2000,minTick为100,则正确的报价包括 2100,2200,而 2005不满足要求 |
请求示例:
static async Task<FutureContractResponse?> GetFutureContinuousContractsAsync(QuoteClient quoteClient)
{
TigerRequest<FutureContractResponse> request = new TigerRequest<FutureContractResponse>()
{
ApiMethodName = QuoteApiService.FUTURE_CONTINUOUS_CONTRACTS,
ModelValue = new FutureContractByTypeModel() { FutureType = "ES" }
};
return await quoteClient.ExecuteAsync(request);
}
响应示例:
{
"data":{
"type":"ES",
"name":"E-mini S&P 500 - main",
"ibCode":"ES",
"contractCode":"ESmain",
"contractMonth":"",
"exchangeCode":"GLOBEX",
"exchange":"CME",
"multiplier":50,
"minTick":0.25,
"lastTradingDate":"",
"firstNoticeDate":"",
"lastBiddingCloseTime":0,
"currency":"USD",
"continuous":false,
"trade":true
},
"code":0,
"message":"success",
"timestamp":1678171811158,
"sign":"yAxfuGk0KFN2R344jiExbkJQo7FYzROFQhllfzHIwISWdYPiii0P3p8JmDEk2Ooswp396SdsQZv41r5+M4N0jiR8FCeRG3RkP4bWqt5kUriJANNzeNGd9ggu3Wzt9eGnzwJfIlFfZeojlgACYTRm1PzEdNQZB7rVDKxE1X5fmls="
}
查询指定品种的当前合约
对应的请求类:TigerRequest(QuoteApiService.FUTURE_CURRENT_CONTRACT)
说明
查询指定品种的当前合约,即合约主连
参数
参数 | 类型 | 是否必填 | 描述 |
---|---|---|---|
type | string | yes | 期货合约对应的交易品种, 如 CL |
lang | string | yes | 语言参数,对返回值中的"name"字段有影响,取值范围为:"zh_CN", "en_US" |
返回TigerOpenAPI.Quote.Response.FutureContractResponse
source
结构如下:
namespace TigerOpenAPI.Quote.Response
{
public class FutureContractResponse : TigerResponse
{
[JsonProperty(PropertyName = "data")]
public FutureContractItem Data { get; set; }
}
}
返回数据可通过FutureContractResponse.Data
属性访问,返回FutureContractItem
对象,其中TigerOpenAPI.Quote.Response.FutureContractItem
属性如下:
名称 | 类型 | 说明 |
---|---|---|
type | string | 期货合约对应的交易品种, 如 CL |
trade | boolean | 是否可交易 |
continuous | boolean | 是否连续合约 |
name | string | 合约的名字,有简体和英文名,根据参数lang来返回 |
currency | string | 交易的货币 |
ibCode | string | 交易合约代码,下单时使用。如:CL |
contractCode | string | 合约代码,如, CL1901 |
contractMonth | string | 合约的交割月份 |
lastTradingDate | string | 指合约到期月份最后交易的日期,最后交易日后尚未清算的期货合约,须通过相关『现货商品』或『现金结算』方式平仓,目前大部分期货商品最后交易日通常就是结算日。有些商品第一通知日跟最后交易日是同一天,如欧元 对于现金交割的期货只要没过最后交易时间都可以正常开仓,非现金交割的期货是按照最后交易时间和第一通知日其中较小者,在其前三个交易日开始就限制开仓 |
firstNoticeDate | string | 第一通知日,指实物交割合约可以进行实物交割的日期,合约在第一通知日后无法开多仓。已有的多仓会在第一通知日之前(通常为前三个交易日)会被强制平仓。非实物交割合约(如指数合约)该字段为空 |
lastBiddingCloseTime | long | 竞价截止时间 |
multiplier | double | 合约乘数,期货价格乘以合约乘数后,才是合约的面值,可以根据实物价格除上合约乘数,估算期货的合理价格 |
exchange | string | 交易所代码 |
minTick | double | 期货价格变动的最小报价单位,比如当前期货价格为 2000,minTick为100,则正确的报价包括 2100,2200,而 2005不满足要求 |
请求示例
static async Task<FutureContractResponse?> GetFutureCurrentContractAsync(QuoteClient quoteClient)
{
TigerRequest<FutureContractResponse> request = new TigerRequest<FutureContractResponse>()
{
ApiMethodName = QuoteApiService.FUTURE_CURRENT_CONTRACT,
ModelValue = new FutureContractByTypeModel() { FutureType = "CL" }
};
return await quoteClient.ExecuteAsync(request);
}
返回示例
{
"data":{
"type":"CL",
"name":"WTI Crude Oil - Apr 2023",
"ibCode":"CL",
"contractCode":"CL2304",
"contractMonth":"202304",
"exchangeCode":"NYMEX",
"exchange":"NYMEX",
"multiplier":1000,
"minTick":0.01,
"lastTradingDate":"20230321",
"firstNoticeDate":"20230323",
"lastBiddingCloseTime":0,
"currency":"USD",
"continuous":false,
"trade":true
},
"code":0,
"message":"success",
"timestamp":1678172580508,
"sign":"FzIp9l2W4BQg3OFwowIUGAFb24J7/MzApVeFxllE4Xr82s8pbSCqnlusufnjUOSNtDlp1/k8TdowexfPfiw8OQCBX1eT1d0tHlJgKiGHZx+nz/KK8QU3nnwjyCrzYIhqLLpXIE95kDEW4Odu0S0HH+yP4Iw+fDzrePLneFwdmCM="
}
查询指定期货合约的交易时间
对应的请求类:TigerRequest(QuoteApiService.FUTURE_TRADING_DATE)
参数
参数 | 类型 | 是否必填 | 描述 |
---|---|---|---|
contractCode | string | yes | 期货合约代码,如CL1901 |
tradingDate | long | yes | 交易日时间戳 |
返回TigerOpenAPI.Quote.Response.FutureTradingDateResponse
source
结构如下:
namespace TigerOpenAPI.Quote.Response
{
public class FutureTradingDateResponse : TigerResponse
{
[JsonProperty(PropertyName = "data")]
public FutureTradingDateItem Data { get; set; }
}
}
返回数据可通过FutureTradingDateResponse.Data
属性访问,返回FutureTradingDateItem
对象,其中TigerOpenAPI.Quote.Response.FutureTradingDateItem
属性如下:
名称 | 类型 | 说明 |
---|---|---|
tradingTimes | array | 交易时间 |
biddingTimes | array | 竞价时间 |
timeSection | string | 所在交易时区 |
请求示例
static async Task<FutureTradingDateResponse?> GetFutureTradingDateAsync(QuoteClient quoteClient)
{
TigerRequest<FutureTradingDateResponse> request = new TigerRequest<FutureTradingDateResponse>()
{
ApiMethodName = QuoteApiService.FUTURE_TRADING_DATE,
ModelValue = new FutureTradingDateModel() {
ContractCode = "ES2306",
TradingDate = DateUtil.CurrentTimeMillis()
}
};
return await quoteClient.ExecuteAsync(request);
}
响应示例
{
"data":{
"biddingTimes":[
{
"start":1678142700000,
"end":1678143600000
}
],
"tradingTimes":[
{
"start":1678143600000,
"end":1678226400000
}
],
"timeSection":"America/Chicago"
},
"code":0,
"message":"success",
"timestamp":1678173600501,
"sign":"ey6JxBr3m2BmqmBI4prrakogg8EOI5IOSZaYoZ2A+9bqkGk+rCTPrGlzCQZVh7fbqxjCnJAvNdPfpv01XPnJfsgMiIpjTXTaodQYmDBidoZDDtf/2frdiGi/gcgaAH5eznznQkhXFcWarfVi8czgF9LNvGnwA9Afs0rm9nZtY+o="
}
获取期货K线数据
对应的请求类:TigerRequest(QuoteApiService.FUTURE_KLINE)
说明
提供了热门合约近10年的日级别K线数据,以及全部合约2017年8月至今的分钟级数据。
返回结果是从endTime开始按时间倒序的数据集合。
对于1分钟K线,如果在这1分钟内没有成交,这一分钟K线数据会空缺;在最近的这一分钟内有成交后接口才能拉取到这1分钟的K线数据,如果在第50秒时产生第一笔交易,在50秒之前拉取不到最新点的数据。
参数
参数 | 类型 | 是否必填 | 描述 |
---|---|---|---|
contractCodes | array | yes | 合约代码列表,支持查询主连合约,如,CL1901/CLmain |
period | string | yes | K线周期,取值范围:"min", "3min", "5min", "10min","15min", "30min", "45min", "60min","2hour", "3hour", "4hour", "6hour","day", "week", "month" |
beginTime | long | yes | 开始时间(包含) |
endTime | long | yes | 结束时间(不包含) |
limit | int | no | 请求条数限制,默认200,最大限制:1000 |
pageToken | string | no | 分页查询token(只支持单个合约,指定endTime的查询),使用pageToken分页拉取数据时其他查询条件不能改变 |
返回TigerOpenAPI.Quote.Response.FutureKlineResponse
source
结构如下:
namespace TigerOpenAPI.Quote.Response
{
public class FutureKlineResponse : TigerResponse
{
[JsonProperty(PropertyName = "data")]
public List<FutureKlineBatchItem> Data { get; set; }
}
}
返回数据可通过FutureKlineResponse.Data
属性访问,返回FutureKlineBatchItem
对象列表,其中TigerOpenAPI.Quote.Response.FutureKlineBatchItem
属性如下:
字段 | 类型 | 说明 |
---|---|---|
contractCode | string | 合约代码 |
nextPageToken | string | 查询下一页的token(只支持单个合约代码,endTime不为null和-1时才有效),如果没有更多数据返回null |
items | array | K线数组,字段参考下面说明 |
其中K线数据items属性如下:
名称 | 类型 | 说明 |
---|---|---|
lastTime | long | 最新价的成交时间 |
volume | long | 成交手数 |
openInterest | no | 未平仓合约数量 |
open | decimal | 开盘价 |
close | decimal | 收盘价 |
time | long | 时间 |
high | decimal | 最高价 |
low | decimal | 最低价 |
settlement | decimal | 结算价,在未生成结算价时返回0 |
示例
static async Task<FutureKlineResponse?> GetFutureKLineAsync(QuoteClient quoteClient)
{
TigerRequest<FutureKlineResponse> request = new TigerRequest<FutureKlineResponse>()
{
ApiMethodName = QuoteApiService.FUTURE_KLINE,
ModelValue = new FutureKlineModel()
{
ContractCodes = new List<string> { "ES2306" },
Period = FutureKType.min15.Value,
BeginTime = DateUtil.ConvertTimestamp("2023-03-06 09:00:00", CustomTimeZone.NY_ZONE),
EndTime = DateUtil.ConvertTimestamp("2023-03-06 20:00:00", CustomTimeZone.NY_ZONE),
Limit = 20
}
};
return await quoteClient.ExecuteAsync(request);
}
返回示例
{
"data":[
{
"contractCode":"ES2306",
"nextPageToken":"ZnV0dXJlX2tsaW5lfEVTMjMwNnwxNW1pbnwxNjc4MTUwODAwMDAwfDE2NzgxMjkxNzAwMDA=",
"items":[
{
"time":1678149900000,
"lastTime":1678150746000,
"open":4092.5,
"close":4092,
"high":4092.75,
"low":4091,
"volume":32,
"openInterest":0,
"settlement":0
},
{
"time":1678149000000,
"lastTime":1678149860000,
"open":4093.75,
"close":4093,
"high":4094.5,
"low":4092,
"volume":81,
"openInterest":0,
"settlement":0
},
{
"time":1678148100000,
"lastTime":1678148987000,
"open":4091.25,
"close":4093.75,
"high":4094,
"low":4091,
"volume":83,
"openInterest":0,
"settlement":0
},
{
"time":1678147200000,
"lastTime":1678148083000,
"open":4091.5,
"close":4092.25,
"high":4094.25,
"low":4091.5,
"volume":28,
"openInterest":0,
"settlement":0
},
{
"time":1678146300000,
"lastTime":1678147127000,
"open":4090.5,
"close":4091.75,
"high":4092.75,
"low":4090.5,
"volume":21,
"openInterest":0,
"settlement":0
},
{
"time":1678145400000,
"lastTime":1678146202000,
"open":4092.25,
"close":4089.75,
"high":4092.25,
"low":4089.75,
"volume":9,
"openInterest":0,
"settlement":0
},
{
"time":1678144500000,
"lastTime":1678145341000,
"open":4089.75,
"close":4091.5,
"high":4091.5,
"low":4089.75,
"volume":15,
"openInterest":0,
"settlement":0
},
{
"time":1678143600000,
"lastTime":1678144339000,
"open":4090,
"close":4089.75,
"high":4090,
"low":4088.75,
"volume":25,
"openInterest":0,
"settlement":0
},
{
"time":1678139100000,
"lastTime":1678139970000,
"open":4091.5,
"close":4091.5,
"high":4091.75,
"low":4091,
"volume":36,
"openInterest":0,
"settlement":0
},
{
"time":1678138200000,
"lastTime":1678138786000,
"open":4091.75,
"close":4091.5,
"high":4092.75,
"low":4091.25,
"volume":40,
"openInterest":0,
"settlement":0
},
{
"time":1678137300000,
"lastTime":1678138056000,
"open":4090.75,
"close":4091.75,
"high":4091.75,
"low":4090.25,
"volume":43,
"openInterest":0,
"settlement":0
},
{
"time":1678136400000,
"lastTime":1678137298000,
"open":4089.25,
"close":4090.5,
"high":4090.75,
"low":4088.25,
"volume":363,
"openInterest":0,
"settlement":0
},
{
"time":1678135500000,
"lastTime":1678136399000,
"open":4090.75,
"close":4089.25,
"high":4092.25,
"low":4088.25,
"volume":494,
"openInterest":0,
"settlement":0
},
{
"time":1678134600000,
"lastTime":1678135484000,
"open":4086,
"close":4090.5,
"high":4091.25,
"low":4085.25,
"volume":441,
"openInterest":0,
"settlement":0
},
{
"time":1678133700000,
"lastTime":1678134584000,
"open":4090,
"close":4086.5,
"high":4090.25,
"low":4085.75,
"volume":444,
"openInterest":0,
"settlement":0
},
{
"time":1678132800000,
"lastTime":1678133699000,
"open":4091.25,
"close":4090,
"high":4094.75,
"low":4088.5,
"volume":598,
"openInterest":0,
"settlement":0
},
{
"time":1678131900000,
"lastTime":1678132766000,
"open":4095.75,
"close":4090.5,
"high":4095.75,
"low":4089.5,
"volume":189,
"openInterest":0,
"settlement":0
},
{
"time":1678131000000,
"lastTime":1678131880000,
"open":4094.25,
"close":4096.25,
"high":4096.75,
"low":4092.25,
"volume":132,
"openInterest":0,
"settlement":0
},
{
"time":1678130100000,
"lastTime":1678130990000,
"open":4096.75,
"close":4094,
"high":4097,
"low":4091.25,
"volume":174,
"openInterest":0,
"settlement":0
},
{
"time":1678129200000,
"lastTime":1678130078000,
"open":4093,
"close":4097.75,
"high":4098.25,
"low":4092.5,
"volume":149,
"openInterest":0,
"settlement":0
}
]
}
],
"code":0,
"message":"success",
"timestamp":1678175056154,
"sign":"QOhaoeoPG4m8rkG1p7PQW7PahB2y3iUhnY61FLWmZoInply63yFDxpCEMCsvEzCAZcNdOuinXC6YvYOKI1Jt/C5LRZ4M5zzsTeYVSMzyJefbCmmdKey49HXimPgWQwOuS8AsuiIf19blKzK20xMyj2/tNT3eB8ZTuWcComEC/Kc="
}
期货实时行情
对应的请求类:TigerRequest(QuoteApiService.FUTURE_REAL_TIME_QUOTE)
说明
获取期货实时行情
参数
参数 | 类型 | 是否必填 | 描述 |
---|---|---|---|
contractCodes | array | yes | 合约代码列表,支持查询主连合约,如,CL1901/CLmain |
返回TigerOpenAPI.Quote.Response.FutureRealTimeQuoteResponse
source
结构如下:
namespace TigerOpenAPI.Quote.Response
{
public class FutureRealTimeQuoteResponse : TigerResponse
{
[JsonProperty(PropertyName = "data")]
public List<FutureRealTimeItem> Data { get; set; }
}
}
返回数据可通过FutureRealTimeQuoteResponse.Data
属性访问,返回FutureRealTimeItem
对象列表,其中TigerOpenAPI.Quote.Response.FutureRealTimeItem
属性如下:
名称 | 类型 | 说明 |
---|---|---|
contractCode | string | 合约代码 |
latestPrice | decimal | 最新成交价格 |
latestSize | decimal | 最新价的成交量 |
latestTime | long | 最新价的成交时间 |
bidPrice | decimal | 买盘价(一档) |
bidSize | long | 买盘数量(一档) |
askPrice | decimal | 卖盘价(一档) |
askSize | long | 卖盘数量(一档) |
volume | long | 当日累计成交手数 |
openInterest | long | 未平仓合约数量 |
open | decimal | 开盘价 |
high | decimal | 最高价 |
low | decimal | 最低价 |
settlement | decimal | 结算价,在未生成结算价时返回0 |
limitUp | decimal | 涨停价 |
limitDown | decimal | 跌停价 |
示例
static async Task<FutureRealTimeQuoteResponse?> GetFutureRealTimeQuoteAsync(QuoteClient quoteClient)
{
TigerRequest<FutureRealTimeQuoteResponse> request = new TigerRequest<FutureRealTimeQuoteResponse>()
{
ApiMethodName = QuoteApiService.FUTURE_REAL_TIME_QUOTE,
ModelValue = new FutureContractCodesModel()
{
ContractCodes = new List<string> { "CL2306" }
}
};
return await quoteClient.ExecuteAsync(request);
}
返回示例
{
"data":[
{
"contractCode":"CL2306",
"latestPrice":80.46,
"latestSize":1,
"latestTime":1678177555000,
"bidPrice":80.41,
"bidSize":6,
"askPrice":80.43,
"askSize":7,
"openInterest":220802,
"volume":1541,
"open":80.51,
"high":80.97,
"low":80.42,
"settlement":80.51,
"limitUp":0,
"limitDown":0
}
],
"code":0,
"message":"success",
"timestamp":1678177603241,
"sign":"SZviDq7XrkTefCKvlLZlwGbFKq8CVw+q0HMU3GZxuC7gdiCp5QbRcnPAKSEvupQCtkV7kN75jQROe5WocD0DQdOPtvWgvBbb+JB+lnL5YS5od3gUQutAcG0iCLjoupJVqjIa/FjbEqcaWMX2IYRg8myEkNFP/g3T/57/QLQaKS8="
}
获取期货逐笔数据
对应的请求类:TigerRequest(QuoteApiService.FUTURE_TICK)
说明
获取期货逐笔成交数据,逐笔记录的index每天从下标0处开始。
参数
参数 | 类型 | 是否必填 | 描述 |
---|---|---|---|
contractCode | string | yes | 期货合约代码,如:CL1901 |
beginIndex | long | yes | 起始索引,首次请求时beginIndex和endIndex可以设置为-1,首次请求会返回最新的逐笔数据,后续可以传上次返回的最新索引值+1 |
endIndex | long | yes | 结束索引,如果结束索引和起始索引的差值大于1000,会按照最大1000条返回。当结束索引或起始索引其中一个设置为-1时,会从非-1的一端开始查询,并返回limit条逐笔数据。 |
limit | Int | no | 默认为200,最大限制为1000条 |
begin_index 和 end_index参数使用说明
查询方式 | beginIndex | endIndex | 描述 |
---|---|---|---|
从前往后查逐笔记录 | 具体数值 | -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条记录。 |
返回TigerOpenAPI.Quote.Response.FutureTickResponse
source
结构如下:
namespace TigerOpenAPI.Quote.Response
{
public class FutureTickResponse : TigerResponse
{
[JsonProperty(PropertyName = "data")]
public FutureTickBatchItem Data { get; set; }
}
}
返回数据可通过FutureTickResponse.Data
属性访问,返回FutureTickBatchItem
对象列表,其中TigerOpenAPI.Quote.Response.FutureTickBatchItem
属性如下:
名称 | 类型 | 说明 |
---|---|---|
contractCode | string | 合约代码 |
items | List<FutureTickItem> | 逐笔数据 |
FutureTickItem
属性如下:
名称 | 类型 | 说明 |
---|---|---|
index | int | 索引 |
price | double | 成交价 |
volume | long | 成交量 |
time | long | 时间 |
示例
static async Task<FutureTickResponse?> GetFutureTickAsync(QuoteClient quoteClient)
{
TigerRequest<FutureTickResponse> request = new TigerRequest<FutureTickResponse>()
{
ApiMethodName = QuoteApiService.FUTURE_TICK,
ModelValue = new FutureTickModel()
{
ContractCode = "ES2306",
BeginIndex = 10,
EndIndex = 100,
Limit = 20
}
};
return await quoteClient.ExecuteAsync(request);
}
返回示例
{
"data":{
"contractCode":"ES2306",
"items":[
{
"index":10,
"price":4089.5,
"volume":1,
"time":1678144320000
},
{
"index":11,
"price":4089.75,
"volume":1,
"time":1678144339000
},
{
"index":12,
"price":4089.75,
"volume":1,
"time":1678144534000
},
{
"index":13,
"price":4089.75,
"volume":3,
"time":1678144548000
},
{
"index":14,
"price":4090.5,
"volume":1,
"time":1678144591000
},
{
"index":15,
"price":4090.75,
"volume":3,
"time":1678144624000
},
{
"index":16,
"price":4090.75,
"volume":1,
"time":1678144624000
},
{
"index":17,
"price":4091,
"volume":2,
"time":1678144870000
},
{
"index":18,
"price":4091.25,
"volume":1,
"time":1678145178000
},
{
"index":19,
"price":4091.5,
"volume":1,
"time":1678145287000
},
{
"index":20,
"price":4091.5,
"volume":2,
"time":1678145341000
},
{
"index":21,
"price":4092.25,
"volume":1,
"time":1678145425000
},
{
"index":22,
"price":4092,
"volume":1,
"time":1678145462000
},
{
"index":23,
"price":4091.5,
"volume":1,
"time":1678145568000
},
{
"index":24,
"price":4090.75,
"volume":2,
"time":1678145647000
},
{
"index":25,
"price":4091,
"volume":1,
"time":1678145844000
},
{
"index":26,
"price":4091,
"volume":2,
"time":1678146074000
},
{
"index":27,
"price":4089.75,
"volume":1,
"time":1678146202000
},
{
"index":28,
"price":4090.5,
"volume":1,
"time":1678146337000
},
{
"index":29,
"price":4091,
"volume":1,
"time":1678146435000
}
]
},
"code":0,
"message":"success",
"timestamp":1678179358159,
"sign":"c47DHnl8Y/zNCX6fFIMBGUQJeJ2rsaJ1KGfIP3lubO3nEMgRBInh4TYVzWmzTW2UW4Xx1/UnjVi8sWbBbD73UysOQnWEsFwdz+FDbpiA+UxVF07j/7kY7vsFnX+NzYm7js2R4/9LhMPAxdvCoM7P0Ujwz3nDWHHH+yTpo29r6xI="
}
查询期货主连的历史合约
对应的请求类:TigerRequest(QuoteApiService.FUTURE_HISTORY_MAIN_CONTRACT)
说明
获取期货主连对应历史日期的期货合约。
参数
参数 | 类型 | 是否必填 | 描述 |
---|---|---|---|
contractCodes | list | yes | 合约代码列表,支持查询主连合约,如,ESmain |
begin_time | long | yes | 开始时间(不包含) |
end_time | long | yes | 结束时间(包含) |
返回
TigerOpenAPI.Quote.Response.FutureHistoryMainContractResponse
source
结构如下:
namespace TigerOpenAPI.Quote.Response
{
public class FutureHistoryMainContractResponse : TigerResponse
{
[JsonProperty(PropertyName = "data")]
public List<FutureHistoryMainContractItem> Data { get; set; }
}
}
返回数据可通过FutureHistoryMainContractResponse.Data
属性访问,返回FutureHistoryMainContractItem
对象列表,其中TigerOpenAPI.Quote.Response.FutureHistoryMainContractItem
属性如下:
字段 | 类型 | 说明 |
---|---|---|
contractCode | string | 合约代码 |
mainReferItems | List<FutureHistoryContractItem> | 主合约的历史合约列表,FutureHistoryContractItem 字段参考下面说明 |
其中历史合约数据items属性如下:
名称 | 类型 | 说明 |
---|---|---|
time | long | 日期时间戳 |
referContractCode | string | 主连合约对应的期货合约 |
示例
static async Task<FutureHistoryMainContractResponse?> GetFutureHistoryMainContractAsync(QuoteClient quoteClient)
{
TigerRequest<FutureHistoryMainContractResponse> request = new TigerRequest<FutureHistoryMainContractResponse>()
{
ApiMethodName = QuoteApiService.FUTURE_HISTORY_MAIN_CONTRACT,
ModelValue = new FutureHistoryMainContractModel()
{
ContractCodes = new List<string> { "ESmain" },
BeginTime = DateUtil.ConvertTimestamp("2023-08-08 00:00:00", CustomTimeZone.NY_ZONE),
EndTime = DateUtil.ConvertTimestamp("2023-10-05 23:59:00", CustomTimeZone.NY_ZONE),
}
};
return await quoteClient.ExecuteAsync(request);
}
返回示例
{
"data":[
{
"contractCode":"ESmain",
"mainReferItems":[
{
"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":"ES2312"
},
{
"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"
}
]
}
],
"code":0,
"message":"success",
"timestamp":1696503833367,
"sign":"KCLiaXU/4r517tF5JfPLuWOz2C0kdyAJBTt5eA8aPfUSXHQb6LjGeNyJdXZyhKkTODoWBfdcOY0eB8uvgVi9iy2ZZkEfrrF6VGIs0q9rXutoD1a7M/TyuphSyT2r5Lj4XToFswE5Tk2Pz1WIj554Kcuq1gdKtGXN5Zu+amO7LU8="
}