# ETF净值

- 接口：etf_net_value
- 路径：/api/v2/market/data/etf-net-value
- 方法：GET
- 描述：按 ETF 代码分页查询历史净值，返回发布日、净值日期、资产净值、单位净值、累计净值、净值增长率、复权净值、每万份收益和 7 日年化收益率等数据。支持查询单个净值日期或日期区间。
- 数据范围：按 ETF 代码和净值日期查询；实际可查询日期以接口返回为准
- 单次限量：默认 `page=1`、`page_size=50`，`page_size` 最大为 200
- 提示：
  - `etf_code` 必填，可传 ETF 代码，如 `510300`；兼容参数名 `fund_code`，建议使用 `etf_code`。
  - 必须提供 `nav_date`，或同时提供 `start_date` 和 `end_date`。
  - `nav_date` 不能与 `start_date`、`end_date` 同时使用。
  - 日期格式为 YYYYMMDD；区间查询包含开始日期和结束日期，且 `start_date` 不得晚于 `end_date`。
  - `net_asset`、`unit_nav` 等数值字段以字符串形式返回，以保留小数精度。

## 输入参数

| 名称 | 类型 | 必选 | 描述 |
|------|------|------|------|
| etf_code | string | Y | ETF 代码，如 `510300`；兼容参数名 `fund_code` |
| nav_date | integer | N | 净值日期 YYYYMMDD；与日期区间参数互斥 |
| start_date | integer | N | 净值开始日期 YYYYMMDD；须与 `end_date` 同时提供 |
| end_date | integer | N | 净值结束日期 YYYYMMDD；须与 `start_date` 同时提供 |
| page | integer | N | 页码，从 1 开始，默认 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 | ETF 净值列表 |
| total_pages | integer | Y | 总页数 |
| total_items | integer | Y | 总记录数 |

items 数组：

| 名称 | 类型 | 默认显示 | 描述 |
|------|------|---------|------|
| trade_code | string | Y | ETF 交易代码 |
| publish_date | integer | Y | 发布日期 YYYYMMDD |
| nav_date | integer | Y | 净值日期 YYYYMMDD |
| net_asset | string | Y | 资产净值 |
| unit_nav | string | Y | 单位净值 |
| unit_nav_growth | string | Y | 单位净值增长率，单位 % |
| accumulated_nav | string | Y | 累计单位净值 |
| adjustment_factor | string | Y | 复权因子 |
| adjusted_unit_nav | string | Y | 复权单位净值 |
| adjusted_unit_nav_growth | string | Y | 复权单位净值增长率，单位 % |
| daily_profit | string | Y | 每万份基金收益 |
| seven_day_annualized_return | string | Y | 7 日年化收益率，单位 % |

## 接口示例

按净值日期查询：

```bash
curl -sS "https://market.ft.tech/gateway/api/v2/market/data/etf-net-value?etf_code=510300&nav_date=20260909&page=1&page_size=5"
```

按日期区间查询：

```bash
curl -sS "https://market.ft.tech/gateway/api/v2/market/data/etf-net-value?etf_code=510300&start_date=20260901&end_date=20260909&page=1&page_size=5"
```

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

```python
import ftshare as ft

market = ft.market_api()

# 按日期区间查询，默认返回 DataFrame
df = market.etf_net_value(etf_code="510300", start_date="20260901", end_date="20260910", page=1, page_size=5)
print(df[["trade_code", "nav_date", "unit_nav", "accumulated_nav", "unit_nav_growth"]].head(3))
#   trade_code  nav_date  unit_nav  accumulated_nav  unit_nav_growth
# 0   510300.OF  20260910    4.6177           2.0394        -0.478459
# ...

# 返回原始 JSON
payload = market.etf_net_value(etf_code="510300", start_date="20260901", end_date="20260910", page=1, page_size=5, raw=True)
```

## 数据样例

`etf_code=510300` 按日期区间 `20260901`-`20260910`（节选）：

| trade_code | publish_date | nav_date | net_asset | unit_nav | unit_nav_growth | accumulated_nav | adjustment_factor | adjusted_unit_nav | adjusted_unit_nav_growth | daily_profit | seven_day_annualized_return |
|------------|--------------|----------|-----------|----------|-----------------|-----------------|-------------------|-------------------|--------------------------|--------------|-----------------------------|
| 510300.OF | 20260911 | 20260910 | 0 | 4.6177 | -0.478459 | 2.0394 | 0.469479 | 2.167913 | -0.478439 | 0 | 0 |
| 510300.OF | 20260910 | 20260909 | 0 | 4.6399 | 0.306981 | 2.0476 | 0.469479 | 2.178335 | 0.306953 | 0 | 0 |
| 510300.OF | 20260909 | 20260908 | 0 | 4.6257 | -0.348995 | 2.0423 | 0.469479 | 2.171669 | -0.348969 | 0 | 0 |
| 510300.OF | 20260908 | 20260907 | 0 | 4.6419 | 0.589421 | 2.0483 | 0.469479 | 2.179274 | 0.589382 | 0 | 0 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
