获取合约
获取合约
操作名
TradeApiService.CONTRACT = contract。该常量用于设置 TigerRequest.ApiMethodName。
请求
TigerRequest<ContractResponse>ModelValue: ContractModel.
参数
| SDK property | C# type | API field | SDK default | Required | Constraints |
|---|---|---|---|---|---|
Lang | Language | lang | CLR 默认值;序列化时省略 | no | — |
Account | string (nullable) | account | null | Auto-filled if empty | 为空时 TradeClient 从 TigerConfig.DefaultAccount 注入;若仍为空则验证失败 |
SecretKey | string | secret_key | null | no | — |
SecType | string | sec_type | TigerOpenAPI.Common.Enum.SecType.STK.ToString() | Optional | — |
Currency | string | currency | null | Optional | — |
Right | string | right | null | Optional | — |
Strike | Double | strike | CLR 默认值;序列化时省略 | Optional | — |
Expiry | string | expiry | null | Optional | — |
Exchange | string | exchange | null | Optional | — |
Symbol | string | symbol | null | Required | — |
返回
ContractResponse inherits TigerResponse; its data property is ContractItem.
示例
TigerRequest<ContractResponse> request = new()
{
ApiMethodName = TradeApiService.CONTRACT,
ModelValue = new ContractModel { Account = tradeClient.GetDefaultAccount, SecType = "STK", Currency = "USD", Strike = 200.0, Symbol = "AAPL" }
};
ContractResponse? response = await tradeClient.ExecuteAsync(request);响应类型
ContractItem? data = response?.Data; // response 或 data 缺失时为 nullData 字段
| 字段 | API 字段 | C# 类型 | 说明 |
|---|---|---|---|
ContractId | contractId | Int32 | 合约标识 |
Identifier | identifier | string | 合约唯一标识 |
Symbol | symbol | string | 合约代码 |
SecType | secType | string | 证券类型 |
Expiry | expiry | string | 到期日 |
ContractMonth | contractMonth | string | 合约月份 |
Strike | strike | Double | 行权价 |
Right | right | string | 期权方向 |
Multiplier | multiplier | Double | 合约乘数 |
LotSize | lotSize | Double | 每手数量 |
Exchange | exchange | string | 交易所 |
Market | market | string | 所属市场 |
PrimaryExchange | primaryExchange | string | 主要交易所 |
Currency | currency | string | 计价币种 |
LocalSymbol | localSymbol | string | 本地合约代码 |
TradingClass | tradingClass | string | 交易类别 |
Name | name | string | 合约名称 |
Tradeable | tradeable | Boolean | 是否可交易 |
CloseOnly | closeOnly | Boolean | 是否仅可平仓 |
MinTick | minTick | Double | 最小价格变动单位 |
Marginable | marginable | Boolean | 是否支持保证金交易 |
ShortInitialMargin | shortInitialMargin | Double | 卖空初始保证金 |
ShortMaintenanceMargin | shortMaintenanceMargin | Double | 卖空维持保证金 |
ShortFeeRate | shortFeeRate | Double | 卖空费用费率 |
Shortable | shortable | Boolean | 是否可卖空 |
ShortableCount | shortableCount | long | 可卖空数量 |
LongInitialMargin | longInitialMargin | Double | 多头初始保证金 |
LongMaintenanceMargin | longMaintenanceMargin | Double | 多头维持保证金 |
LastTradingDate | lastTradingDate | string | 最后交易日 |
FirstNoticeDate | firstNoticeDate | string | 首次通知日 |
LastBiddingCloseTime | lastBiddingCloseTime | long | 最后竞价截止时间 |
Continuous | continuous | Boolean | 是否为连续合约 |
Type | type | string | 期货合约类型 |
IbCode | ibCode | string | IB 合约代码 |
TickSizes | tickSizes | List<TickSizeItem> | 最小价格变动规则列表 |
DiscountedDayInitialMargin | discountedDayInitialMargin | Double | 日内折扣初始保证金 |
DiscountedDayMaintenanceMargin | discountedDayMaintenanceMargin | Double | 日内折扣维持保证金 |
DiscountedTimeZoneCode | discountedTimeZoneCode | string | 日内保证金折扣时段的时区代码 |
DiscountedStartAt | discountedStartAt | string | 日内保证金折扣开始时间 |
DiscountedEndAt | discountedEndAt | string | 日内保证金折扣结束时间 |
IsEtf | isEtf | Boolean | 是否为 ETF |
EtfLeverage | etfLeverage | Int32 | ETF 杠杆倍数 |
每个 TickSizes 元素是 TickSizeItem:
| 字段 | API 字段 | C# 类型 | 说明 |
|---|---|---|---|
Begin | begin | string | 价格区间起始值 |
End | end | string | 价格区间结束值 |
Type | type | TickSizeType | 价格变动规则类型 |
TickSize | tickSize | double | 最小价格变动单位 |
返回示例
{
"code": 0,
"message": "success",
"timestamp": 1785528000000,
"data": {
"symbol": "AAPL",
"secType": "STK",
"exchange": "SMART",
"market": "US",
"lotSize": 1,
"currency": "USD",
"name": "Apple Inc"
}
}频率限制
基础额度:每分钟 60 次。
批量获取合约
操作名
TradeApiService.CONTRACTS = contracts。该常量用于设置 TigerRequest.ApiMethodName。
请求
TigerRequest<ContractsResponse>ModelValue: ContractsModel.
参数
| SDK property | C# type | API field | SDK default | Required | Constraints |
|---|---|---|---|---|---|
Lang | Language | lang | CLR 默认值;序列化时省略 | no | — |
Account | string (nullable) | account | null | Auto-filled if empty | 为空时 TradeClient 从 TigerConfig.DefaultAccount 注入;若仍为空则验证失败 |
SecretKey | string | secret_key | null | no | — |
SecType | string | sec_type | TigerOpenAPI.Common.Enum.SecType.STK.ToString() | Optional | — |
Currency | string | currency | null | Optional | — |
Right | string | right | null | Optional | — |
Strike | Double | strike | CLR 默认值;序列化时省略 | Optional | — |
Expiry | string | expiry | null | Optional | — |
Exchange | string | exchange | null | Optional | — |
Symbols | 列表,元素为 string | symbols | null | Required | Non-empty list |
返回
ContractsResponse inherits TigerResponse; its data property is Dictionary<string, List<ContractItem>>.
示例
TigerRequest<ContractsResponse> request = new()
{
ApiMethodName = TradeApiService.CONTRACTS,
ModelValue = new ContractsModel { Account = tradeClient.GetDefaultAccount, SecType = "STK", Currency = "USD", Strike = 200.0, Symbols = new List<string> { "AAPL" } }
};
ContractsResponse? response = await tradeClient.ExecuteAsync(request);响应类型
Dictionary<string, List<ContractItem>>? data = response?.Data; // response 或 data 缺失时为 nullData 字段
| 类型 | SDK 约定 |
|---|---|
Dictionary<string, List<ContractItem>> | 动态字典;键和值的实际组合不固定。每个 ContractItem 的完整字段见上文获取合约的 Data 字段。 |
频率限制
基础额度:每分钟 60 次。
Updated about 1 month ago
Did this page help you?
