> ## Documentation Index
> Fetch the complete documentation index at: https://docs.yehangshe.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 指定日期的期权合约目录

> 查询某个标的在指定美东日期具有报价或成交数据的合约

适用于 Pro 与 Pro+，实际开放范围以当前 API Key 的 `GET /v1/discover` 返回为准。

## 可以用来做什么

回答“我想研究某一天的 SPX 期权，当天有哪些合约有数据”。返回合约代码、到期日、行权价和 Call / Put 方向，覆盖当天有指定类型数据的各个到期日。

* 建立历史研究的合约集合，找到现在已经到期的合约。
* 用 `data_type=trade` 找出某天有成交记录的合约，或用 `quote` 找出有报价记录的合约。
* 给历史行情下载程序生成合约清单，省去逐个拼接行权价和到期日的工作。

例如研究上周五的 SPX，先分页取得当天合约目录，选出所需到期日与行权价，再用合约代码查询可用日期和历史行情。目录返回的是合约身份，价格序列由历史行情端点提供。各历史行情端点有各自的可查深度与单次查询范围，例如单合约分钟报价历史覆盖最近两年，研究较早日期前请先核对对应端点说明。[单合约可用日期](https://docs.yehangshe.com/api/options-available-dates.md) · [期权历史行情](https://docs.yehangshe.com/api/domains/options.md)

## 请求

`GET /v1/options/contracts-on-date/{ticker}`

MCP command 为 `options.contracts_on_date`，需要 `derived:read` 或 `data-api:read` scope。

| 参数 | 位置 | 要求 |
| - | - | - |
| ticker | path | 单个标的，如 SPY、SPX |
| date | query | 必填，YYYY-MM-DD，不晚于当前美东日期 |
| data\_type | query | quote 或 trade，默认 quote |
| limit | query | 可选，每页最多条数 |
| cursor | query | 可选，上一页的 next\_cursor |

结果覆盖该日期具有所选数据的所有到期日。SPX 同时查询 SPX 与 SPXW，`roots` 列出有数据的根代码，OCC 代码保留精确合约身份。

```bash theme={null}
curl --get 'https://api.yehangshe.com/v1/options/contracts-on-date/SPX' \
  --data-urlencode 'date=2026-11-13' \
  --data-urlencode 'data_type=quote' \
  --data-urlencode 'limit=400' \
  -H 'Authorization: Bearer sk_live_xxxxxxxx'
```

## 响应

顶层包含 `ticker`、`date`、`data_type`、`roots`、`as_of`、`total_contracts`、`returned_contracts` 和 `contracts`。合约按 OCC 代码升序分页，total 为完整目录数量，returned 为本页数量。

| 合约字段 | 类型 | 含义 |
| - | - | - |
| `contract_symbol` | string | 精确 OCC 合约代码，保留实际根代码（如 SPX 或 SPXW） |
| `expiration` | string | 到期日 YYYY-MM-DD |
| `strike_usd` | number | 行权价，美元 |
| `right` | string | C 或 P |

以下以单条结果演示字段结构。

```json theme={null}
{
  "data": {
    "ticker": "SPX",
    "date": "2026-11-13",
    "data_type": "quote",
    "roots": [
      "SPXW"
    ],
    "as_of": null,
    "total_contracts": 1,
    "returned_contracts": 1,
    "contracts": [
      {
        "contract_symbol": "SPXW270331C06125000",
        "expiration": "2027-03-31",
        "strike_usd": 6125,
        "right": "C"
      }
    ]
  },
  "_meta": {
    "data_freshness_seconds": null,
    "next_cursor": null,
    "truncated": false
  }
}
```

## 分页与计量

`limit` 范围 1–1000，默认 400，响应大小预算可能使实际页长更小。保留查询条件，将 `_meta.next_cursor` 原样传入下一次请求的 `cursor`，直到 next\_cursor 为 null。`_meta.truncated=true` 表示还有下一页。cursor 与查询条件、目录内容绑定，目录变化后旧 cursor 返回 400，此时从首页重新查询。大型目录（如 SPX）可能有数十页，取得首页后请连续翻完；从首页重取时，已成功返回的页面仍按页计量。

每个成功的 HTTP 200 页消耗 **1 unit**，202 和错误响应计 0 unit。首次请求可能返回 202，按 Retry-After 或 `_meta.retry_after_seconds` 有界重试到 200。`data_type=quote` 与 `data_type=trade` 分别表示有报价记录和有成交记录的目录，两者结果可能不同。

目录的 `as_of` 与 `_meta.data_freshness_seconds` 为 null。它们没有发布时刻，返回日期表示数据可用范围。错误参数返回 400，暂时没有可用结果时可能返回 503 `READ_MODEL_UNAVAILABLE`，请按重试提示有限重试。

`date` 请选择交易日。周末、休市日或不存在的标的没有目录数据，不会返回空列表，而是可能先返回 202、随后返回 503。这类请求重复重试不会得到结果，请先核对日期与标的。通用规则见 [错误处理](https://docs.yehangshe.com/errors.md) 和 [配额与限流](https://docs.yehangshe.com/api/quota-and-rate-limits.md)。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.