# 基金资产配置

- 接口：get_fund_asset_allocation
- 路径：/api/v1/market/data/fund/fund-asset-allocation
- 方法：GET
- 描述：按 `fund_code` 查基金报告期资产配置。`report_date` 单期或 `start_date`/`end_date` 区间（互斥），`publish_date` 按发布日期过滤。未传日期默认最新一期。返回分页结构（items/total_pages/total_items），含总资产/净资产及权益类、股票、基金、债券、货币资金、其他资产各自的市值、占总资产比例、占净值比例等 25 个字段。
- 数据范围：按报告期查询
- 单次限量：默认 `page=1`/`page_size=50`；上限 200
- 提示：
  - `fund_code` 必填。
  - `report_date` 与 `start_date`+`end_date` 互斥。
  - 未传日期默认最新一期。

## 输入参数

| 名称 | 类型 | 必选 | 描述 |
|------|------|------|------|
| fund_code | string | Y | 基金代码 |
| report_date | integer | N | 报告期 YYYYMMDD（与 start/end 互斥） |
| publish_date | integer | N | 发布日期 YYYYMMDD |
| start_date | integer | N | 报告期起始日期（需与 end_date 同传） |
| end_date | integer | N | 报告期结束日期 |
| page | integer | N | 页码，默认 1 |
| page_size | integer | N | 每页条数，默认 50，上限 200 |


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

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

data 对象：

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|---------|------|
| items | array | Y | 资产配置列表 |
| total_pages | integer | Y | 总页数 |
| total_items | integer | Y | 总记录数 |

items 数组：

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|---------|------|
| fund_code | string | Y | 基金代码 |
| fund_name | string | Y | 基金名称 |
| publish_date | integer | Y | 发布日期 YYYYMMDD |
| report_date | integer | Y | 报告期 YYYYMMDD |
| report_type | string | Y | 报告类型 |
| currency | string | Y | 币种 |
| total_asset | string | Y | 总资产 |
| net_asset | string | Y | 净资产 |
| equity_market_value | string | Y | 权益类资产市值 |
| equity_asset_ratio | string | Y | 权益类资产占总资产比例（%） |
| equity_net_value_ratio | string | Y | 权益类资产占净值比例（%） |
| stock_market_value | string | Y | 股票市值 |
| stock_asset_ratio | string | Y | 股票占总资产比例（%） |
| stock_net_value_ratio | string | Y | 股票占净值比例（%） |
| fund_market_value | string | Y | 基金市值 |
| fund_asset_ratio | string | Y | 基金占总资产比例（%） |
| fund_net_value_ratio | string | Y | 基金占净值比例（%） |
| bond_market_value | string | Y | 债券市值 |
| bond_asset_ratio | string | Y | 债券占总资产比例（%） |
| bond_net_value_ratio | string | Y | 债券占净值比例（%） |
| money_market_value | string | Y | 货币资金市值 |
| money_asset_ratio | string | Y | 货币资金占总资产比例（%） |
| money_net_value_ratio | string | Y | 货币资金占净值比例（%） |
| other_market_value | string | Y | 其他资产市值 |
| other_asset_ratio | string | Y | 其他资产占总资产比例（%） |
| other_net_value_ratio | string | Y | 其他资产占净值比例（%） |

## 接口示例

```bash
curl -sS "https://market.ft.tech/gateway/api/v1/market/data/fund/fund-asset-allocation?fund_code=000001&page=1&page_size=5"
```

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

```python
import ftshare as ft

market = ft.market_api()

# 查询最新一期资产配置
rows = market.fund_asset_allocation(fund_code="000001", limit=10)
print(rows)

# 查询指定报告期
rows = market.fund_asset_allocation(fund_code="000001", report_date=20260331)

# 按报告期区间查询
rows = market.fund_asset_allocation(
    fund_code="000001", start_date=20250101, end_date=20260331, limit=10
)

# 返回原始 JSON
payload = market.fund_asset_allocation(
    fund_code="000001", report_date=20260331, raw=True
)
```

## 数据样例

`fund_code=000001`（华夏成长混合A 一季报 20260331），节选核心列（fund_code/fund_name/publish_date/report_type/currency 及基金/货币/其他资产列省略）：

| report_date | total_asset | net_asset | stock_market_value | stock_asset_ratio | stock_net_value_ratio |
|-------------|-------------|-----------|--------------------|-------------------|-----------------------|
| 20260331 | 2662584956.79 | 2644299859.12 | 1917493068.57 | 72.02 | 72.5142 |
| ... | ... | ... | ... | ... | ... |
