🟡 回测绩效指标语义与边界处理(evaluation.py) #7

Closed
opened 2026-08-01 08:25:18 +08:00 by shellway · 0 comments
Owner

关联主报告:#1 — alpha/evaluation.py

待办项

  1. L35-36 — 'return' 列强制 diff(),默认当作累计收益;若传入日收益率则全部指标错算。明确列语义或增加 return_type 参数
  2. L49-50 — total_return 假设初始净值恒为 1.0;改为 nav.iloc[-1]/nav.iloc[0] - 1,处理 nav.iloc[0] <= 0
  3. L36/38 — 首个收益率 fillna(0) 引入零收益观测,低估波动;改为保留 NaN 或从第二有效值起算
  4. L53-57 — annual_return 硬编码 252,未考虑实际日历跨度/缺失日;total_return < -1 时几何年化出异常值,需保护
  5. L65-70 — max_drawdown 未处理 running_max <= 0,校验 nav > 0
  6. L90-95 — sharpe_ratio1e-12 magic epsilon,波动为 0 时返回巨大数值;返回 NaN/0 并警告
  7. L102-108 — sortino_ratio 实现的是负收益标准差,非标准 target downside deviation
  8. L115-120 — profit_loss_ratio 空序列 NaN/Inf,需分别判断
  9. L124-157 — alpha/beta/IR 未校验基准类型、索引重叠、样本量
关联主报告:#1 — `alpha/evaluation.py` ## 待办项 1. **L35-36 — `'return'` 列强制 `diff()`,默认当作累计收益**;若传入日收益率则全部指标错算。明确列语义或增加 `return_type` 参数 2. **L49-50 — `total_return` 假设初始净值恒为 1.0**;改为 `nav.iloc[-1]/nav.iloc[0] - 1`,处理 `nav.iloc[0] <= 0` 3. **L36/38 — 首个收益率 `fillna(0)` 引入零收益观测**,低估波动;改为保留 NaN 或从第二有效值起算 4. **L53-57 — `annual_return` 硬编码 `252` 天**,未考虑实际日历跨度/缺失日;`total_return < -1` 时几何年化出异常值,需保护 5. **L65-70 — `max_drawdown` 未处理 `running_max <= 0`**,校验 `nav > 0` 6. **L90-95 — `sharpe_ratio` 用 `1e-12` magic epsilon**,波动为 0 时返回巨大数值;返回 NaN/0 并警告 7. **L102-108 — `sortino_ratio` 实现的是负收益标准差**,非标准 target downside deviation 8. **L115-120 — `profit_loss_ratio` 空序列 NaN/Inf**,需分别判断 9. **L124-157 — alpha/beta/IR 未校验基准类型、索引重叠、样本量**
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shellway/quanxiel#7