# 重大合同汇总

- 接口：major_contract_summary
- 路径：/api/v1/market/data/corporate/contract/summary
- 方法：GET
- 描述：近一年 A 股上市公司重大合同汇总，按证券代码汇总该年度的合同笔数、合同金额合计、上一年金额合计、去年营收、营收占比、最新营收等。数据来源于东方财富（eastmoney）重大合同汇总数据。返回分页结构（pageNum/pageSize/total/pages/records）。
- 数据范围：最新快照（近一年汇总）
- 单次限量：分页默认 `page=1`、`page_size=50`、最大 200
- 提示：
  - 请求无业务必填参数，仅分页。
  - 汇总维度为「近一年」，非按签约日区间筛选。
  - 多数文本字段（如 `contract_name`、`total_amount`、`revenue_ratio` 等）为可选，缺失返回 null。

## 输入参数

| 名称 | 类型 | 必选 | 描述 |
|------|------|------|------|
| page | integer | N | 页码，默认 1 |
| page_size | integer | N | 每页条数，默认 50、最大 200 |

## 输出参数

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

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|---------|------|
| code | integer | Y | 状态码 |
| message | string | Y | 状态信息 |
| data | object | Y | 分页数据对象（见下） |

data 对象：

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|---------|------|
| pageNum | integer | Y | 当前页码 |
| pageSize | integer | Y | 每页条数 |
| total | integer | Y | 总记录数 |
| pages | integer | Y | 总页数 |
| records | array | Y | 重大合同汇总列表 |

records 数组：

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|---------|------|
| seq | integer | Y | 序号 |
| security_code | string | Y | 证券代码 |
| security_short_name | string | Y | 证券简称 |
| contract_count | string | Y | 合同笔数 |
| total_amount | string | Y | 合同金额合计 |
| prev_year_total | string | Y | 上一年金额合计 |
| last_year_revenue | string | Y | 去年营收 |
| revenue_ratio | string | Y | 营收占比（%） |
| latest_revenue | string | Y | 最新营收 |

## 接口示例

```bash
curl -sS "https://market.ft.tech/gateway/api/v1/market/data/corporate/contract/summary?page=1&page_size=10"
```

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

```python
import ftshare as ft

market = ft.market_api()

# 默认返回 DataFrame（按标的全量合同汇总，分页）
df = market.major_contract_summary(page=1, page_size=3)
print(df[["security_code", "security_short_name", "contract_count", "total_amount"]].head(3))
#   security_code security_short_name contract_count    total_amount
# 0        601390              中国中铁             41  149550970000.0
# ...

# limit 跨页取数（SDK 自动翻页拼成 10 行）
df = market.major_contract_summary(limit=10)

# 返回原始 JSON
payload = market.major_contract_summary(page=1, page_size=3, raw=True)

```

## 数据样例

实测返回（节选，按合同金额合计降序）：

| security_code | security_short_name | contract_count | total_amount |
|---------------|---------------------|----------------|--------------|
| 601390 | 中国中铁 | 41 | 149550970000.0000 |
| 601117 | 中国化学 | 90 | 139116000000.0000 |
| 601669 | 中国电建 | 11 | 91674000000.0000 |
