获取合约
获取合约
操作名
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. Key SDK fields: ContractId: Int32, Identifier: string, Symbol: string, SecType: string, Expiry: string, ContractMonth: string, Strike: Double, Right: string.
示例
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 缺失时为 null返回示例
{
"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 字典,键为 string,值为 列表,元素为 ContractItem. Key SDK fields: 动态字段.
示例
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 缺失时为 null频率限制
基础额度:每分钟 60 次。
Updated 7 days ago
Did this page help you?
