# 社融信贷

- 接口：consumer_credit_monthly
- 路径：/api/v1/market/data/economic/china-credit-loans
- 方法：GET
- 描述：查询中国信贷月度数据。按月份返回新增信贷当月值、同比、环比、当年累计及累计同比；业务数据在 `data.records` 中按月份倒序分页返回。
- 数据范围：宏观经济月度数据
- 单次限量：默认 `page=1`、`page_size=50`；`page_size` 最大 200
- 提示：
  - `month` 格式化为「YYYY年MM月份」。
  - 当前数据中的 `unit` 和 `currency` 可能为空字符串，不能仅依赖这两个字段判断金额单位和币种。

## 输入参数

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


## 输出参数

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

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

data 对象：

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|---------|------|
| items | array | Y | 社融信贷记录列表 |
| total_items | integer | Y | 总记录数 |
| total_pages | integer | Y | 总页数 |

items 数组：

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|---------|------|
| month | string | Y | 月份，格式「YYYY年MM月份」 |
| new_loans | string | Y | 本月新增信贷（unit） |
| yoy | string / null | Y | 同比增长（%）；无数据时为 `null` |
| mom | string / null | Y | 环比增长（%）；无数据时为 `null` |
| cumulative | string | Y | 当年累计（1 月至当月之和） |
| cumulative_yoy | string / null | Y | 累计同比（%）；无数据时为 `null` |
| unit | string | Y | 货币单位；当前数据可能返回空字符串 |
| currency | string | Y | 货币种类；当前数据可能返回空字符串 |

## 接口示例

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

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

```python
import ftshare as ft

market = ft.market_api()

# 返回第一页 DataFrame（按时间倒序）
df = market.consumer_credit_monthly(page=1, page_size=50)
print(df)
#          month new_loans        yoy        mom cumulative cumulative_yoy unit currency
# 0  2026年06月份     17650  -25.2119   255.4884     107605       -15.5131
# 1  2026年05月份      4965  -16.1742  -223.9391      89955       -13.3072
# ...（行数随数据更新而变化）

# 取最近 24 个月
recent = market.consumer_credit_monthly(page=1, page_size=24)

# 返回包含 code、message、data 的原始 JSON
payload = market.consumer_credit_monthly(page=1, page_size=50, raw=True)
# payload["data"]["records"][0] == {"month": "2026年06月份", "new_loans": "17650.0000", ...}
```

## 数据样例

全量月度序列按月份降序返回。以下为 2026年06月份的历史数据样例，最新月份会随数据更新而变化：

| month | new_loans | yoy | cumulative |
|-------|-----------|-----|------------|
| 2026年06月份 | 17650 | -25.2119 | 107605 |
| ... | ... | ... | ... |
