# A股资产负债表

- 接口：balance
- 路径：/api/v1/market/data/finance/balance
- 方法：GET
- 描述：查询 A 股上市公司资产负债表数据。按报告期逐行返回，每行包含一个报告期和多个财务科目列；缺失值为 `null`。报表类型字段反映返回数据的报表口径。同一路径支持两种模式：模式A 传 `stock_code` 查单票所有报告期；模式B 不传 `stock_code` 时必须同时提供 `year + report_type + page + page_size`，按单个报告期分页查所有票。`report_type` 取值 `q1`、`q2`、`q3`、`annual`，`h1` 映射为 `q2`。
- 数据范围：按报告期查询
- 单次限量：模式B 接收 `page/page_size`；分页元数据随响应返回。
- 提示：
  - `stock_code` 格式为 6 位数字 + 交易所后缀，例如 `600519.SH`；模式A 与模式B 二选一。
  - 模式A 单票查询不分页，返回该票全部报告期；模式B 才按 `page/page_size` 分页。
  - 科目字段大多成对返回「本期值 + 同比值」：同比字段名 = 科目字段名 + `_yoy`；同比无值时该字段为 null；末尾含衍生字段 `asset_liability_ratio`，表示资产负债率。

## 输入参数

| 名称 | 类型 | 必选 | 描述 |
|------|------|------|------|
| stock_code | string | N | A 股代码，6 位数字 + 后缀，例如 600519.SH；存在则进入模式A 单票查询 |
| year | integer | N | 年份，模式B 必填，例如 2024 |
| report_type | string | N | 报告期类型，模式B 必填：q1 / q2 / q3 / annual，h1 映射为 q2 |
| page | integer | N | 页码，模式B 必填，从 1 开始 |
| page_size | integer | N | 每页条数，模式B 必填，默认 50，最大 500 |


## 输出参数

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

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|---------|------|
| code | integer | Y | HTTP 状态码；成功固定为 `200`。 |
| message | string | Y | 成功固定为 `success`；失败时为错误信息。 |
| data | object / null | Y | 成功时使用兼容分页结构；失败时为 `null`。模式 A 与模式 B 的字段见下文。 |

data 对象：

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|---------|------|
| items | array | Y | 当前页或单票查询的报告期记录 |
| total_items | integer | Y | 总记录数 |
| total_pages | integer | Y | 总页数；单票模式有记录时为 1，否则为 0 |

items 数组：

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|---------|------|
| stock_code | string | Y | A 股代码 |
| stock_name | string | Y | 股票名称 |
| publish_date | string | Y | 发布日期 YYYY-MM-DD |
| year | integer | Y | 年份 |
| report_type | string | Y | 报告期类型：q1 / q2 / q3 / annual |
| report_type_cn | string | Y | 报告期中文名 |
| report_form_type | string | Y | 报表类型，优先取「合并调整」 |
| t_assets | string | Y | 资产总计 |
| total_assets_yoy | string / null | Y | 资产总计同比 |
| t_fixed_assets | string | Y | 固定资产合计 |
| cash_equivalents | string | Y | 货币资金 |
| monetary_funds_yoy | string / null | Y | 货币资金同比 |
| account_receivable | string | Y | 应收账款 |
| accounts_receivable_yoy | string / null | Y | 应收账款同比 |
| inventory | string | Y | 存货 |
| inventory_yoy | string / null | Y | 存货同比 |
| t_liability | string | Y | 负债合计 |
| total_liabilities_yoy | string / null | Y | 负债合计同比 |
| accounts_payable | string | Y | 应付账款 |
| accounts_payable_yoy | string / null | Y | 应付账款同比 |
| advance_receipts | string / null | Y | 预收账款；缺失时为 `null` |
| advance_receipts_yoy | string / null | Y | 预收账款同比；缺失时为 `null` |
| t_equity | string | Y | 所有者权益合计 |
| total_equity_yoy | string / null | Y | 所有者权益合计同比 |
| asset_liability_ratio | string | Y | 资产负债率，衍生字段 |

## 接口示例

```bash
curl -sS "https://market.ft.tech/gateway/api/v1/market/data/finance/balance?stock_code=600519.SH"
```


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

```python
import ftshare as ft

market = ft.market_api()

# 模式A：按单票查询（返回该票全部报告期）
df = market.balance(stock_code="600519.SH")
print(df)

# 模式B：按单个报告期分页查询全市场
df = market.balance(year=2024, report_type="annual", page=1, page_size=50)
print(df)
```

## 数据样例

| stock_code | stock_name | publish_date | year | report_type | report_type_cn | report_form_type | t_assets | total_assets_yoy | t_fixed_assets | cash_equivalents | monetary_funds_yoy |
|------|------|------|------|------|------|------|------|------|------|------|------|
| 600519.SH | 贵州茅台 | 2026-08-15 | 2026 | q2 | 半年报 | 合并未调整 | 309050784569.3100 | 5.7500 | 22220890242.7300 | 53518798979.0800 | 3.6300 |
| 600519.SH | 贵州茅台 | 2026-04-25 | 2026 | q1 | 一季报 | 合并未调整 | 319918844905.5800 | 2.4200 | 22132684069.8000 | 48786691397.5500 | -6.5400 |
| 600519.SH | 贵州茅台 | 2026-04-17 | 2025 | annual | 年报 | 合并未调整 | 303834844021.4400 | 1.6400 | 22488122304.3500 | 51690610946.5000 | -12.8300 |
| 600519.SH | 贵州茅台 | 2025-10-30 | 2025 | q3 | 三季报 | 合并未调整 | 304738184929.8600 | 6.2700 | 21170758112.8100 | 51753057846.4500 | -13.8700 |
| 600519.SH | 贵州茅台 | 2025-08-13 | 2025 | q2 | 半年报 | 合并未调整 | 292257789095.5100 | 4.6700 | 21758335604.3700 | 51644880716.9300 | -9.1400 |
