# 社零

- 接口：consumer_retail_sales_monthly
- 路径：/api/v1/market/data/economic/china-retail-sales
- 方法：GET
- 描述：查询中国社会消费品零售总额月度汇总计算结果。按月份返回当月值、同比、累计值、累计同比。数据按月聚合，按年份（2000 年起）降序排列。响应为数组直出，含货币单位与币种。无入参。
- 数据范围：宏观经济月度数据
- 单次限量：全量月度序列一次返回，无分页上限
- 提示：
  - `month` 格式化为「YYYY年MM月份」。
  - 金额单位见 `unit`（通常为亿元），币种见 `currency`。

## 输入参数

无。


## 输出参数

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

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|---------|------|
| code | integer | Y | HTTP 状态码；成功固定为 200 |
| message | string | Y | 成功固定为 `success`；失败时为中文错误信息 |
| data | array / null | Y | 成功时为业务数据数组；失败时为 `null`。 |


data 数组：

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|---------|------|
| month | string | Y | 月份，格式「YYYY年MM月份」 |
| current | string | Y | 当月值 |
| yoy | string | Y | 同比增长（%） |
| cumulative | string | Y | 累计值 |
| cumulative_yoy | string | Y | 累计同比（%） |
| unit | string | Y | 货币单位 |
| currency | string | Y | 货币种类 |

## 接口示例

```bash
curl -sS "https://market.ft.tech/gateway/api/v1/market/data/economic/china-retail-sales"
```

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

```python
import ftshare as ft

market = ft.market_api()

# 默认返回 DataFrame（社会消费品零售总额月度序列）
df = market.consumer_retail_sales_monthly()
print(df)
#          month current   yoy cumulative cumulative_yoy unit currency
# 0  2026年05月份   41090  -0.6   206031.4            1.4
# 1  2026年04月份 37246.5   0.2   164941.5            1.9
# ...（302 行）

# 取最近 12 个月
recent = market.consumer_retail_sales_monthly().head(12)

# 返回 list（每行为 dict）
rows = market.consumer_retail_sales_monthly(as_dataframe=False)
# rows[0] == {"month": "2026年05月份", "current": "41090", "yoy": "-0.6", ...}
```

## 数据样例

全量月度序列按月份降序返回，节选最新一期（2026年05月份）核心字段：

| month | current | yoy | cumulative |
|-------|---------|-----|------------|
| 2026年05月份 | 41090 | -0.6 | 206031 |
| ... | ... | ... | ... |
