请求、响应与操作名

TigerRequest

public class TigerRequest<T> where T : TigerResponse
属性类型SDK 默认值用途
ApiMethodNamestringQuoteApiService/TradeApiService 操作名常量
ModelValueApiModel客户端空模型业务请求;序列化为 biz_content
ApiVersionstringTigerApiConstants.DEFAULT_VERSION协议版本
CharsetstringUTF-8 常量签名字符集
SignTypestringRSA 常量签名算法
TigerIdTimestampSignDeviceIdstring客户端填写通常不要手工设置

*ApiService 类不是服务客户端。IsQuoteApi(string)IsTradeApi(string) 仅验证操作名是否在集合中;实际网络调用在 QuoteClient/TradeClientExecuteExecuteAsync

TigerResponse

所有响应继承 TigerResponse,共同字段为 Code (int)、Message (string)、Timestamp (long) 和 Sign (string);IsSuccess() 判断 Code == 0。具体数据读取响应类声明的 Data:可能是强类型对象、列表、Dictionary<string, object>object

频率与错误

  • SDK 最多按 TigerConfig.FailRetryCounts 重试可重试 HTTP 失败。
  • 同步下单和令牌刷新不自动重试;应用不得把业务失败当网络失败重提。
  • 仅使用具体接口页面列出的批量数量、日期窗口、分页和频率限制。处理失败时检查响应业务码,分页时原样传递分页令牌,并仅对可安全重试的读取请求执行退避。
  • 行情、交易、期权、期货、深度和推送权限彼此独立。

协议字段模型

下列五个服务端操作已在 QuoteApiService 注册,但 C# SDK 1.2.3 没有专用请求类。匿名对象不能赋给 TigerRequest.ModelValue;应用应定义继承 ApiModel 的小型模型:

using Newtonsoft.Json;
using TigerOpenAPI.Common.Enum;
using TigerOpenAPI.Model;

public sealed class StockDetailModel : ApiModel
{
    [JsonProperty(PropertyName = "symbols")]
    public List<string> Symbols { get; set; } = new();

    [JsonProperty(PropertyName = "sec_type", NullValueHandling = NullValueHandling.Ignore)]
    public string? SecType { get; set; }
}

public sealed class OptionTimelineQuery
{
    [JsonProperty(PropertyName = "symbol")]
    public string Symbol { get; set; } = string.Empty;

    [JsonProperty(PropertyName = "expiry")]
    public long Expiry { get; set; }

    [JsonProperty(PropertyName = "right")]
    public string Right { get; set; } = string.Empty;

    [JsonProperty(PropertyName = "strike")]
    public string Strike { get; set; } = string.Empty;

    [JsonProperty(PropertyName = "begin_time", NullValueHandling = NullValueHandling.Ignore)]
    public long? BeginTime { get; set; }
}

public sealed class OptionTimelineModel : ApiModel
{
    [JsonProperty(PropertyName = "option_query")]
    public List<OptionTimelineQuery> OptionQuery { get; set; } = new();

    [JsonProperty(PropertyName = "market")]
    public Market Market { get; set; }
}

public sealed class IndustryListModel : ApiModel
{
    [JsonProperty(PropertyName = "industry_level", NullValueHandling = NullValueHandling.Ignore)]
    public string? IndustryLevel { get; set; }
}

public sealed class IndustryStocksModel : ApiModel
{
    [JsonProperty(PropertyName = "industry_id")]
    public int IndustryId { get; set; }

    [JsonProperty(PropertyName = "market", NullValueHandling = NullValueHandling.Ignore)]
    public string? Market { get; set; }
}

public sealed class StockIndustryModel : ApiModel
{
    [JsonProperty(PropertyName = "symbol")]
    public string Symbol { get; set; } = string.Empty;

    [JsonProperty(PropertyName = "market", NullValueHandling = NullValueHandling.Ignore)]
    public string? Market { get; set; }

    [JsonProperty(PropertyName = "sec_type", NullValueHandling = NullValueHandling.Ignore)]
    public string? SecType { get; set; }
}

本地期权计算

OptionCalcUtil.GetOptionFundamentals 使用行情输入计算 OptionFundamentals。计算结果中的 Greeks 含义:

字段说明
Delta期权理论价值对标的价格变化的敏感度
GammaDelta 对标的价格变化的敏感度
Theta期权理论价值对时间流逝的敏感度
Vega期权理论价值对隐含波动率变化的敏感度
Rho期权理论价值对无风险利率变化的敏感度

这些本地计算结果与已废弃的期权链 Greeks 字段不是同一数据来源。


Did this page help you?