chinext50_regime_build_handoff_2026-04-08.md 3.7 KB

创业板50 Regime 项目构建交接(2026-04-08)

已完成内容

已在 chinext50_regime_project/ 下搭好一条最小可运行闭环:

  • data/
    • io.py:读取 CSV / parquet 历史数据
    • sample_data.py:生成 synthetic 创业板50风格日线与 breadth 示例数据
  • features/
    • price_features.py:价格/波动/ATR/突破/效率等特征
    • breadth_features.py:广度/集中度/扩散背离特征
    • relative_features.py:相对沪深300/科创50/中证1000强弱
    • pipeline.py:统一特征装配入口
  • model/
    • scores.py:trend/breadth/stress/crowding/repair 五分 + 三个 hazard
    • state_machine.pyrisk_off / repair / trend / chop / euphoric_late
    • policy.py:仓位映射、硬 veto、quantized exposure、日变动上限
  • backtest/
    • engine.py:next-open approximate 回测与指标计算
    • events.py:状态切换事件切片
    • utility.py:net utility 与状态判定
    • walkforward.py:默认 frozen-hypothesis 窗口
  • pipelines/
    • run_demo.py:端到端 demo
    • frozen_hypothesis_validation.py:先整段算完再按测试窗切片,避免短窗冷启动
  • tests/
    • 端到端 demo 测试
    • utility 测试
    • 仓位量化/步长约束测试

已输出的可直接查看产物

  • chinext50_regime_project/examples/synthetic_chinext50_sample.csv
  • chinext50_regime_project/outputs/demo/daily_ledger.csv
  • chinext50_regime_project/outputs/demo/event_summary.csv
  • chinext50_regime_project/outputs/demo/metrics_summary.json
  • chinext50_regime_project/outputs/frozen_validation/frozen_validation_board.csv
  • chinext50_regime_project/outputs/frozen_validation/frozen_validation_summary.json

当前已确认状态

  • pytest 通过(3 个测试)
  • demo / frozen validation 管线可执行
  • scaffold 现在已经不是空骨架,而是可接真实数据继续迭代的工程起点

当前明确限制

  1. 还没有接入真实创业板50历史数据

    • 现在 demo 用的是 synthetic 数据
    • synthetic 结果不能解释成真实经济效果证据
  2. 回测执行层仍是近似版

    • 当前用 next-open approximate 日频执行
    • 真实版本需要对 ETF 成交、开盘冲击、tracking gap 单独建模
  3. 权重和阈值还没有做真实数据上的 train/test 冻结校准

    • 当前参数是合理先验,不是已验证最优参数
  4. breadth 层仍然依赖外部聚合表

    • 真实版必须接入 point-in-time 成分股和调样历史,避免幸存者偏差

Codex 下一步最优先任务

P0:接入真实数据

需要准备一张 point-in-time 日表,至少包含:

  • date
  • open/high/low/close/volume
  • hs300_close
  • star50_close
  • csi1000_close
  • pct_constituents_above_20dma
  • pct_constituents_above_60dma
  • pct_new_high_20
  • pct_new_low_20
  • eq_weight_ret_5
  • weighted_ret_5
  • top3_contribution_5
  • corr_spike_20
  • dispersion_20

P1:重做 frozen-hypothesis walk-forward

不要在每个测试窗内重选赢家。流程应是:

  1. 训练窗内确定参数 / 阈值
  2. 固定假设
  3. 测试窗只评估,不改参数
  4. 汇总 window utility、drawdown、upside capture

P2:加事件锚定诊断

重点评估:

  • crash onset
  • false rebound
  • true repair
  • euphoric unwind

P3:补执行层真实约束

  • ETF 真实成交口径
  • 极端日成本模型
  • tracking difference / tracking error 监控

暂时不要做

  • 多市场 portability/readiness 系统
  • 大量宏观变量
  • RL / 深度学习
  • 复杂动作模板库

目标定义

第一阶段项目目标应是:

  • 相对 buy-and-hold 明显降低最大回撤
  • 保留大部分上涨段 capture
  • 成本后 utility 在多数测试窗口不为负

而不是直接追求“显著跑赢创业板50”。