获取合约
获取合约
操作名
TradeApiService.CONTRACT = contract. 使用服务端方法 contract。这是 *ApiService 常量,不是客户端成员方法。
请求
TigerRequest<ContractResponse>ModelValue: ContractModel.
参数
| SDK property | C# type | API field | SDK default | Required | Constraints |
|---|---|---|---|---|---|
Lang | Language | lang | None (omitted if not set) | no | — |
Account | string (nullable) | account | null | Auto-filled if empty | TradeClient uses DefaultAccount when empty |
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 | None (omitted if not set) | 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"
}
]
}批量获取合约
操作名
TradeApiService.CONTRACTS = contracts. 使用服务端方法 contracts。这是 *ApiService 常量,不是客户端成员方法。
请求
TigerRequest<ContractsResponse>ModelValue: ContractsModel.
参数
| SDK property | C# type | API field | SDK default | Required | Constraints |
|---|---|---|---|---|---|
Lang | Language | lang | None (omitted if not set) | no | — |
Account | string (nullable) | account | null | Auto-filled if empty | TradeClient uses DefaultAccount when empty |
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 | None (omitted if not set) | 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 缺失时为 nullUpdated 9 days ago
Did this page help you?
