massive-options-data

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Massive Options Data

海量期权数据

Data supply layer for US options market data. Wraps the Massive (Polygon) options REST endpoints with a thin, predictable Python interface.
This skill does NOT generate strategies, signals, rankings, or trading advice — it only exposes options data.
美股期权市场数据的数据供应层。通过简洁、可预测的Python接口封装Massive(Polygon)的期权REST端点。
本技能生成策略、信号、排名或交易建议——仅提供期权数据。

Plan: Developer — REAL field availability

方案:开发者版——实际字段可用性

We are on Massive Options Developer ($79/mo). Build your callers against what's actually present in the API responses:
FieldDeveloper returns?Notes
details.*
(ticker, strike, expiration, type)
Always present.
implied_volatility
Per contract, 15-min delayed.
greeks
(delta, gamma, theta, vega)
Per contract, 15-min delayed.
open_interest
Per contract, previous session.
day.{open,high,low,close,volume,vwap}
Option prices (previous session OHLC), 15-min delayed.
underlying_asset.ticker
Always present.
underlying_asset.price
Current underlying price, 15-min delayed.
last_trade
(price, size, timestamp)
Last trade, 15-min delayed.
last_quote
(bid/ask)
Still not returned on Developer. Cannot calculate real-time spread.
Historical IV / IV Rank / IV PercentileNot exposed on any plan; build your own historical series.
ATM filtering now uses real underlying price:
python
chain = massive_option_chain_snapshot("AAPL")
我们使用的是**Massive Options Developer(每月79美元)**版本。请根据API响应中实际返回的字段来编写调用代码:
字段开发者版是否返回?说明
details.*
(代码、行权价、到期日、类型)
始终存在。
implied_volatility
每个合约,延迟15分钟。
greeks
(delta、gamma、theta、vega)
每个合约,延迟15分钟。
open_interest
每个合约,基于前一交易日数据。
day.{open,high,low,close,volume,vwap}
期权价格(前一交易日OHLC),延迟15分钟。
underlying_asset.ticker
始终存在。
underlying_asset.price
当前标的资产价格,延迟15分钟。
last_trade
(价格、成交量、时间戳)
最新交易,延迟15分钟。
last_quote
(买价/卖价)
开发者版仍未返回。无法计算实时买卖价差。
历史隐含波动率 / IV排名 / IV百分位任何版本均未提供;需自行构建历史序列。
价平(ATM)筛选现在使用真实标的资产价格:
python
chain = massive_option_chain_snapshot("AAPL")

No need for twelvedata — underlying price is now included!

无需twelvedata——标的资产价格现已包含在内!

spot_price = chain["results"][0]["underlying_asset"]["price"] atm_low, atm_high = spot_price * 0.95, spot_price * 1.05 for contract in chain["results"]: strike = contract["details"]["strike_price"]
if atm_low <= strike <= atm_high: # This is an ATM contract

If you need real-time bid/ask quotes, upgrade to **Advanced ($199/mo)**.
spot_price = chain["results"][0]["underlying_asset"]["price"] atm_low, atm_high = spot_price * 0.95, spot_price * 1.05 for contract in chain["results"]: strike = contract["details"]["strike_price"]
if atm_low <= strike <= atm_high: # 这是一个价平合约

如果您需要实时买卖报价,请升级到**Advanced(每月199美元)**版本。

Pagination — required for any DTE-range scan

分页——任何DTE区间扫描的必备步骤

Chain snapshots paginate by
ticker
sort order. A 250-row first page often covers just one expiration. To get all contracts in a DTE window you MUST walk
next_url
(see
massive_paginate
in
exports.py
). Skipping this is the #1 reason a "0 results" scan looks broken.
Typical chain sizes for a single underlying with one expiration window can exceed 450 contracts. Allow at least 4 pages.
期权链快照按代码排序进行分页。第一页250行通常仅覆盖一个到期日。要获取DTE窗口内的所有合约,您必须遍历
next_url
(请查看
exports.py
中的
massive_paginate
函数)。跳过这一步是导致“0条结果”扫描看似失效的头号原因。
单个标的资产在一个到期窗口内的典型合约数量可能超过450个。请至少预留4页的空间。

Script Usage

脚本使用示例

bash
python3 - <<'EOF'
import sys, json
sys.path.insert(0, "/data/workspace/skills/massive-options-data")
from exports import (
    massive_option_chain_snapshot,
    massive_option_contract_snapshot,
    massive_option_trades,
    massive_option_quotes,
    massive_option_aggregates,
    massive_list_contracts,
    massive_paginate,
)

snap = massive_option_chain_snapshot(underlying="SPY", limit=10)
print(json.dumps(snap.get("results", [])[:2], indent=2))
EOF
bash
python3 - <<'EOF'
import sys, json
sys.path.insert(0, "/data/workspace/skills/massive-options-data")
from exports import (
    massive_option_chain_snapshot,
    massive_option_contract_snapshot,
    massive_option_trades,
    massive_option_quotes,
    massive_option_aggregates,
    massive_list_contracts,
    massive_paginate,
)

snap = massive_option_chain_snapshot(underlying="SPY", limit=10)
print(json.dumps(snap.get("results", [])[:2], indent=2))
EOF

Functions (
exports.py
)

函数列表(
exports.py

FunctionEndpointPurpose
massive_option_chain_snapshot(underlying, **filters)
GET /v3/snapshot/options/{underlying}
Full chain snapshot (price/greeks/IV/OI; quote+trade missing on Starter).
massive_option_contract_snapshot(underlying, option_ticker)
GET /v3/snapshot/options/{underlying}/{contract}
Single contract snapshot.
massive_list_contracts(underlying_ticker=None, **filters)
GET /v3/reference/options/contracts
Reference list of option contracts (active or expired).
massive_option_trades(option_ticker, **range)
GET /v3/trades/{option_ticker}
Historical trade ticks. Available on Developer+.
massive_option_quotes(option_ticker, **range)
GET /v3/quotes/{option_ticker}
Historical NBBO quotes. Still returns 403 on Developer. Requires Advanced.
massive_option_aggregates(option_ticker, multiplier, timespan, from_, to, **opts)
GET /v2/aggs/ticker/{ticker}/range/...
OHLCV bars. Minute + second bars on Developer, all bars on Advanced.
massive_paginate(url, params=None, max_pages=20)
Walk
next_url
cursor pagination.
All functions return the raw JSON from upstream. HTTP errors raise via
Response.raise_for_status()
.
函数端点用途
massive_option_chain_snapshot(underlying, **filters)
GET /v3/snapshot/options/{underlying}
完整期权链快照(包含价格/希腊值/IV/OI;入门版缺少报价和交易数据)。
massive_option_contract_snapshot(underlying, option_ticker)
GET /v3/snapshot/options/{underlying}/{contract}
单个合约快照。
massive_list_contracts(underlying_ticker=None, **filters)
GET /v3/reference/options/contracts
期权合约参考列表(活跃或已过期)。
massive_option_trades(option_ticker, **range)
GET /v3/trades/{option_ticker}
历史交易数据。开发者版及以上可用。
massive_option_quotes(option_ticker, **range)
GET /v3/quotes/{option_ticker}
全国最优报价(NBBO)历史数据。开发者版仍返回403错误,需Advanced版本。
massive_option_aggregates(option_ticker, multiplier, timespan, from_, to, **opts)
GET /v2/aggs/ticker/{ticker}/range/...
OHLCK柱状图数据。开发者版支持分钟和秒级柱状图,Advanced版支持所有时间粒度。
massive_paginate(url, params=None, max_pages=20)
遍历
next_url
游标分页。
所有函数均返回上游接口的原始JSON数据。HTTP错误将通过
Response.raise_for_status()
抛出。

Hardening notes

强化注意事项

  • Probe first, code second. Before writing a filter pipeline against a new endpoint, dump one full record and inspect actual fields. Saves hours of "why is everything filtered out?" debugging.
  • Null handling.
    greeks
    ,
    last_quote
    ,
    last_trade
    may be absent; keep as
    None
    , never fabricate.
  • Caller-id. Every call should include a
    caller_id
    so transparent-proxy can attribute usage.
  • 先探测,再编码。针对新端点编写过滤逻辑前,请先导出一条完整记录并检查实际字段。这能节省数小时“为什么所有内容都被过滤掉了?”的调试时间。
  • 空值处理
    greeks
    last_quote
    last_trade
    可能不存在;请保留为
    None
    ,切勿伪造数据。
  • 调用者ID。每次调用都应包含
    caller_id
    ,以便透明代理能统计使用情况。

Credentials

凭证设置

Set
MASSIVE_API_KEY
via the agent's secure input flow. The key is injected by sc-proxy when present; the local script also reads it from the environment so it works in BYOK setups.
通过Agent的安全输入流程设置
MASSIVE_API_KEY
。当密钥存在时,sc-proxy会自动注入;本地脚本也会从环境变量中读取该密钥,因此在BYOK场景下也能正常工作。

Source of truth

权威来源