期权

大约 16 分钟

获取期权过期日

对应的请求类:TigerRequest(QuoteApiService.OPTION_EXPIRATION)

说明

获取期权过期日,请求上限为30支股票

参数

参数类型是否必填描述
symbolsarrayYes股票代码列表,上限为:30
marketstringYesUS/HK港股

返回TigerOpenAPI.Quote.Response.OptionExpirationResponsesourceopen in new window

结构如下:

namespace TigerOpenAPI.Quote.Response
{
  public class OptionExpirationResponse : TigerResponse
  {
    [JsonProperty(PropertyName = "data")]
    public List<OptionExpirationItem> Data { get; set; }

  }
}

返回数据可通过OptionExpirationResponse.Data属性访问,返回OptionExpirationItem对象,其中TigerOpenAPI.Quote.Response.OptionExpirationItem 属性如下:

名称类型说明
symbolstring股票代码
countint过期日期个数
datesarray过期时间,日期格式,如:2024-06-28
timestampsarray过期日期,时间戳格式,如:1544763600000(美国NewYork时间对应的时间戳)
periodTagsarray期权周期标签,m为月期权,w为周期权

具体字段可通过对象的属性,如OptionExpirationItem.Symbol进行访问,或通过对象的JsonConvert.SerializeObject()方法转换为字符串

示例

  static async Task<OptionExpirationResponse?> GetOptionExpirationAsync(QuoteClient quoteClient)
  {
    TigerRequest<OptionExpirationResponse> request = new TigerRequest<OptionExpirationResponse>()
    {
      ApiMethodName = QuoteApiService.OPTION_EXPIRATION,
      ModelValue = new OptionExpirationModel()
      {
        Symbols = new List<string> { "AAPL" },
        Market = Market.US
        //Symbols = new List<string> { "PAI.HK" },
        //Market = Market.HK
      }
    };
    return await quoteClient.ExecuteAsync(request);
  }

返回示例

{
    "data": [
        {
            "symbol": "AAPL",
            "count": 19,
            "dates": [
                "2024-06-28",
                "2024-07-05",
                "2024-07-12",
                "2024-07-19",
                "2024-07-26",
                "2024-08-02",
                "2024-08-16",
                "2024-09-20",
                "2024-10-18",
                "2024-11-15",
                "2024-12-20",
                "2025-01-17",
                "2025-03-21",
                "2025-06-20",
                "2025-09-19",
                "2025-12-19",
                "2026-01-16",
                "2026-06-18",
                "2026-12-18"
            ],
            "timestamps": [
                1719547200000,
                1720152000000,
                1720756800000,
                1721361600000,
                1721966400000,
                1722571200000,
                1723780800000,
                1726804800000,
                1729224000000,
                1731646800000,
                1734670800000,
                1737090000000,
                1742529600000,
                1750392000000,
                1758254400000,
                1766120400000,
                1768539600000,
                1781755200000,
                1797570000000
            ],
            "periodTags": [
                "w",
                "w",
                "w",
                "m",
                "w",
                "w",
                "m",
                "m",
                "m",
                "m",
                "m",
                "m",
                "m",
                "m",
                "m",
                "m",
                "m",
                "w",
                "m"
            ]
        }
    ],
    "code": 0,
    "message": "success",
    "timestamp": 1719405873603,
    "sign": "utNCKc73HQ0ikC4LINiUGVUgPm5LypCndq1CVSSNNc+cD9yoCG/euWaNaQx5it92jNaKsizolCsxcijZZEDGvliSuUhBNeu33/0FP7vOrKTietkHO6UQnBvUJoEc5oe6J3B7TdNC2xjN3t0jYRbI8Doi5q5EXMWQYt0/GrpEvFs="
}

获取期权链

对应的请求类:TigerRequest(QuoteApiService.OPTION_CHAIN)

说明

获取期权链。返回的希腊字母不是最新数据,是上个交易日最后更新的数据,盘中可以用期权指标计算

参数

参数类型是否必填描述
symbolstringYes股票代码,symbol和expiry组合上限为:30
expiryStringYes期权过期日,示例:'2022-01-01'
marketstringYesUS 美股,HK港股

筛选参数:

参数类型是否必填描述
implied_volatilitydoubleNo隐含波动率
in_the_moneybooleanNo是否价内
open_interestintNo未平仓量
deltadoubleNodelta
gammadoubleNogamma
thetadoubleNotheta
vegadoubleNovega
rhodoubleNorho

返回TigerOpenAPI.Quote.Response.OptionChainResponsesourceopen in new window

结构如下:

namespace TigerOpenAPI.Quote.Response
{
  public class OptionChainResponse : TigerResponse
  {
    [JsonProperty(PropertyName = "data")]
    public List<OptionChainItem> Data { get; set; }
  }
}

返回数据可通过OptionChainResponse.Data属性访问,返回OptionChainItem对象,其中TigerOpenAPI.Quote.Response.OptionChainItem 属性如下:

名称类型说明
symbolstring标的股票代码
expirylong期权过期日
itemsList<OptionRealTimeQuoteGroup>列表,包含OptionRealTimeQuoteGroup对象,保存期权链数据,说明见下文

OptionRealTimeQuoteGroup对象结构:

名称类型说明
putOptionRealTimeQuote看跌期权合约
callOptionRealTimeQuote看涨期权合约

OptionRealTimeQuote对象结构:

名称类型说明
identifierstring期权标识,如:AAPL 230317P00152500
strikedouble行权价
rightstring期权方向 PUT/CALL
askPricedouble卖盘价格
askSizeint卖盘数量
bidPricedouble买盘价格
bidSizeint买盘数量
lastTimestamplong最新成交时间 如:1543343800698
latestPricedouble最新价
multiplierdouble乘数,美股期权默认100
openInterestint未平仓量
preClosedouble前一交易日的收盘价
volumelong成交量
impliedVoldouble隐含波动率
deltadoubledelta
gammadoublegamma
thetadoubletheta
vegadoublevega
rhodoublerho

具体字段可通过对象的属性,如OptionRealTimeQuote.Identifier进行访问,或通过对象的JsonConvert.SerializeObject()方法转换为字符串

示例

  static async Task<OptionChainResponse?> GetOptionChainAsync(QuoteClient quoteClient)
  {
    TigerRequest<OptionChainResponse> request = new TigerRequest<OptionChainResponse>()
    {
      ApiMethodName = QuoteApiService.OPTION_CHAIN,
      ModelValue = new OptionChainV3Model()
      {
        Market = Market.US,
        OptionBasic = new List<OptionChainModel>()
        {
          new OptionChainModel() {
            Symbol = "AAPL",
            Expiry = DateUtil.ConvertTimestamp("2024-07-26", CustomTimeZone.NY_ZONE)
          }
        },
        OptionFilter = new OptionChainFilterModel()
        {
          InTheMoney = true,
          ImpliedVolatility = new Range<Double>(0.1537, 0.8282),
          OpenInterest = new Range<int>(10, 50000),
          Greeks = new Greeks()
          {
            Delta = new Range<Double>(-0.8, 0.6),
            Gamma = new Range<double>(0.024, 0.3),
            Vega = new Range<double>(0.019, 0.343),
            Theta = new Range<double>(-0.1, 0.1),
            Rho = new Range<double>(-0.096, 0.101)
          }
        }

        //Market = Market.HK,
        //OptionBasic = new List<OptionChainModel>()
        //{
        //  new OptionChainModel() {
        //    Symbol = "PAI.HK",
        //    Expiry = DateUtil.ConvertTimestamp("2024-06-27", CustomTimeZone.NY_ZONE)
        //  }
        //},
      }
    };
    return await quoteClient.ExecuteAsync(request);
  }

返回示例

{
    "data": [
        {
            "symbol": "AAPL",
            "expiry": 1721966400000,
            "items": [
                {
                    "put": null,
                    "call": {
                        "identifier": "AAPL  240726C00210000",
                        "strike": "210.0",
                        "right": "call",
                        "askPrice": 6.1,
                        "askSize": 93,
                        "bidPrice": 5.8,
                        "bidSize": 502,
                        "latestPrice": 6.32,
                        "preClose": 4.8,
                        "volume": 4,
                        "openInterest": 2766,
                        "multiplier": 100,
                        "lastTimestamp": 1719408640494,
                        "impliedVol": 0.197337,
                        "delta": 0.507864,
                        "gamma": 0.033127,
                        "theta": -0.090114,
                        "vega": 0.242641,
                        "rho": 0.086166
                    }
                },
                {
                    "put": {
                        "identifier": "AAPL  240726P00215000",
                        "strike": "215.0",
                        "right": "put",
                        "askPrice": 6.6,
                        "askSize": 118,
                        "bidPrice": 6.25,
                        "bidSize": 169,
                        "latestPrice": 7.8,
                        "preClose": 7.8,
                        "volume": 0,
                        "openInterest": 1222,
                        "multiplier": 100,
                        "lastTimestamp": 1719345365800,
                        "impliedVol": 0.18012,
                        "delta": -0.686314,
                        "gamma": 0.03523,
                        "theta": -0.048649,
                        "vega": 0.21153,
                        "rho": -0.084955
                    },
                    "call": null
                }
            ]
        }
    ],
    "code": 0,
    "message": "success",
    "timestamp": 1719408676252,
    "sign": "qwhAWEAw/z2TH9kZd/VKIxafBUUdJGY0KWB9KjbybrgsQtMrNN7sWdVOgv5GxcV0kLeMHQYiF6m/lBQ1nb8+yNnHlg9UIaceOz1QmV4IVf5PwHcevIwadiVY7caHW9QLYgR2Jzmseq+pu1OurhRApevJJcNpQW04reauM0dtgOY="
}

获取期权行情摘要

对应的请求类:TigerRequest(QuoteApiService.OPTION_BRIEF)

说明

获取期权行情摘要。批量参数上限为30

参数

参数类型是否必填描述
marketMarketyes市场,只支持US、HK
option_basicList<OptionCommonModel>yes期权四要素列表,最大30

OptionCommonModel参数结构如下

参数类型是否必填描述
symbolstringyes股票代码
rightstringyes看多或看空(CALL/PUT)
expirylongyes到期时间
strikestringyes行权价

返回TigerOpenAPI.Quote.Response.OptionBriefResponsesourceopen in new window

结构如下:

namespace TigerOpenAPI.Quote.Response
{
  public class OptionBriefResponse : TigerResponse
  {
    [JsonProperty(PropertyName = "data")]
    public List<OptionBriefItem> Data { get; set; }
  }
}

返回数据可通过TigerResponse.Data属性访问,返回OptionBriefItem对象,其中TigerOpenAPI.Quote.Response.OptionBriefItem 属性如下:

字段类型说明
symbolstring股票代码
strikestring行权价
rightstring方向 (PUT/CALL)
expirylong到期时间(毫秒,当天0点)
bidPricedouble买盘价格
bidSizeint买盘数量
askPricedouble卖盘价格
askSizeint卖盘数量
latestPricedouble最新价格
timestamplong最新成交时间
volumelong成交量
highdouble最高价
lowdouble最低价
opendouble开盘价
preClosedouble前一交易日收盘价
openInterestint未平仓量
changedouble涨跌额
multiplierint乘数,美股期权默认100
ratesBondsdouble一年期美国国债利率,每天更新一次,如:0.0078 表示实际利率为:0.78%
volatilitystring历史波动率

具体字段可通过对象的属性,如OptionBriefItem.Symbol进行访问, 或通过对象的JsonConvert.SerializeObject()方法转换为字符串

示例

  static async Task<OptionBriefResponse?> GetOptionBriefV2Async(QuoteClient quoteClient)
  {
    TigerRequest<OptionBriefResponse> request = new TigerRequest<OptionBriefResponse>()
    {
      ApiMethodName = QuoteApiService.OPTION_BRIEF,
      ModelValue = new OptionBasicModel()
      {
        Market = Market.US,
        OptionBasic = new List<OptionCommonModel>()
          {
            new OptionCommonModel() {
              Symbol = "AAPL",
              Right = "CALL",
              Strike = "160.0",
              Expiry = DateUtil.ConvertTimestamp("2024-06-28", CustomTimeZone.NY_ZONE)
            }
          }
        //Market = Market.HK,
        //OptionBasic = new List<OptionCommonModel>()
        //{
        //  new OptionCommonModel() {
        //    Symbol = "TCH.HK",
        //    Right = "CALL",
        //    Strike = "370.0",
        //    Expiry = DateUtil.ConvertTimestamp("2024-06-27", CustomTimeZone.HK_ZONE)
        //  }
        //}
      }
    };
    return await quoteClient.ExecuteAsync(request);
  }

返回示例

{
    "data": [
        {
            "identifier": "AAPL  240628C00160000",
            "symbol": "AAPL",
            "strike": "160.0",
            "right": "call",
            "expiry": 1719547200000,
            "askPrice": 55.2,
            "askSize": 64,
            "bidPrice": 53.55,
            "bidSize": 68,
            "latestPrice": 51.9,
            "preClose": 51.15,
            "volume": 10,
            "high": 51.93,
            "low": 51.88,
            "open": 51.88,
            "openInterest": 20,
            "change": 0.75,
            "multiplier": 100,
            "volatility": "30.95%",
            "ratesBonds": 0.051339,
            "timestamp": 1719409873221
        }
    ],
    "code": 0,
    "message": "success",
    "timestamp": 1719417365466,
    "sign": "TAjVoq4HRzmvX8wx4GLcecd3y4qTQyEqO/QyrbZPnIsKI5fLEIbxXZHcSE+0F1u27ijC4Ct0txcupN7/6gHwQYw8Ca+SK1PrRJmLtzsbQyBaY1kbxQiWNHhvkmL6F/1shK2Gp3/WUcwPz7ZfqbAdmRlacuj7A+cWuRL9EO+lBYI="
}

获取期权K线

对应的请求类:TigerRequest(QuoteApiService.OPTION_KLINE)

说明

获取期权K线。批量参数上限为30

参数

参数类型是否必填描述
marketMarketyes市场,只支持US、HK
option_queryList<OptionKlineModel>yes期权K线查询条件列表,最大30

OptionKlineModel参数结构如下

参数类型是否必填描述
symbolstringyes股票代码
rightstringyes看多或看空(CALL/PUT)
expirylongyes到期时间
strikestringyes行权价
begin_timelongyes开始时间
end_timelongyes结束时间
periodstringnoK线类型,取值范围(day:日K,1min:1分钟,5min:5分钟,30min:30分钟,60min:60分钟)
limitintno分钟线返回最近记录数,默认300,最大1200。如果limit设置大于1200,只会返回1200条数据。日K线暂不支持
sort_dirstringno排序方向,包括:升序,降序,排序方向枚举:排序方向

返回TigerOpenAPI.Quote.Response.OptionKlineResponsesourceopen in new window

结构如下:

namespace TigerOpenAPI.Quote.Response
{
  public class OptionKlineResponse : TigerResponse
  {
    [JsonProperty(PropertyName = "data")]
    public List<OptionKlineItem> Data { get; set; }
  }
}

返回数据可通过OptionKlineResponse.Data属性访问,返回OptionKlineItem对象,其中TigerOpenAPI.Quote.Response.OptionKlineItem 属性如下:

名称类型说明
symbolstring股票代码
periodstring周期
rightstring看多或看空,取值CALL/PUT
strikestring行权价
expirylong到期时间,毫秒
itemsList<OptionKlinePoint>包含OptionKlinePoint的List,OptionKlinePoint为k线数组,包含的具体数据见下文

OptionKlinePoint对象属性如下:

名称类型说明
highdouble最高价
lowdouble最低价
opendouble开盘价
closedouble收盘价
timelongk线时间
volumeint成交量
openInterestint未平仓量(只有日K线有值)

具体字段可通过对象的属性,如OptionKlinePoint.Volume进行访问, 或通过对象的JsonConvert.SerializeObject()方法转换为字符串

示例

  static async Task<OptionKlineResponse?> GetOptionKLineV2Async(QuoteClient quoteClient)
  {
    TigerRequest<OptionKlineResponse> request = new TigerRequest<OptionKlineResponse>()
    {
      ApiMethodName = QuoteApiService.OPTION_KLINE,
      ModelValue = new OptionKlineV2Model()
      {
        Market = Market.US,
        OptionQuery = new List<OptionKlineModel>()
        {
          new OptionKlineModel() {
            Symbol = "AAPL", Right = "CALL", Strike = "170.0",
            Expiry = DateUtil.ConvertTimestamp("2024-06-28", CustomTimeZone.NY_ZONE),
            BeginTime = DateUtil.ConvertTimestamp("2024-06-24", CustomTimeZone.NY_ZONE),
            EndTime = DateUtil.ConvertTimestamp("2024-06-26", CustomTimeZone.NY_ZONE),
            Period = OptionKType.min60.Value,
            SortDir = SortDir.SortDir_Descend,
            Limit = 10
          }
        }
        //Market = Market.HK,
        //OptionQuery = new List<OptionKlineModel>()
        //{
        //  new OptionKlineModel() {
        //    Symbol = "TCH.HK", Right = "CALL", Strike = "370.0",
        //    Expiry = DateUtil.ConvertTimestamp("2024-06-27", CustomTimeZone.HK_ZONE),
        //    BeginTime = DateUtil.ConvertTimestamp("2024-05-22", CustomTimeZone.HK_ZONE),
        //    EndTime = DateUtil.ConvertTimestamp("2024-05-24", CustomTimeZone.HK_ZONE),
        //    Period = OptionKType.min60.Value,
        //    Limit = 300
        //  }
        //}
      }
    };
    return await quoteClient.ExecuteAsync(request);
  }

返回示例

{
    "data": [
        {
            "symbol": "AAPL",
            "strike": "170.0",
            "right": "CALL",
            "expiry": 1719547200000,
            "period": "60min",
            "items": [
                {
                    "openInterest": 0,
                    "open": 40.29,
                    "high": 40.29,
                    "low": 40.29,
                    "close": 40.29,
                    "volume": 0,
                    "amount": "NaN",
                    "time": 1719343800000
                },
                {
                    "openInterest": 0,
                    "open": 40.29,
                    "high": 40.29,
                    "low": 40.29,
                    "close": 40.29,
                    "volume": 0,
                    "amount": "NaN",
                    "time": 1719340200000
                },
                {
                    "openInterest": 0,
                    "open": 40.29,
                    "high": 40.29,
                    "low": 40.29,
                    "close": 40.29,
                    "volume": 0,
                    "amount": "NaN",
                    "time": 1719336600000
                },
                {
                    "openInterest": 0,
                    "open": 40.29,
                    "high": 40.29,
                    "low": 40.29,
                    "close": 40.29,
                    "volume": 0,
                    "amount": "NaN",
                    "time": 1719333000000
                },
                {
                    "openInterest": 0,
                    "open": 39.68,
                    "high": 40.29,
                    "low": 39.68,
                    "close": 40.29,
                    "volume": 26,
                    "amount": "NaN",
                    "time": 1719329400000
                },
                {
                    "openInterest": 0,
                    "open": 39.68,
                    "high": 39.68,
                    "low": 39.68,
                    "close": 39.68,
                    "volume": 0,
                    "amount": "NaN",
                    "time": 1719325800000
                },
                {
                    "openInterest": 0,
                    "open": 39.01,
                    "high": 39.97,
                    "low": 39.01,
                    "close": 39.68,
                    "volume": 4,
                    "amount": "NaN",
                    "time": 1719322200000
                },
                {
                    "openInterest": 0,
                    "open": 39.01,
                    "high": 39.01,
                    "low": 39.01,
                    "close": 39.01,
                    "volume": 0,
                    "amount": "NaN",
                    "time": 1719257400000
                },
                {
                    "openInterest": 0,
                    "open": 38.02,
                    "high": 39.68,
                    "low": 38.02,
                    "close": 39.01,
                    "volume": 4,
                    "amount": "NaN",
                    "time": 1719253800000
                },
                {
                    "openInterest": 0,
                    "open": 38.02,
                    "high": 38.02,
                    "low": 38.02,
                    "close": 38.02,
                    "volume": 0,
                    "amount": "NaN",
                    "time": 1719250200000
                }
            ]
        }
    ],
    "code": 0,
    "message": "success",
    "timestamp": 1719420174285,
    "sign": "Of/xzjYFjp/2BGyWf/kNEWV2GKSTie+OFBEoDjKxbSQH8bld9ffgi4Tg4UpDAVn/XDKm2LeiHLjolp7GGJKfVE0pHoy32zlxuw4qlLyv5FIUoZvKmikLDufOrmLvCKtQhymyp186ZZrDAaFWTMXTzG8cfClsKKUnuJybO/0+SaU="
}

获取期权逐笔成交

对应的请求类:TigerRequest(QuoteApiService.OPTION_TRADE_TICK)

说明

获取期权逐笔成交数据。只支持美国市场期权,批量参数上限为30

参数

参数类型是否必填描述
symbolstringyes股票代码
rightstringyes看多或看空(call/put)
expirylongyes到期时间(美国NewYork时间当天0点所对应的毫秒值)
strikestringyes行权价

返回TigerOpenAPI.Quote.Response.OptionTradeTickResponsesourceopen in new window

结构如下:

namespace TigerOpenAPI.Quote.Response
{
  public class OptionTradeTickResponse : TigerResponse
  {
    [JsonProperty(PropertyName = "data")]
    public List<OptionTradeTickItem> Data { get; set; }
  }
}

开盘前半小时可以取到前一个交易日的全部,开盘后是新一天的数据。

返回数据可通过OptionTradeTickResponse.Data属性访问,返回OptionTradeTickItem对象列表,其中TigerOpenAPI.Quote.Response.OptionTradeTickItem 属性如下:

名称类型说明
symbolstring标的股票代码
expirylong到期时间
strikestringstrike price
rightstringPUT或CALL
itemsList<TradeTickPoint>TradeTickPoint对象列表,每个TradeTickPoint对象对应单条逐笔成交数据

TradeTickPoint对象结构如下:

名称类型说明
pricedouble成交价格
timelong成交时间
volumelong成交量

具体字段可通过对象的属性,如TradeTickPoint.Price进行访问, 或通过对象的JsonConvert.SerializeObject()方法转换为字符串

示例

  static async Task<OptionTradeTickResponse?> GetOptionTradeTickAsync(QuoteClient quoteClient)
  {
    TigerRequest<OptionTradeTickResponse> request = new TigerRequest<OptionTradeTickResponse>()
    {
      ApiMethodName = QuoteApiService.OPTION_TRADE_TICK,
      ModelValue = new BatchApiModel<OptionCommonModel>()
      {
        Items = new List<OptionCommonModel>()
        {
          new OptionCommonModel() { Symbol = "AAPL", Right = "PUT", Strike = "100.0",
            Expiry = DateUtil.ConvertTimestamp("2023-03-17", CustomTimeZone.NY_ZONE)}
        }
      }
    };
    return await quoteClient.ExecuteAsync(request);
  }

返回示例

{
    "data":[
        {
            "symbol":"AAPL",
            "expiry":1679025600000,
            "strike":"100.0",
            "right":"put",
            "items":[
                {
                    "price":0.01,
                    "time":1677853806520,
                    "volume":5
                },
                {
                    "price":0.01,
                    "time":1677853807374,
                    "volume":1
                },
                {
                    "price":0.01,
                    "time":1677853820498,
                    "volume":1
                },
                {
                    "price":0.01,
                    "time":1677853865354,
                    "volume":2
                },
                {
                    "price":0.01,
                    "time":1677854154278,
                    "volume":100
                },
                {
                    "price":0.02,
                    "time":1677854599439,
                    "volume":1
                },
                {
                    "price":0.01,
                    "time":1677857196976,
                    "volume":3
                },
                {
                    "price":0.01,
                    "time":1677857351667,
                    "volume":5
                },
                {
                    "price":0.01,
                    "time":1677857720152,
                    "volume":5
                },
                {
                    "price":0.01,
                    "time":1677859305126,
                    "volume":4
                },
                {
                    "price":0.01,
                    "time":1677861301232,
                    "volume":1
                },
                {
                    "price":0.01,
                    "time":1677861593507,
                    "volume":3
                },
                {
                    "price":0.01,
                    "time":1677862023653,
                    "volume":5
                },
                {
                    "price":0.01,
                    "time":1677867442539,
                    "volume":1
                },
                {
                    "price":0.01,
                    "time":1677868578216,
                    "volume":1
                },
                {
                    "price":0.01,
                    "time":1677868660689,
                    "volume":1
                },
                {
                    "price":0.01,
                    "time":1677877019442,
                    "volume":10
                }
            ]
        }
    ],
    "code":0,
    "message":"success",
    "timestamp":1678107119497,
    "sign":"e3MV4FY+ddej+PZjeVSsxEzWJaIOg9jDQF7Zf38XTsAxrmpkDB7vGtTSHeM68klYZcqjTddn+fe4RWnf3ilQE5XEquiNlyBR5BaOPnmBJ2cP0PTy+4KS7oo9KxFeNjkOxnj1MoVq03+F0ex52vJDxBUxIcMA6TxxN2PMaJ33YFQ="
}

获取期权深度行情

对应的请求类:TigerRequest(QuoteApiService.OPTION_DEPTH)

说明

获取期权深度行情数据。只支持美国市场期权,批量参数上限为30

参数

参数类型是否必填描述
marketMarketyes市场,只支持US
option_basicList<OptionCommonModel>yes期权四要素列表,最大30

OptionCommonModel参数结构如下

参数类型是否必填描述
symbolstringyes股票代码
rightstringyes看多或看空(CALL/PUT)
expirylongyes到期时间(美国NewYork时间当天0点所对应的毫秒值)
strikestringyes行权价

返回TigerOpenAPI.Quote.Response.OptionDepthResponsesourceopen in new window

结构如下:

namespace TigerOpenAPI.Quote.Response
{
  public class OptionDepthResponse : TigerResponse
  {
    [JsonProperty(PropertyName = "data")]
    public List<OptionDepthItem> Data { get; set; }
  }
}

返回数据为盘中17个交易所的实时报价。 如果报价为0表示该交易所没有报价

返回数据可通过OptionDepthResponse.Data属性访问,返回OptionDepthItem对象列表,其中TigerOpenAPI.Quote.Response.OptionDepthItem 属性如下:

名称类型说明
symbolstring标的股票代码
expirylong到期时间
strikestringstrike price
rightstringPUT或CALL
timestamplong数据时间戳
askList<OptionDepthOrderBook>OptionDepthOrderBook对象列表,每个OptionDepthOrderBook对象对应期权交易所的卖盘挂单数据
bidList<OptionDepthOrderBook>OptionDepthOrderBook对象列表,每个OptionDepthOrderBook对象对应期权交易所的买盘挂单数据

OptionDepthOrderBook对象结构如下:

名称类型说明
pricedouble委托价
codestring期权交易所Code
timestamplong交易所时间
volumeint委托量

具体字段可通过对象的属性,如OptionDepthOrderBook.Price进行访问, 或通过对象的JsonConvert.SerializeObject()方法转换为字符串

示例

  static async Task<OptionDepthResponse?> GetOptionDepthAsync(QuoteClient quoteClient)
  {
    TigerRequest<OptionDepthResponse> request = new TigerRequest<OptionDepthResponse>()
    {
      ApiMethodName = QuoteApiService.OPTION_DEPTH,
      ModelValue = new OptionBasicModel()
      {
        Market = Market.US,
        OptionBasic = new List<OptionCommonModel>()
        {
          new OptionCommonModel() {
            Symbol = "AAPL",
            Right = "PUT",
            Strike = "210.0",
            Expiry = DateUtil.ConvertTimestamp("2024-06-28", CustomTimeZone.NY_ZONE)
          }
        }
      }
    };
    return await quoteClient.ExecuteAsync(request);
  }

返回示例

{
	"data": [{
		"symbol": null,
		"expiry": 1719547200000,
		"strike": "210.0",
		"right": "PUT",
		"timestamp": 1719345602509,
		"ask": [{
			"price": 2.15,
			"code": "BX",
			"timestamp": 1719345599997,
			"volume": 1,
			"count": 0
		},
		{
			"price": 2.16,
			"code": "EDGX",
			"timestamp": 1719345599683,
			"volume": 1,
			"count": 0
		},
		{
			"price": 2.2,
			"code": "MPRL",
			"timestamp": 1719345599915,
			"volume": 4,
			"count": 0
		},
		{
			"price": 2.23,
			"code": "BOX",
			"timestamp": 1719345599997,
			"volume": 19,
			"count": 0
		},
		{
			"price": 2.23,
			"code": "ARCA",
			"timestamp": 1719345600003,
			"volume": 5,
			"count": 0
		},
		{
			"price": 2.23,
			"code": "AMEX",
			"timestamp": 1719345600003,
			"volume": 1,
			"count": 0
		},
		{
			"price": 2.34,
			"code": "BZX",
			"timestamp": 1719345599973,
			"volume": 1,
			"count": 0
		},
		{
			"price": 2.34,
			"code": "CBOE",
			"timestamp": 1719345599915,
			"volume": 1,
			"count": 0
		},
		{
			"price": 2.35,
			"code": "NSDQ",
			"timestamp": 1719345599943,
			"volume": 13,
			"count": 0
		},
		{
			"price": 2.35,
			"code": "GEM",
			"timestamp": 1719345599973,
			"volume": 5,
			"count": 0
		},
		{
			"price": 2.39,
			"code": "MIAX",
			"timestamp": 1719345599991,
			"volume": 6,
			"count": 0
		},
		{
			"price": 2.39,
			"code": "EMLD",
			"timestamp": 1719345600003,
			"volume": 1,
			"count": 0
		},
		{
			"price": 2.95,
			"code": "ISE",
			"timestamp": 1719345599997,
			"volume": 1,
			"count": 0
		},
		{
			"price": 2.95,
			"code": "PHLX",
			"timestamp": 1719345599985,
			"volume": 1,
			"count": 0
		},
		{
			"price": 4.2,
			"code": "C2",
			"timestamp": 1719345599997,
			"volume": 1,
			"count": 0
		},
		{
			"price": 5.0,
			"code": "MCRY",
			"timestamp": 1719345599883,
			"volume": 2,
			"count": 0
		},
		{
			"price": 0.0,
			"code": "MEMX",
			"timestamp": 1719345602509,
			"volume": 0,
			"count": 0
		}],
		"bid": [{
			"price": 2.14,
			"code": "MPRL",
			"timestamp": 1719345599915,
			"volume": 216,
			"count": 0
		},
		{
			"price": 2.14,
			"code": "NSDQ",
			"timestamp": 1719345599943,
			"volume": 26,
			"count": 0
		},
		{
			"price": 2.14,
			"code": "BOX",
			"timestamp": 1719345599997,
			"volume": 21,
			"count": 0
		},
		{
			"price": 2.14,
			"code": "MIAX",
			"timestamp": 1719345599991,
			"volume": 6,
			"count": 0
		},
		{
			"price": 2.14,
			"code": "ISE",
			"timestamp": 1719345599997,
			"volume": 2,
			"count": 0
		},
		{
			"price": 2.13,
			"code": "BZX",
			"timestamp": 1719345599973,
			"volume": 51,
			"count": 0
		},
		{
			"price": 2.13,
			"code": "AMEX",
			"timestamp": 1719345600003,
			"volume": 1,
			"count": 0
		},
		{
			"price": 2.11,
			"code": "BX",
			"timestamp": 1719345599997,
			"volume": 30,
			"count": 0
		},
		{
			"price": 2.04,
			"code": "CBOE",
			"timestamp": 1719345599915,
			"volume": 9,
			"count": 0
		},
		{
			"price": 2.04,
			"code": "ARCA",
			"timestamp": 1719345600003,
			"volume": 4,
			"count": 0
		},
		{
			"price": 2.03,
			"code": "PHLX",
			"timestamp": 1719345599985,
			"volume": 3,
			"count": 0
		},
		{
			"price": 2.03,
			"code": "EMLD",
			"timestamp": 1719345600003,
			"volume": 2,
			"count": 0
		},
		{
			"price": 1.8,
			"code": "EDGX",
			"timestamp": 1719345599683,
			"volume": 14,
			"count": 0
		},
		{
			"price": 1.04,
			"code": "C2",
			"timestamp": 1719345599997,
			"volume": 18,
			"count": 0
		},
		{
			"price": 1.04,
			"code": "GEM",
			"timestamp": 1719345599973,
			"volume": 1,
			"count": 0
		},
		{
			"price": 0.1,
			"code": "MCRY",
			"timestamp": 1719345599883,
			"volume": 1,
			"count": 0
		},
		{
			"price": 0.0,
			"code": "MEMX",
			"timestamp": 1719345602509,
			"volume": 0,
			"count": 0
		}]
	}],
	"code": 0,
	"message": "success",
	"timestamp": 1719394567997,
	"sign": "piYFgsldPci3TUrKUMHojkLr3PC3Ehx5lq89L6fR2MtIe+7ed+ZCiFEuO6rAvb4UKdIKRt51ZQDqTUayqmFPO0kbjwn+fK0/XcgZ9a2U939gezkkzhzZ/1xfxx55uvsyehP5TYxt541IX3nZYHmKTbrviy7mI5KJPURDBqlx6yk="
}

获取港股期权名称

对应的请求类:TigerRequest(QuoteApiService.ALL_HK_OPTION_SYMBOLS)

说明

获取港股期权标的名称列表。只支持香港市场

参数

参数类型是否必填描述
marketMarketyes市场,只支持HK
langstringNo语言支持: zh_CN,zh_TW,en_US, 默认: en_US

返回TigerOpenAPI.Quote.Response.OptionSymbolResponsesourceopen in new window

结构如下:

namespace TigerOpenAPI.Quote.Response
{
  public class OptionSymbolResponse : TigerResponse
  {
    [JsonProperty(PropertyName = "data")]
    public List<OptionSymbolItem> Data { get; set; }
  }
}

返回香港市场所有期权的symbol代码及底层资产标的集合

返回数据可通过OptionSymbolResponse.Data属性访问,返回OptionSymbolItem对象列表,其中TigerOpenAPI.Quote.Response.OptionSymbolItem 属性如下:

名称类型说明
symbolstring期权四要素的symbol
namestring标的名称
underlyingSymbolstring底层资产标的代码

具体字段可通过对象的属性,如OptionSymbolItem.Symbol进行访问, 或通过对象的JsonConvert.SerializeObject()方法转换为字符串

示例

  static async Task<OptionSymbolResponse?> GetHKOptionSymbolsAsync(QuoteClient quoteClient)
  {
    TigerRequest<OptionSymbolResponse> request = new TigerRequest<OptionSymbolResponse>()
    {
      ApiMethodName = QuoteApiService.ALL_HK_OPTION_SYMBOLS,
      ModelValue = new OptionModel()
      {
        Market = Market.HK,
        Lang = Language.en_US
      }
    };
    return await quoteClient.ExecuteAsync(request);
  }

返回示例

{"data":[{"symbol":"ALC.HK","name":"ALC","underlyingSymbol":"02600"},{"symbol":"CRG.HK","name":"CRG","underlyingSymbol":"00390"},{"symbol":"PAI.HK","name":"PAI","underlyingSymbol":"02318"},{"symbol":"XCC.HK","name":"XCC","underlyingSymbol":"00939"},{"symbol":"XTW.HK","name":"XTW","underlyingSymbol":"00788"},{"symbol":"SHL.HK","name":"SHL","underlyingSymbol":"00968"},{"symbol":"GHL.HK","name":"GHL","underlyingSymbol":"00868"},{"symbol":"HEX.HK","name":"HEX","underlyingSymbol":"00388"},{"symbol":"ACC.HK","name":"ACC","underlyingSymbol":"00914"},{"symbol":"STC.HK","name":"STC","underlyingSymbol":"02888"},{"symbol":"VNK.HK","name":"VNK","underlyingSymbol":"02202"},{"symbol":"CLI.HK","name":"CLI","underlyingSymbol":"02628"},{"symbol":"LNK.HK","name":"LNK","underlyingSymbol":"00823"},{"symbol":"SMC.HK","name":"SMC","underlyingSymbol":"00981"},{"symbol":"BEA.HK","name":"BEA","underlyingSymbol":"00023"},{"symbol":"TRP.HK","name":"TRP","underlyingSymbol":"09961"},{"symbol":"GWM.HK","name":"GWM","underlyingSymbol":"02333"},{"symbol":"NBM.HK","name":"NBM","underlyingSymbol":"03323"},{"symbol":"ANA.HK","name":"ANA","underlyingSymbol":"02020"},{"symbol":"CMB.HK","name":"CMB","underlyingSymbol":"03968"},{"symbol":"HNP.HK","name":"HNP","underlyingSymbol":"00902"},{"symbol":"HEH.HK","name":"HEH","underlyingSymbol":"00006"},{"symbol":"MET.HK","name":"MET","underlyingSymbol":"03690"},{"symbol":"SHZ.HK","name":"SHZ","underlyingSymbol":"02313"},{"symbol":"SNP.HK","name":"SNP","underlyingSymbol":"01099"},{"symbol":"INB.HK","name":"INB","underlyingSymbol":"01801"},{"symbol":"CRL.HK","name":"CRL","underlyingSymbol":"01109"},{"symbol":"ALH.HK","name":"ALH","underlyingSymbol":"00241"},{"symbol":"AAC.HK","name":"AAC","underlyingSymbol":"02018"},{"symbol":"WWC.HK","name":"WWC","underlyingSymbol":"00151"},{"symbol":"CTB.HK","name":"CTB","underlyingSymbol":"00998"},{"symbol":"NWD.HK","name":"NWD","underlyingSymbol":"00017"},{"symbol":"HSB.HK","name":"HSB","underlyingSymbol":"00011"},{"symbol":"LEN.HK","name":"LEN","underlyingSymbol":"00992"},{"symbol":"COS.HK","name":"COS","underlyingSymbol":"01919"},{"symbol":"HDO.HK","name":"HDO","underlyingSymbol":"06862"},{"symbol":"BOC.HK","name":"BOC","underlyingSymbol":"02388"},{"symbol":"CSA.HK","name":"CSA","underlyingSymbol":"02822"},{"symbol":"XAB.HK","name":"XAB","underlyingSymbol":"01288"},{"symbol":"CKH.HK","name":"CKH","underlyingSymbol":"00001"},{"symbol":"MIU.HK","name":"MIU","underlyingSymbol":"01810"},{"symbol":"AIR.HK","name":"AIR","underlyingSymbol":"00753"},{"symbol":"CKP.HK","name":"CKP","underlyingSymbol":"01113"},{"symbol":"CHU.HK","name":"CHU","underlyingSymbol":"00762"},{"symbol":"GLI.HK","name":"GLI","underlyingSymbol":"01772"},{"symbol":"LNI.HK","name":"LNI","underlyingSymbol":"02331"},{"symbol":"LAU.HK","name":"LAU","underlyingSymbol":"02015"},{"symbol":"BYD.HK","name":"BYD","underlyingSymbol":"01211"},{"symbol":"ZSH.HK","name":"ZSH","underlyingSymbol":"00881"},{"symbol":"CGN.HK","name":"CGN","underlyingSymbol":"01816"},{"symbol":"MOL.HK","name":"MOL","underlyingSymbol":"03993"},{"symbol":"CPA.HK","name":"CPA","underlyingSymbol":"00293"},{"symbol":"KLE.HK","name":"KLE","underlyingSymbol":"00135"},{"symbol":"CPI.HK","name":"CPI","underlyingSymbol":"02601"},{"symbol":"CTC.HK","name":"CTC","underlyingSymbol":"00728"},{"symbol":"MTR.HK","name":"MTR","underlyingSymbol":"00066"},{"symbol":"PEC.HK","name":"PEC","underlyingSymbol":"00857"},{"symbol":"PEN.HK","name":"PEN","underlyingSymbol":"09868"},{"symbol":"MEN.HK","name":"MEN","underlyingSymbol":"02319"},{"symbol":"TCH.HK","name":"TCH","underlyingSymbol":"00700"},{"symbol":"SUN.HK","name":"SUN","underlyingSymbol":"01918"},{"symbol":"PHT.HK","name":"PHT","underlyingSymbol":"01833"},{"symbol":"CTS.HK","name":"CTS","underlyingSymbol":"06030"},{"symbol":"BCM.HK","name":"BCM","underlyingSymbol":"03328"},{"symbol":"A50.HK","name":"A50","underlyingSymbol":"02823"},{"symbol":"RFP.HK","name":"RFP","underlyingSymbol":"02777"},{"symbol":"COL.HK","name":"COL","underlyingSymbol":"00688"},{"symbol":"CDA.HK","name":"CDA","underlyingSymbol":"01359"},{"symbol":"BYE.HK","name":"BYE","underlyingSymbol":"00285"},{"symbol":"JDH.HK","name":"JDH","underlyingSymbol":"06618"},{"symbol":"CCE.HK","name":"CCE","underlyingSymbol":"01898"},{"symbol":"CRC.HK","name":"CRC","underlyingSymbol":"01186"},{"symbol":"HCF.HK","name":"HCF","underlyingSymbol":"02828"},{"symbol":"HKG.HK","name":"HKG","underlyingSymbol":"00003"},{"symbol":"XBC.HK","name":"XBC","underlyingSymbol":"03988"},{"symbol":"XPB.HK","name":"XPB","underlyingSymbol":"01658"},{"symbol":"WEB.HK","name":"WEB","underlyingSymbol":"09898"},{"symbol":"GAH.HK","name":"GAH","underlyingSymbol":"00175"},{"symbol":"CPC.HK","name":"CPC","underlyingSymbol":"00386"},{"symbol":"EVG.HK","name":"EVG","underlyingSymbol":"03333"},{"symbol":"PIC.HK","name":"PIC","underlyingSymbol":"02328"},{"symbol":"SAN.HK","name":"SAN","underlyingSymbol":"01928"},{"symbol":"BUD.HK","name":"BUD","underlyingSymbol":"01876"},{"symbol":"HKB.HK","name":"HKB","underlyingSymbol":"00005"},{"symbol":"MGM.HK","name":"MGM","underlyingSymbol":"02282"},{"symbol":"CHT.HK","name":"CHT","underlyingSymbol":"00941"},{"symbol":"PIN.HK","name":"PIN","underlyingSymbol":"01339"},{"symbol":"XIC.HK","name":"XIC","underlyingSymbol":"01398"},{"symbol":"GAC.HK","name":"GAC","underlyingSymbol":"02238"},{"symbol":"KDS.HK","name":"KDS","underlyingSymbol":"00268"},{"symbol":"COG.HK","name":"COG","underlyingSymbol":"02007"},{"symbol":"SBO.HK","name":"SBO","underlyingSymbol":"01177"},{"symbol":"WHL.HK","name":"WHL","underlyingSymbol":"00004"},{"symbol":"CSE.HK","name":"CSE","underlyingSymbol":"01088"},{"symbol":"SET.HK","name":"SET","underlyingSymbol":"00020"},{"symbol":"SWA.HK","name":"SWA","underlyingSymbol":"00019"},{"symbol":"ZJM.HK","name":"ZJM","underlyingSymbol":"02899"},{"symbol":"MSB.HK","name":"MSB","underlyingSymbol":"01988"},{"symbol":"GLX.HK","name":"GLX","underlyingSymbol":"00027"},{"symbol":"DFM.HK","name":"DFM","underlyingSymbol":"00489"},{"symbol":"CIT.HK","name":"CIT","underlyingSymbol":"00267"},{"symbol":"CNC.HK","name":"CNC","underlyingSymbol":"00883"},{"symbol":"BIU.HK","name":"BIU","underlyingSymbol":"09888"},{"symbol":"CCC.HK","name":"CCC","underlyingSymbol":"01800"},{"symbol":"HGN.HK","name":"HGN","underlyingSymbol":"01044"},{"symbol":"NTE.HK","name":"NTE","underlyingSymbol":"09999"},{"symbol":"SNO.HK","name":"SNO","underlyingSymbol":"02382"},{"symbol":"TRF.HK","name":"TRF","underlyingSymbol":"02800"},{"symbol":"HAI.HK","name":"HAI","underlyingSymbol":"06837"},{"symbol":"WHG.HK","name":"WHG","underlyingSymbol":"00288"},{"symbol":"HLD.HK","name":"HLD","underlyingSymbol":"00012"},{"symbol":"CSP.HK","name":"CSP","underlyingSymbol":"01093"},{"symbol":"KSO.HK","name":"KSO","underlyingSymbol":"03888"},{"symbol":"YZC.HK","name":"YZC","underlyingSymbol":"01171"},{"symbol":"SHK.HK","name":"SHK","underlyingSymbol":"00016"},{"symbol":"JXC.HK","name":"JXC","underlyingSymbol":"00358"},{"symbol":"ALB.HK","name":"ALB","underlyingSymbol":"09988"},{"symbol":"BLI.HK","name":"BLI","underlyingSymbol":"09626"},{"symbol":"CLP.HK","name":"CLP","underlyingSymbol":"00002"},{"symbol":"ZAO.HK","name":"ZAO","underlyingSymbol":"06060"},{"symbol":"JDC.HK","name":"JDC","underlyingSymbol":"09618"},{"symbol":"NFU.HK","name":"NFU","underlyingSymbol":"09633"},{"symbol":"AIA.HK","name":"AIA","underlyingSymbol":"01299"},{"symbol":"KST.HK","name":"KST","underlyingSymbol":"01024"},{"symbol":"NCL.HK","name":"NCL","underlyingSymbol":"01336"},{"symbol":"TIC.HK","name":"TIC","underlyingSymbol":"00669"},{"symbol":"WXB.HK","name":"WXB","underlyingSymbol":"02269"},{"symbol":"AMC.HK","name":"AMC","underlyingSymbol":"03188"}],"code":0,"message":"success","timestamp":1719403742527,"sign":"E7n8MHnVK6rY6N4kPqI7VaErBLIvqVSjukki00zabPmq1o42/pvv2k6IQXOWX8PomddpOhneeHY4J9INaiGIPG9nRHP1pYwFPUxdjd4mvLGk9Ynyf8lBNO+7ZL+dT7kd0YXgzk8dq5xfNIU4TbmelIAA6oK9YTNZs9zQpsmLjv0="}

期权指标计算

说明

计算所选期权的各类指标

参数

参数类型是否必填描述
clientobjectyesSDK QuoteClient
symbolstringyes股票代码
rightstringyes看多或看空(CALL/PUT)
strikestringyes行权价
expirylongyes到期时间(美国NewYork时间当天0点所对应的毫秒值)
underlyingSymbolstringno底层次产标的,默认为symbol的值

返回

名称类型说明
deltadouble希腊字母delta
gammadouble希腊字母gamma
thetadouble希腊字母theta
vegadouble希腊字母vega
insideValuedouble内在价值
timeValuedouble时间价值
leveragedouble杠杆率
openInterestint未平仓量
historyVolatilitydouble历史波动率,百分比数值
premiumRatedouble溢价率,百分比数值
profitRatedouble买入盈利率,百分比数值
volatilitydouble隐含波动率,百分比数值

示例

OptionFundamentals? optionFundamentals = OptionCalcUtil.GetOptionFundamentals(
          quoteClient, "TSLA", "CALL", "255.0", "2023-08-11");
ApiLogger.Info("response:" + JsonConvert.SerializeObject(optionFundamentals));

返回示例

{
    "delta":0.5035072708197293,
    "gamma":0.02147811316468654,
    "theta":-0.3935812692492685,
    "vega":0.16664060027998048,
    "rho":3.263976913948943,
    "predictedValue":0,
    "timeValue":6.975,
    "premiumRate":3.09511628822164, //百分比形式,表示为 3.095%
    "profitRate":34.57023177182204, //百分比形式,表示为 34.57%
    "volatility":44.464111328125,  //百分比形式,表示为 44.46%
    "leverage":18.343545890752896,
    "insideValue":0,
    "historyVolatility":48.78, //百分比形式,表示为 48.78%
    "openInterest":614
}
上次编辑于: