跳到主要内容

更新日期: 2026 年 7 月 24 日

API 更新日志

OptionData 数据 API(市场结构、期权链、实时 WebSocket、历史 SQL)的架构与接口变更记录。破坏性变更已标注。

当前的请求/响应架构请查看各产品页面: 期权链 · 市场结构 · 历史 SQL · 实时

  1. 新增市场结构2026 年 7 月 24 日

    市场结构 API v1

    新增规范化完整期权链标的快照,用于 GEX、Gamma Flip、Max Pain、波动率背景与策略分析。

    • 新增端点:GET /api/v1/market-structure/:symbol。使用 Authorization: Bearer YOUR_API_KEY 认证;添加 date=YYYY-MM-DD 可读取保留的历史快照。
    • 自包含的 data/meta 响应包括精确期权根代码按行权价与到期日的看涨/看跌 GEX、GEX/OI 墙、按范围计算的 Gamma Flip 与 Max Pain,以及最新成交资金流覆盖数据。
    • 标的元数据完整内嵌:标的类型、名称、交易所、板块、市值、股本、财报、价格、平均成交量、历史波动率、IV30、IV Rank/Percentile、偏斜、蝶式与期限斜率。
    • 看跌 GEX 使用负号。净 GEX、总 GEX、看跌/看涨比率与 Gamma 状态可由行权价数据推导,因此不会在响应中重复存储。
  2. 变更期权链破坏性2026 年 7 月 9 日

    精简期权链响应结构

    破坏性变更:成功响应现在使用 { data, meta: { trading_date, as_of } },错误响应使用 { error: { code, message } }。

    • meta.trading_date 表示响应对应的市场交易日。meta.as_of 表示响应中最新的数据更新时间,格式为 UTC ISO 8601;时间不可用时可为 null。
    • 合约行移除了 symbol、expiry_days 和 mark。close 更名为 last_price;strike 与 expiration_date 现在为非空字段。
    • 响应中移除了 status、api_version、beta、notice、entitlement、source、returned、filters 和 statistics。生产端点同时移除了 test_mode 请求参数。
    • 错误响应现在提供稳定的 code 与 message。错误代码包括 INVALID_REQUEST、UNAUTHORIZED、SUBSCRIPTION_REQUIRED、REQUEST_TOO_BROAD、RATE_LIMITED、INTERNAL_ERROR 和 QUERY_TIMEOUT。
    • 迁移方式:直接读取 data,不再检查 status === "SUCCESS";将 meta.date 替换为 meta.trading_date,并将 close 替换为 last_price
    • 超过完整期权链响应保护上限的请求会返回 HTTP 422 和 REQUEST_TOO_BROAD,而不是返回部分数据。
  3. 变更历史 SQL2026 年 7 月 3 日

    查询防护加固

    历史 SQL 校验器现会拒绝更多此前可绕过表白名单的查询写法。

    • Comma-separated (implicit cross) joins such as FROM RawOptionTrades, other are now rejected.
    • Database-qualified table names are rejected unless the database matches the configured CLICKHOUSE_DATABASE.
    • Table-function bypasses (e.g. url(), remote(), merge()) are blocked; # comments are detected anywhere in the query.
    • Whitelisted single-table SELECTs (the documented examples) are unaffected.
  4. 新增期权链2026 年 7 月 1 日

    行权价筛选

    期权链请求新增行权价筛选参数。

    • New request params: strike (exact match), strike_min and strike_max (inclusive range).
    • strike cannot be combined with strike_min / strike_max.
    • Values accept a number or a numeric string (form-encoded bodies).
  5. 移除期权链破坏性2026 年 6 月 26 日

    移除 limit 请求参数

    API 不再接受客户端传入的 limit 参数。

    • Use symbol, expiration, put/call, or strike filters to scope a request.
    • Superseded on 2026-07-09: oversized broad requests now return an error instead of partial data.
  6. 移除期权链破坏性2026 年 6 月 25 日

    移除行权价/到期日区间参数

    移除旧版行权价与到期日区间参数。

    • Removed request params: min_strike, max_strike, min_expiry_days, max_expiry_days.
    • Strike filtering was later reintroduced in a simpler form on 2026-07-01 (strike / strike_min / strike_max).
  7. 移除期权链破坏性2026 年 6 月 25 日

    移除 flow 字段与 include_flow

    响应中移除了可选的 flow 字段以及 include_flow 开关。

    • Removed the include_flow request param and its six flow response fields (premium, vol_oi_ratio, and four others).
    • close and latest_trade_price were consolidated — latest_trade_price previously appeared only with include_flow=true.
  8. 变更通用破坏性2026 年 6 月 22 日

    API 基础地址迁移至 www

    API 规范主机名现为 www 子域名。

    • Base URL is now https://www.optiondata.io (previously https://optiondata.io).
    • Update the endpoints for POST /api/historical/sql and POST /api/option-chain.
  9. 新增期权链2026 年 6 月 21 日

    响应中新增 Beta 元数据

    每个期权链响应现在都会标注其 Beta 状态。

    • Responses include meta.api_version ("v1"), meta.beta (true), and meta.notice.
    • A response header X-OptionData-Option-Chain-Beta: true is sent.
    • The Option Chain API is in BETA — request/response fields and semantics may change.
  10. 变更期权链2026 年 6 月 14 日

    更换数据源表;精简架构

    期权链改为查询更精简的执行侧数据表。

    • Switched from the legacy mv_contract_day_flow (now retired) to mv_contract_rank_flow.
    • Fixes prior 500 errors where a day of rows exceeded the max_rows_to_read scan cap.
  11. 修复实时 WebSocket2026 年 3 月 5 日

    情绪筛选取值修正

    修正实时情绪筛选取值中的拼写错误。

    • The sentiment filter value NEUTRUAL was corrected to NEUTRAL.
  12. 移除实时 WebSocket破坏性2026 年 2 月 24 日

    移除实时逐笔字段

    实时逐笔交易消息中移除了若干字段。

    • Removed fields: bid_size, ask_size, vega, theta, rho, exchange.

本日志仅记录数据 API 的架构与接口变更。产品、账单与平台更新请查看博客。