# PPI

- 接口：consumer_ppi_monthly
- 路径：/api/v1/market/data/economic/china-ppi
- 方法：GET
- 描述：查询中国工业生产者出厂价格指数（PPI）月度数据。按月份返回当月 PPI、同比、环比和当年累计月均；业务数据在 `data.items` 中按月份倒序分页返回。
- 数据范围：宏观经济月度数据
- 单次限量：默认 `page=1`、`page_size=200`；`page_size` 不设上限，超过总记录数时返回全部
- 提示：
  - `month` 格式化为「YYYY年MM月份」。
  - `ppi` 和 `cumulative_avg` 为价格指数值，`yoy` 和 `mom` 的单位为百分比（%）；缺失值为 `null`。

## 输入参数

| 名称 | 类型 | 必选 | 描述 |
|------|------|------|------|
| page | integer | N | 页码，从 1 开始，默认 1 |
| page_size | integer | N | 每页条数，默认 200 |


## 输出参数
成功响应外层固定为 `code`、`message`、`data`：

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|---------|------|
| code | integer | Y | 响应状态码；成功固定为 200 |
| message | string | Y | 成功固定为 `success`；失败时为中文错误信息 |
| data | object / null | Y | 成功时为分页对象；失败时为 `null` |

data 对象：

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|---------|------|
| items | array | Y | 当前页的 PPI 月度记录列表 |
| total_items | integer | Y | 总记录数 |
| total_pages | integer | Y | 总页数 |

items 数组：

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|---------|------|
| month | string | Y | 月份，格式「YYYY年MM月份」 |
| ppi | string | Y | 当月工业生产者出厂价格指数值 |
| yoy | string / null | Y | 同比增长（%）；无数据时为 `null` |
| mom | string / null | Y | 环比增长（%）；无数据时为 `null` |
| cumulative_avg | string | Y | 当年 PPI 指数累计月均 |

## 接口示例

```bash
curl -sS "https://market.ft.tech/gateway/api/v1/market/data/economic/china-ppi?page=1&page_size=50"
```

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

```python
import ftshare as ft

market = ft.market_api()

# 返回第一页 DataFrame（按时间倒序）
df = market.consumer_ppi_monthly(page=1, page_size=50)
print(df.shape, list(df.columns)[:6])
# (50, 5) ['month', 'ppi', 'yoy', 'mom', 'cumulative_avg']

# 只看最近几期
print(market.consumer_ppi_monthly(page=1, page_size=50).head(3))

# 返回原始 JSON（未经 DataFrame 抽取）
payload = market.consumer_ppi_monthly(page=1, page_size=50, raw=True)
```


## 数据样例

全量月度序列按月份降序返回，节选最新 5 期：

| month | ppi | yoy | mom | cumulative_avg |
|-------|-----|-----|-----|----------------|
| 2026年08月份 | 103.8000 | 3.8000 | null | 102.0375 |
| 2026年07月份 | 103.5000 | 3.5000 | -0.7000 | 101.7857 |
| 2026年06月份 | 104.1000 | 4.1000 | -0.3000 | 101.5000 |
| 2026年05月份 | 103.9000 | 3.9000 | 0.5000 | 100.9800 |
| 2026年04月份 | 102.8000 | 2.8000 | 1.7000 | 100.2500 |
| ... | ... | ... | ... | ... |
