# 中国期货基础数据

- 接口：china_futures_base_data
- 路径：/api/v1/market/data/futures/futures-base-data
- 方法：GET
- 描述：查询指定交易日的期货合约要素，包括交易单位、最小变动价位、保证金、合约乘数、上市日、最后交易日和交割信息。不传 `trade_date` 按 CST 的前一交易日查询。可按裸合约代码过滤。
- 数据范围：按交易日的合约要素快照，可按裸合约代码筛选。
- 单次限量：单交易日全量或单合约要素，无分页
- 提示：
  - `trade_date` 不传则使用按 CST 计算的前一交易日。
  - `symbol` 为不带交易所后缀的合约代码；请求不区分大小写；不传或为空表示该日全部。CZCE 真实合约必须使用四位年份代码，例如 `AP2612`，三位代码返回参数错误。
  - 合法格式但指定交易日没有对应数据时，仍返回 HTTP 200 的空结果；非法代码返回 HTTP 400。

## 输入参数

| 名称 | 类型 | 必选 | 描述 |
|------|------|------|------|
| trade_date | integer | N | 交易日，格式 YYYYMMDD；不传则使用按 CST 计算的前一交易日 |
| symbol | string | N | 不带交易所后缀的合约代码，例如 `CU2609`；不区分大小写；不传或为空表示该日全部 |

## 输出参数

成功响应外层固定为 `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 数组：

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|---------|------|
| trade_date | integer | Y | 交易日 YYYYMMDD |
| exchange | string | Y | 交易所 |
| symbol | string | Y | 不带交易所后缀的官网合约代码，大小写沿用对应交易所官网格式；CZCE 真实合约返回四位年份代码，交易所由 `exchange` 字段返回 |
| product | string | Y | 品种 |
| symbol_cn_name | string | Y | 合约中文名称 |
| trade_unit | string | Y | 交易单位 |
| price_unit | number / null | N | 价格单位；缺失时为 `null` |
| put_price | string | Y | 报价 |
| min_put_price_info | string | Y | 最小变动价位说明 |
| margin_info | string | Y | 保证金说明 |
| trade_months_info | string | Y | 合约月份说明 |
| trade_hours_info | string | Y | 交易时间说明 |
| last_trade_date | string | Y | 最后交易日 |
| last_trade_date_hour | string | Y | 最后交易日时间 |
| delivery_date | string | Y | 交割日期 |
| multiplier | number / null | N | 合约乘数；缺失时为 `null` |
| list_date | integer / null | N | 上市日 YYYYMMDD；缺失时为 `null` |
| de_list_tdate | integer / null | N | 摘牌日 YYYYMMDD；缺失时为 `null` |
| delivery_mean | string | Y | 交割方式 |
| delivery_site | string | Y | 交割地点 |
| value_info | string | Y | 价值说明 |
| price_fluctuation_info | string | Y | 涨跌停板说明 |
| position_limit_info | string | Y | 持仓限额说明 |
| mean_cal_value | number / null | N | 平均价计算值；缺失时为 `null` |
| spot_symbol | string / null | N | 现货代码；缺失时为 `null` |
| type_code | integer / null | N | 类型代码；缺失时为 `null` |
| sub_type_code | integer / null | N | 子类型代码；缺失时为 `null` |
| future_type | integer / null | N | 合约类型：1 主力 / 2 真实 / 3 连续；缺失时为 `null` |

## 接口示例

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

Python 示例使用 [`ftshare`](https://github.com/FTShare-Lab/FTShare-python-sdk.git) SDK 的 `market.china_futures_base_data` 方法，默认返回 pandas `DataFrame`：

```python
import ftshare as ft

market = ft.market_api()

# 指定裸合约代码和交易日，代码不区分大小写
df = market.china_futures_base_data(symbol="CU2609", trade_date=20260821)
print(df.shape)  # (1, 28)
print(df[["trade_date", "symbol", "symbol_cn_name", "trade_unit", "price_unit", "list_date"]].head())
#    trade_date      symbol symbol_cn_name trade_unit  price_unit  list_date
# 0   20260821  CU2609           阴极铜         吨         5.0   20250916

# 不传 symbol 表示查询该交易日的全部合约
df = market.china_futures_base_data(trade_date=20260821)

# 返回原始 JSON，不做 DataFrame 抽取
payload = market.china_futures_base_data(symbol="CU2609", trade_date=20260821, raw=True)
```

## 数据样例

`trade_date=20260821` 时，`data.items` 节选：

| trade_date | exchange | symbol | product | symbol_cn_name | trade_unit | price_unit | multiplier | list_date | de_list_tdate | future_type |
|------------|----------|--------|---------|----------------|------------|------------|------------|-----------|---------------|-------------|
| 20260821 | SHFE | CU2609 | CU | 阴极铜 | 吨 | 5.0 | null | 20250916 | 20260915 | 2 |
