期权

获取期权到期日

功能说明

获取多个标的的期权到期日。

方法签名

func (c *QuoteClient) GetOptionExpiration(symbols []string) ([]model.OptionExpiration, error)

参数

参数类型必填SDK 默认值约束
symbols[]string标的代码列表;SDK 不设置批量上限

返回

([]model.OptionExpiration, error)。关键字段来自 model.OptionExpiration

字段类型JSON 字段
Symbolstringsymbol
OptionSymbols[]stringoptionSymbols
Dates[]stringdates
Timestamps[]int64timestamps
Periods[]stringperiods
Counts[]intcounts

示例

result, err := qc.GetOptionExpiration([]string{"AAPL"})
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%#v\n", result)

返回示例

[
  {
    "symbol": "AAPL",
    "optionSymbols": ["AAPL"],
    "dates": ["2025-08-08", "2025-08-15", "2025-08-22", "2025-09-19", "2025-10-17"],
    "timestamps": [1786392000000, 1786996800000, 1787601600000, 1789988400000, 1792407600000],
    "periods": ["weekly", "weekly", "weekly", "monthly", "monthly"],
    "counts": [120, 150, 80, 200, 180]
  }
]

指数期权的特殊代码

  • 标普 500(.SPX):月度期权符号为 SPX,周期权和季度期权为 SPXW
  • 纳斯达克 100:月度期权为 NDX,周期权为 NDXP
  • VIX 指数:月度期权为 VIX,周期权为 VIXW

获取期权链

功能说明

获取多组(标的, 到期日)的期权链。

方法签名

func (c *QuoteClient) GetOptionChain(items [][2]string) ([]model.OptionChain, error)

参数

参数类型必填SDK 默认值约束
items[][2]string每项为 [标的代码, YYYY-MM-DD]

返回

([]model.OptionChain, error)。关键字段来自 model.OptionChain

字段类型JSON 字段
Symbolstringsymbol
Expiryint64expiry
Items[]OptionChainRowitems

示例

result, err := qc.GetOptionChain([][2]string{{"AAPL", "2026-06-19"}})
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%#v\n", result)

返回示例

[
  {
    "symbol": "AAPL",
    "expiry": 1786996800000,
    "items": [
      {
        "call": {
          "identifier": "AAPL  250815C00300000",
          "strike": "300",
          "right": "CALL",
          "bidPrice": 13.15,
          "bidSize": 80,
          "askPrice": 13.35,
          "askSize": 50,
          "volume": 5432,
          "latestPrice": 13.25,
          "openInterest": 12345
        },
        "put": {
          "identifier": "AAPL  250815P00300000",
          "strike": "300",
          "right": "PUT",
          "bidPrice": 4.40,
          "bidSize": 60,
          "askPrice": 4.60,
          "askSize": 45,
          "volume": 3210,
          "latestPrice": 4.50,
          "openInterest": 8765
        }
      }
    ]
  }
]

获取期权行情

功能说明

获取指定期权合约的行情。

方法签名

func (c *QuoteClient) GetOptionQuote(identifiers []string) ([]model.Brief, error)

参数

参数类型必填SDK 默认值约束
identifiers[]stringOCC 格式期权标识符;格式错误在发送前返回错误

返回

([]model.Brief, error)。关键字段来自 model.Brief

字段类型JSON 字段
Symbolstringsymbol
Openfloat64open
Highfloat64high
Lowfloat64low
Closefloat64close
PreClosefloat64preClose
LatestPricefloat64latestPrice
LatestTimeint64latestTime
AskPricefloat64askPrice
AskSizeint64askSize
BidPricefloat64bidPrice
BidSizeint64bidSize
Volumeint64volume
Statusstringstatus
Expiryint64expiry
Strikestringstrike
Rightstringright
Multiplierintmultiplier
OpenInterestint64openInterest

示例

result, err := qc.GetOptionQuote([]string{"AAPL 260619C00200000"})
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%#v\n", result)

返回示例

[
  {
    "symbol": "AAPL",
    "open": 12.50,
    "high": 14.80,
    "low": 11.90,
    "close": 13.25,
    "preClose": 11.80,
    "latestPrice": 13.25,
    "latestTime": 1785528000000,
    "askPrice": 13.35,
    "askSize": 50,
    "bidPrice": 13.15,
    "bidSize": 80,
    "volume": 5432,
    "status": "NORMAL",
    "expiry": 1786996800000,
    "strike": "300",
    "right": "CALL",
    "multiplier": 100,
    "openInterest": 12345
  }
]

获取期权 K 线

功能说明

获取期权 K 线数据。

方法签名

func (c *QuoteClient) GetOptionKline(identifiers []string, period string) ([]model.Kline, error)

参数

参数类型必填SDK 默认值约束
identifiers[]stringOCC 格式期权标识符;格式错误在发送前返回错误
periodstringK 线周期;见 BarPeriod 枚举

返回

([]model.Kline, error)。关键字段来自 model.Kline

字段类型JSON 字段
Symbolstringsymbol
Periodstringperiod
NextPageTokenstringnextPageToken
Items[]KlineItemitems

示例

result, err := qc.GetOptionKline([]string{"AAPL 260619C00200000"}, "day")
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%#v\n", result)

返回示例

[
  {
    "symbol": "AAPL  250815C00300000",
    "period": "day",
    "nextPageToken": null,
    "items": [
      {"time": 1785384000000, "volume": 3200, "open": 11.80, "close": 12.50, "high": 12.90, "low": 11.50, "amount": 0},
      {"time": 1785470400000, "volume": 5432, "open": 12.50, "close": 13.25, "high": 14.80, "low": 11.90, "amount": 0}
    ]
  }
]

获取期权逐笔

功能说明

期权逐笔成交。

方法签名

func (c *QuoteClient) GetOptionTradeTicks(req model.OptionTradeTicksRequest) ([]model.TradeTick, error)

参数

model.OptionTradeTicksRequest

参数类型必填默认值说明
Langstring空值省略无;可选值:zh_CN, zh_TW, en_US

返回

([]model.TradeTick, error)。关键字段来自 model.TradeTick

字段类型JSON 字段
Symbolstringsymbol
BeginIndexint64beginIndex
EndIndexint64endIndex
Items[]TradeTickItemitems

示例

result, err := qc.GetOptionTradeTicks(model.OptionTradeTicksRequest{
	Contracts: []model.OptionQueryItem{{Symbol: "AAPL", Expiry: 1781827200000, Strike: "200", Right: "CALL"}},
	Lang: "en_US",
})
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%#v\n", result)

返回示例

[
  {
    "symbol": "AAPL  250815C00300000",
    "beginIndex": 1200,
    "endIndex": 1202,
    "items": [
      {"time": 1785527980000, "volume": 10, "price": 13.20, "type": "+"},
      {"time": 1785527985000, "volume": 5, "price": 13.25, "type": "-"}
    ]
  }
]

获取期权分时

功能说明

期权分时。

方法签名

func (c *QuoteClient) GetOptionTimeline(req model.OptionTimelineRequest) ([]model.Timeline, error)

参数

model.OptionTimelineRequest

参数类型必填默认值说明
Marketstring空值省略无;可选值:ALL, US, HK, CN, SG
Langstring空值省略无;可选值:zh_CN, zh_TW, en_US

返回

([]model.Timeline, error)。关键字段来自 model.Timeline

字段类型JSON 字段
Symbolstringsymbol
Periodstringperiod
PreClosefloat64preClose
Intraday*TimelineBucketintraday
PreHours*TimelineBucketpreHours
AfterHours*TimelineBucketafterHours

示例

result, err := qc.GetOptionTimeline(model.OptionTimelineRequest{
	OptionQuery: []model.OptionQueryItem{{Symbol: "AAPL", Expiry: 1781827200000, Strike: "200", Right: "CALL"}},
	Market: "US",
	Lang: "en_US",
})
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%#v\n", result)

返回示例

[
  {
    "symbol": "AAPL  250815C00300000",
    "period": "day",
    "preClose": 11.80,
    "intraday": {
      "items": [
        {"time": 1785504600000, "price": 12.50, "avgPrice": 12.50, "volume": 120},
        {"time": 1785504660000, "price": 12.65, "avgPrice": 12.57, "volume": 85},
        {"time": 1785504720000, "price": 12.45, "avgPrice": 12.53, "volume": 200}
      ]
    },
    "preHours": null,
    "afterHours": null
  }
]

获取期权深度

功能说明

期权盘口深度。

方法签名

func (c *QuoteClient) GetOptionDepth(req model.OptionDepthRequest) ([]model.Depth, error)

参数

model.OptionDepthRequest

参数类型必填默认值说明
Marketstring空值省略无;可选值:ALL, US, HK, CN, SG
Langstring空值省略无;可选值:zh_CN, zh_TW, en_US

返回

([]model.Depth, error)。关键字段来自 model.Depth

字段类型JSON 字段
Symbolstringsymbol
Asks[]DepthLevelasks
Bids[]DepthLevelbids

示例

result, err := qc.GetOptionDepth(model.OptionDepthRequest{
	OptionBasic: []model.OptionQueryItem{{Symbol: "AAPL", Expiry: 1781827200000, Strike: "200", Right: "CALL"}},
	Market: "US",
	Lang: "en_US",
})
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%#v\n", result)

返回示例

[
  {
    "symbol": "AAPL  250815C00300000",
    "asks": [
      {"price": 13.35, "volume": 50, "count": 0},
      {"price": 13.40, "volume": 120, "count": 0}
    ],
    "bids": [
      {"price": 13.15, "volume": 80, "count": 0},
      {"price": 13.10, "volume": 150, "count": 0}
    ]
  }
]

获取期权代码

功能说明

期权代码列表。

方法签名

func (c *QuoteClient) GetOptionSymbols(req model.OptionSymbolsRequest) ([]model.OptionSymbol, error)

参数

model.OptionSymbolsRequest

参数类型必填默认值说明
Marketstring空值省略无;可选值:ALL, US, HK, CN, SG
Langstring空值省略无;可选值:zh_CN, zh_TW, en_US

返回

([]model.OptionSymbol, error)。关键字段来自 model.OptionSymbol

字段类型JSON 字段
Symbolstringsymbol
Marketstringmarket
NameCNstringnameCN
NameENstringnameEN

示例

result, err := qc.GetOptionSymbols(model.OptionSymbolsRequest{
	Market: "US",
	Lang: "en_US",
})
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%#v\n", result)

返回示例

[
  {"symbol": "AAPL", "market": "US", "nameCN": "苹果", "nameEN": "Apple Inc"},
  {"symbol": "MSFT", "market": "US", "nameCN": "微软", "nameEN": "Microsoft Corp"},
  {"symbol": "GOOGL", "market": "US", "nameCN": "谷歌", "nameEN": "Alphabet Inc"}
]

获取期权分析

功能说明

期权分析(隐含/历史波动率)。

方法签名

func (c *QuoteClient) GetOptionAnalysis(req model.OptionAnalysisRequest) ([]model.OptionAnalysis, error)

参数

model.OptionAnalysisRequest

参数类型必填默认值说明
Marketstring空值省略无;可选值:ALL, US, HK, CN, SG
Periodstring空值省略无;OptionAnalysisPeriod;可选值:day, week, month, year, 1min, 5min, 15min, 30min, 60min
Langstring空值省略无;可选值:zh_CN, zh_TW, en_US

返回

([]model.OptionAnalysis, error)。关键字段来自 model.OptionAnalysis

字段类型JSON 字段
Symbolstringsymbol
ImpliedVol30Daysfloat64impliedVol30Days
HisVolatilityfloat64hisVolatility
IvHisVRatiofloat64ivHisVRatio
CallPutRatiofloat64callPutRatio
ImpliedVolMetric*ImpliedVolMetricimpliedVolMetric
VolatilityList[]OptionVolatilityPointvolatilityList

示例

result, err := qc.GetOptionAnalysis(model.OptionAnalysisRequest{
	Symbols: []string{"AAPL"},
	Market: "US",
	Period: "day",
	Lang: "en_US",
})
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%#v\n", result)

返回示例

[
  {
    "symbol": "AAPL",
    "impliedVol30Days": 0.32,
    "hisVolatility": 0.28,
    "ivHisVRatio": 1.14,
    "callPutRatio": 1.85,
    "impliedVolMetric": {
      "period": "year",
      "percentile": 0.45,
      "rank": 0.52
    },
    "volatilityList": [
      {"timestamp": 1785384000000, "impliedVol": 0.31, "hisVolatility": 0.27, "percentile": 0.42, "rank": 0.50},
      {"timestamp": 1785470400000, "impliedVol": 0.32, "hisVolatility": 0.28, "percentile": 0.45, "rank": 0.52}
    ]
  }
]


Did this page help you?