# 期货历史分钟K线单合约

- 接口：`futures_minutes_single`
- 路径：`/api/v2/market/data/futures_minutes/single`
- 方法：GET
- 描述：查询单个期货合约的历史分钟 K 线。
- 数据范围：2023-07 至今，历史 1 分钟原始 K 线，可聚合为 1、5、15、30、60 分钟 K 线；不返回实时分钟数据。
- 单次限量：`limit` 默认 500，范围 1～10000。
- 提示：
  - 该接口只接受 `symbol`，不接受 `symbols`；传入 `symbols` 会返回 HTTP 400。
  - 合约代码使用不带交易所后缀的裸代码；请求不区分大小写。CZCE 真实合约必须使用四位年份代码，例如 `AP2612`，三位代码不符合接口代码规范。
  - `start` 与 `end` 必须同时传入，单位为 Unix 毫秒，按北京时间解释，时间跨度不得超过 30 个自然日（含首尾）。
  - `interval` 默认 `1min`，支持 `1min`、`5min`、`15min`、`30min`、`60min`。
  - 历史分钟数据每个交易日 16:10 更新；当前北京时间日期的数据在当日 16:10 前不可查询。

## 输入参数

| 名称 | 类型 | 必选 | 描述 |
|------|------|------|------|
| symbol | string | Y | 单个期货合约代码，例如 `A2611`；不区分大小写。 |
| interval | string | N | 分钟周期，默认 `1min`；可选 `1min`、`5min`、`15min`、`30min`、`60min`。 |
| start | integer | Y | 起始时间戳，单位毫秒，闭区间。 |
| end | integer | Y | 结束时间戳，单位毫秒，闭区间。 |
| limit | integer | N | 返回的最新 K 线条数；默认 500，范围 1～10000。 |

## 输出参数

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

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|---------|------|
| code | integer | Y | 成功为 200。 |
| message | string | Y | 成功为 `success`。 |
| data | object / null | Y | 成功时为分钟 K 线结果；失败时为 `null`。 |

`data` 对象：

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|---------|------|
| items | array | Y | 分钟 K 线记录列表，按时间升序排列。 |
| total | integer | Y | 查询范围内聚合后的总记录数；不受 `limit` 截断。 |

`items` 数组字段：

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|---------|------|
| bar_interval | string | Y | 返回周期，例如 `5min`。 |
| symbol | string | Y | 不带交易所后缀的官网合约代码，大小写沿用对应交易所官网格式；CZCE 真实合约返回四位年份代码。 |
| variety | string | Y | 期货品种标识。 |
| exchange | string | Y | 交易所标识。 |
| datetime | integer | Y | K 线时间戳，单位毫秒。 |
| trade_date | integer | Y | 交易日，格式 `YYYYMMDD`。 |
| open/high/low/close | number | Y | 开盘、最高、最低、收盘价格。 |
| volume | integer | Y | 成交量。 |
| amount | number | Y | 成交额。 |
| vwap | number | Y | 当前分钟成交量加权平均价；无成交时为 0。 |
| updated_at | integer / null | Y | 数据更新时间戳，单位毫秒；历史分钟 K 线当前为 `null`。 |
| open_interest | number | Y | 持仓量。 |
| pre_settlement_price | number | Y | 昨日结算价。 |
| settlement_price | number | Y | 结算价；未结算时可能为 0。 |
| high_limit_price | number | Y | 涨停价。 |
| low_limit_price | number | Y | 跌停价。 |
| pre_close_price | number | Y | 昨收价。 |

## 接口示例

```bash
curl -sS \
  'https://market.ft.tech/gateway/api/v2/market/data/futures_minutes/single?symbol=A2611&interval=5min&start=1791475200000&end=1791647999000&limit=500'
```

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

```python
import ftshare as ft

market = ft.market_api()
df = market.futures_minutes_single(
    symbol="A2611",
    interval="5min",
    start=1791475200000,
    end=1791647999000,
    limit=500,
)
print(df)
```

请求中传入 `symbols`、`limit=10001` 或超过 30 个自然日的时间范围时返回 HTTP 400。

## 数据样例

| bar_interval | symbol | variety | exchange | datetime | trade_date | open | high | low | close | volume | amount | vwap | updated_at | open_interest |
|---|---|---|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|
| 5min | a2611 | a | DCE | 1791557040000 | 20261012 | 5482.0 | 5491.0 | 5481.0 | 5491.0 | 3689 | 202435290.0 | 54875.383572783954 | null | 264112 |
| 5min | a2611 | a | DCE | 1791557340000 | 20261012 | 5491.0 | 5491.0 | 5484.0 | 5487.0 | 2267 | 124399230.0 | 54873.943537715044 | null | 263964 |
