# 中国期货列表

- 接口：china_futures_lists
- 路径：/api/v1/market/data/futures/futures-lists
- 方法：GET
- 描述：查询指定交易日的期货合约列表，包括合约代码、交易所、品种、中文名称和合约类型。不传 `trade_date` 按 CST 的前一交易日查询。
- 数据范围：按交易日的合约清单快照。
- 单次限量：单交易日全量合约列表，无分页
- 提示：
  - `trade_date` 不传则使用按 CST 计算的前一交易日。
  - 不按 `future_type` 过滤，原样带出合约类型；部分合约的 `future_type` 为 `null`。

## 输入参数

| 名称 | 类型 | 必选 | 描述 |
|------|------|------|------|
| trade_date | integer | N | 交易日，格式 YYYYMMDD；不传则使用按 CST 计算的前一交易日 |

## 输出参数

成功响应外层固定为 `code`、`message`、`data`：

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|---------|------|
| code | integer | Y | HTTP 状态码；成功固定为 `200`。 |
| message | string | Y | 成功固定为 `success`；失败时为错误信息。 |
| data | object / null | Y | 成功时为期货列表数据对象；失败时为 `null`。 |

data 对象：

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|---------|------|
| trade_date | integer | Y | 实际使用的交易日（与请求或默认前一交易日一致） |
| items | array | Y | 期货列表 |

items 数组：

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|---------|------|
| symbol | string | Y | 不带交易所后缀的官网合约代码，大小写沿用对应交易所官网格式；CZCE 真实合约返回四位年份代码，交易所由 `exchange` 字段返回 |
| exchange | string | Y | 交易所 |
| product | string | Y | 品种 |
| symbol_cn_name | string | Y | 合约中文名称 |
| future_type | integer / null | N | 合约类型：1 主力 / 2 真实 / 3 连续；源数据缺失时为 `null` |

## 接口示例

```bash
curl -sS "https://market.ft.tech/gateway/api/v1/market/data/futures/futures-lists?trade_date=20260821"
```

Python（[`ftshare`](https://github.com/FTShare-Lab/FTShare-python-sdk.git) SDK，方法 `market.china_futures_lists`，默认返回 pandas `DataFrame`）：

```python
import ftshare as ft

market = ft.market_api()

# 不传 trade_date 默认前一交易日；返回该交易日的全部合约
df = market.china_futures_lists()
print(df.shape)  # 行数随交易日变化，列数固定为 5
print(df[["symbol", "exchange", "product", "symbol_cn_name", "future_type"]].head())
#       symbol exchange product symbol_cn_name  future_type
# 0  A2609      DCE       A        黄大豆1号          2.0
# 1  A2611      DCE       A        黄大豆1号          2.0
# ...

# 指定交易日，格式 YYYYMMDD
df = market.china_futures_lists(trade_date=20260821)
# 返回该交易日的全部合约，行数随交易日变化，列数固定为 5

# 返回 list，每项为 dict，不做 DataFrame 抽取
rows = market.china_futures_lists(as_dataframe=False)
# rows[0] == {'symbol': 'A2609', 'exchange': 'DCE', 'product': 'A', 'symbol_cn_name': '黄大豆1号', 'future_type': 2}
```

## 数据样例

`trade_date=20260821` 期货合约列表节选：

| symbol | symbol_cn_name | exchange | product | future_type |
|--------|----------------|----------|---------|-------------|
| A2609 | 黄大豆1号 | DCE | A | 2 |
| A2611 | 黄大豆1号 | DCE | A | 2 |
| ... | ... | ... | ... | ... |
