🔴 未来函数(look-ahead bias)风险汇总 #3

Closed
opened 2026-08-01 08:25:10 +08:00 by shellway · 1 comment
Owner

关联主报告:#1

多处存在未来函数/前视偏差风险,回测前必须处理。

待办项

  1. alpha/config.py L24 — end_date 默认未来日期 "2025-12-31"

    • 回测可能拉取"未来数据"或空数据
    • 默认 date.today().isoformat(),并校验 end_date <= today
  2. quantitative_data/config.py L61 — END_DATE 默认 "2025-12-31"

    • 同上,默认改为 date.today(),业务层显式覆盖
  3. alpha/factors.py L121-125/L151-154 — 因子全局标准化

    • mom.mean()/std()series.mean()/std() 在全时间序列+全截面计算 → 用到未来日期和其他股票信息
    • 改为截面标准化:s.groupby(level=0).transform(...)
  4. alpha/factors.py L214-225 — ic_decay 用全样本相关性

    • 混叠时间序列与截面信息,非标准截面 IC 衰减
    • 改为逐截面 Rank IC 后取均值
  5. quantitative_data/importer.py 财务数据 — 以 end_date 作冲突键

    • income/balancesheet/cashflow/fina_indicator 应以 ann_date/f_ann_date(公告日)作为实际可用时点,否则下游按报告期末使用数据即引入未来信息
    • 建议后端增加 ann_date <= 当前交易日 的 point-in-time 视图
关联主报告:#1 多处存在未来函数/前视偏差风险,回测前必须处理。 ## 待办项 1. **`alpha/config.py` L24 — `end_date` 默认未来日期 `"2025-12-31"`** - 回测可能拉取"未来数据"或空数据 - 默认 `date.today().isoformat()`,并校验 `end_date <= today` 2. **`quantitative_data/config.py` L61 — `END_DATE` 默认 `"2025-12-31"`** - 同上,默认改为 `date.today()`,业务层显式覆盖 3. **`alpha/factors.py` L121-125/L151-154 — 因子全局标准化** - `mom.mean()/std()`、`series.mean()/std()` 在全时间序列+全截面计算 → 用到未来日期和其他股票信息 - 改为截面标准化:`s.groupby(level=0).transform(...)` 4. **`alpha/factors.py` L214-225 — `ic_decay` 用全样本相关性** - 混叠时间序列与截面信息,非标准截面 IC 衰减 - 改为逐截面 Rank IC 后取均值 5. **`quantitative_data/importer.py` 财务数据 — 以 `end_date` 作冲突键** - `income/balancesheet/cashflow/fina_indicator` 应以 `ann_date`/`f_ann_date`(公告日)作为实际可用时点,否则下游按报告期末使用数据即引入未来信息 - 建议后端增加 `ann_date <= 当前交易日` 的 point-in-time 视图
Author
Owner

待数据获取及存储模块调试完成后解决。

待数据获取及存储模块调试完成后解决。
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shellway/quanxiel#3