获取合约

状态变更操作必须防止重复提交。

获取合约

操作名

TradeApiService.CONTRACT = contract. 使用服务端方法 contract。这是 *ApiService 常量,不是客户端成员方法。

请求

TigerRequest<ContractResponse>

ModelValue: ContractModel.

参数

SDK propertyC# typeAPI fieldSDK defaultRequiredConstraints
LangLanguagelangNone (omitted if not set)no
Accountstring (nullable)accountnullAuto-filled if emptyTradeClient uses DefaultAccount when empty
SecretKeystringsecret_keynullno
SecTypestringsec_typeTigerOpenAPI.Common.Enum.SecType.STK.ToString()Optional
CurrencystringcurrencynullOptional
RightstringrightnullOptional
StrikeDoublestrikeNone (omitted if not set)Optional
ExpirystringexpirynullOptional
ExchangestringexchangenullOptional
SymbolstringsymbolnullRequired

返回

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 propertyC# typeAPI fieldSDK defaultRequiredConstraints
LangLanguagelangNone (omitted if not set)no
Accountstring (nullable)accountnullAuto-filled if emptyTradeClient uses DefaultAccount when empty
SecretKeystringsecret_keynullno
SecTypestringsec_typeTigerOpenAPI.Common.Enum.SecType.STK.ToString()Optional
CurrencystringcurrencynullOptional
RightstringrightnullOptional
StrikeDoublestrikeNone (omitted if not set)Optional
ExpirystringexpirynullOptional
ExchangestringexchangenullOptional
Symbols列表,元素为 stringsymbolsnullRequiredNon-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

Did this page help you?