massive-options-data
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMassive 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:
| Field | Developer returns? | Notes |
|---|---|---|
| ✅ | Always present. |
| ✅ | Per contract, 15-min delayed. |
| ✅ | Per contract, 15-min delayed. |
| ✅ | Per contract, previous session. |
| ✅ | Option prices (previous session OHLC), 15-min delayed. |
| ✅ | Always present. |
| ✅ | Current underlying price, 15-min delayed. |
| ✅ | Last trade, 15-min delayed. |
| ❌ | Still not returned on Developer. Cannot calculate real-time spread. |
| Historical IV / IV Rank / IV Percentile | ❌ | Not 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响应中实际返回的字段来编写调用代码:
| 字段 | 开发者版是否返回? | 说明 |
|---|---|---|
| ✅ | 始终存在。 |
| ✅ | 每个合约,延迟15分钟。 |
| ✅ | 每个合约,延迟15分钟。 |
| ✅ | 每个合约,基于前一交易日数据。 |
| ✅ | 期权价格(前一交易日OHLC),延迟15分钟。 |
| ✅ | 始终存在。 |
| ✅ | 当前标的资产价格,延迟15分钟。 |
| ✅ | 最新交易,延迟15分钟。 |
| ❌ | 开发者版仍未返回。无法计算实时买卖价差。 |
| 历史隐含波动率 / 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 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: # 这是一个价平合约
if atm_low <= strike <= atm_high: # 这是一个价平合约
如果您需要实时买卖报价,请升级到**Advanced(每月199美元)**版本。Pagination — required for any DTE-range scan
分页——任何DTE区间扫描的必备步骤
Chain snapshots paginate by sort order. A 250-row first page often
covers just one expiration. To get all contracts in a DTE window you MUST
walk (see in ). Skipping this is
the #1 reason a "0 results" scan looks broken.
tickernext_urlmassive_paginateexports.pyTypical chain sizes for a single underlying with one expiration window can
exceed 450 contracts. Allow at least 4 pages.
期权链快照按代码排序进行分页。第一页250行通常仅覆盖一个到期日。要获取DTE窗口内的所有合约,您必须遍历(请查看中的函数)。跳过这一步是导致“0条结果”扫描看似失效的头号原因。
next_urlexports.pymassive_paginate单个标的资产在一个到期窗口内的典型合约数量可能超过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))
EOFbash
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))
EOFFunctions (exports.py
)
exports.py函数列表(exports.py
)
exports.py| Function | Endpoint | Purpose |
|---|---|---|
| | Full chain snapshot (price/greeks/IV/OI; quote+trade missing on Starter). |
| | Single contract snapshot. |
| | Reference list of option contracts (active or expired). |
| | Historical trade ticks. Available on Developer+. |
| | Historical NBBO quotes. Still returns 403 on Developer. Requires Advanced. |
| | OHLCV bars. Minute + second bars on Developer, all bars on Advanced. |
| — | Walk |
All functions return the raw JSON from upstream. HTTP errors raise via
.
Response.raise_for_status()| 函数 | 端点 | 用途 |
|---|---|---|
| | 完整期权链快照(包含价格/希腊值/IV/OI;入门版缺少报价和交易数据)。 |
| | 单个合约快照。 |
| | 期权合约参考列表(活跃或已过期)。 |
| | 历史交易数据。开发者版及以上可用。 |
| | 全国最优报价(NBBO)历史数据。开发者版仍返回403错误,需Advanced版本。 |
| | OHLCK柱状图数据。开发者版支持分钟和秒级柱状图,Advanced版支持所有时间粒度。 |
| — | 遍历 |
所有函数均返回上游接口的原始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_quotemay be absent; keep aslast_trade, never fabricate.None - Caller-id. Every call should include a so transparent-proxy can attribute usage.
caller_id
- 先探测,再编码。针对新端点编写过滤逻辑前,请先导出一条完整记录并检查实际字段。这能节省数小时“为什么所有内容都被过滤掉了?”的调试时间。
- 空值处理。、
greeks、last_quote可能不存在;请保留为last_trade,切勿伪造数据。None - 调用者ID。每次调用都应包含,以便透明代理能统计使用情况。
caller_id
Credentials
凭证设置
Set 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.
MASSIVE_API_KEY通过Agent的安全输入流程设置。当密钥存在时,sc-proxy会自动注入;本地脚本也会从环境变量中读取该密钥,因此在BYOK场景下也能正常工作。
MASSIVE_API_KEYSource of truth
权威来源
- Massive options docs: https://massive.com/docs/rest/options/overview
- Follow official field names; when upstream changes the contract, update this skill rather than papering over it in callers.
- Massive期权文档:https://massive.com/docs/rest/options/overview
- 遵循官方字段名称;当上游合约变更时,请更新本技能,而非在调用代码中进行兼容处理。