# 东方财富期货龙虎榜

- 接口：eastmoney_futures_strange
- 路径：/api/v1/market/data/eastmoney-futures-strange
- 方法：GET
- 描述：查询指定交易所、品种、合约和交易日的东方财富期货龙虎榜面板。**参数校验不通过返回 `code=400`**；参数合法但该组合无匹配快照时，返回 `code=200`、`message=success` 和空数组。
- 数据范围：按交易日查询已采集的期货龙虎榜快照
- 单次限量：返回该合约对应的完整面板数组，不分页
- 提示：
  - `exchange` 接受 `shfe`/`dce`/`czce`/`ine`/`gfex`/`cffex` 六个值（大小写不敏感），其中 `cffex` 为中国金融期货交易所（中金所）。其余值（含历史文档误写的 `gfe`）返回 `400`，错误信息中会列出合法取值。
  - `variety` 与 `exchange` 必须匹配，例如多晶硅属广期所，须传 `exchange=gfex`，传 `dce` 会因无匹配而返回空数组。
  - 返回空数组表示「参数合法但该组合当天无快照」，不要把空数组当作参数错误的信号。

## 输入参数

| 名称 | 类型 | 必选 | 描述 |
|------|------|------|------|
| exchange | string | Y | 交易所代码：`shfe`/`dce`/`czce`/`ine`/`gfex`/`cffex`（大小写不敏感）。中金所为 `cffex`；广期所为 `gfex`，不是 `gfe` |
| variety | string | Y | 品种名称，如 `多晶硅`。须填该品种所在交易所，例如多晶硅属 `gfex` |
| contract | string | Y | 合约代码，如 `ps2609`；请求大小写不敏感，CZCE 真实合约使用四位年份代码。 |
| trade_date | string | Y | 交易日，`YYYYMMDD` |

## 输出参数

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

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|---------|------|
| code | integer | Y | HTTP 状态码；成功为 `200`，参数校验失败为 `400`。 |
| message | string | Y | 成功固定为 `success`；失败时为错误信息（如 `invalid exchange: ...`）。 |
| data | array / null | Y | 成功时为面板数组，无匹配数据时为空数组；失败时为 `null`。 |

data 数组：

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|------|------|
| key | string | Y | 面板标识 |
| title | string | Y | 面板标题 |
| slices | array/null | Y | 饼图切片；每项含 `name/value/percent` |
| rows | array/null | Y | 排名记录；每项含 `rank/member_id/member_name/value/change` |
| summary | object/null | Y | 汇总；含 `today_total/previous_total/total_change` |

## 接口示例

```bash
curl -sS "https://market.ft.tech/gateway/api/v1/market/data/eastmoney-futures-strange?exchange=gfex&variety=%E5%A4%9A%E6%99%B6%E7%A1%85&contract=ps2609&trade_date=20260721"
```

中金所沪深300股指期货查询示例：

```bash
# 品种名称包含中文，使用 URL 编码参数避免中文在传输时被错误处理。
curl -sS --get "https://market.ft.tech/gateway/api/v1/market/data/eastmoney-futures-strange" \
  --data-urlencode "exchange=CFFEX" \
  --data-urlencode "variety=沪深300股指期货" \
  --data-urlencode "contract=IF2610" \
  --data-urlencode "trade_date=20260918"
```

非法 `exchange` 会被拒绝（返回 `400`，而非空数组）：

```bash
curl -sS "https://market.ft.tech/gateway/api/v1/market/data/eastmoney-futures-strange?exchange=gfe&variety=%E5%A4%9A%E6%99%B6%E7%A1%85&contract=ps2609&trade_date=20260721"
# {"code":400,"message":"invalid exchange: gfe（取值须为 [\"SHFE\", \"DCE\", \"CZCE\", \"INE\", \"GFEX\", \"CFFEX\"] 之一，大小写不敏感）","data":null}
```

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

```python
import ftshare as ft

market = ft.market_api()
df = market.eastmoney_futures_strange(
    exchange="gfex",       # 多晶硅属广期所 GFEX
    variety="多晶硅",
    contract="ps2609",
    trade_date="20260721",
)
print(df)
```

## 数据样例

查询参数：`exchange=shfe`、`variety=螺纹钢`、`contract=rb2609`、`trade_date=20260820`。接口返回 12 个数据面板，以下展示“成交量龙虎榜”面板中的前 5 条真实记录：

| rank | member_id | member_name | value | change |
|---:|---|---|---:|---:|
| 1 | 0163 | 东证期货 | 5514 | 1554 |
| 2 | 0148 | 中信期货 | 3883 | 2782 |
| 3 | 0004 | 国泰君安 | 2785 | 1876 |
| 4 | 0253 | 华泰期货 | 1623 | 633 |
| 5 | 0082 | 国投期货 | 1534 | 996 |

> 该响应还包含成交持仓比例、多单/空单持仓比例、多头/空头/净多空及增减仓龙虎榜等面板。
