Skip to content

Latest commit

 

History

History
208 lines (151 loc) · 6.83 KB

File metadata and controls

208 lines (151 loc) · 6.83 KB

ETH Walk-Forward 校准记忆文档

会话日期: 2026-06-06
项目: quant-system-core-logic v0.3.0
数据源: crypto_factor_lab ETH 15m + smart flow v9 rolling pool
机器可读报告: reports/eth_walkforward_report.json


1. 背景与目标

quant-system-core-logic 框架跑通 52 项单元测试后,对 真实 ETH 数据 做 walk-forward 评估。用户确认的三项校准任务:

  1. ETH 1h 降频 — 提高评分阈值、加长冷却,减少 15m over-trade
  2. Smart flow 叠加cs_rolling_flow / sf_signal 作为 alpha 层叠在 Regime 框架上
  3. 全历史 walk-forward 报告 — DSR / PBO / 胜率 / 回撤,对比 TA vs TA+flow

结论 upfront:8 个场景 0 个通过 deploy gate;当前 flow parquet 无法复现 v9 历史 OOS +38.6%;需先 refresh smart flow 地址池再评估。


2. 数据与路径

用途 路径
ETH 15m K 线 /mnt/c/Users/raphael/crypto_factor_lab/data/market_data/merged/ETHUSDT_15m_merged.parquet
Smart flow (ETH 专属池) .../research/flow_15m_rolling_ETH_specific.parquet
最新 live 信号 .../signals/latest_signal.json
v9 历史报告 .../research/REPORT_v9.md
评估脚本 scripts/run_eth_evaluation.py(21d 快评)
全量报告脚本 scripts/run_eth_walkforward_report.py
Smart flow 模块 src/quant_core/alpha/smart_flow.py

数据范围

  • K 线:105,121 根 15m(2023-06-06 ~ 2026-06-05)
  • Flow:9,284 根 15m(从 2024-03-01 起,之前无 flow)
  • 1h resample:26,281 根

3. 场景定义

3.1 Regime + TA 引擎场景(QuantSystemEngine

场景 ID 周期 Smart Flow 配置要点
baseline_15m_21d 15m 默认参数,近 ~21 天
ta_15m_moderate_full 15m entry_threshold=7,flow 期全样本
ta_1h_moderate_full 1h threshold=7,cooldown 30min,8 笔/日
ta_1h_moderate_sf 1h moderate + flow 方向对齐
ta_1h_strict_full 1h threshold=8,cooldown 1h,5 笔/日
ta_1h_smartflow_full 1h strict + flow 对齐

Hold 规则:1h 场景 hold 4 bars(4h);15m 场景 hold 4 bars(1h proxy)。
成本:5 bps round-trip。

3.2 Smart flow 基准场景

场景 ID 说明
smartflow_v9_style_15m v9 口径:exact-time merge、log return、非重叠、GATE_PCT=0.9HOLD=16
regime_trend_smartflow_15m Regime=TREND 时才跟 gated flow

3.3 Deploy Gate(全部场景统一)

≥30 笔交易
AND 总收益 > 0
AND DSR > 0 且 DSR p-value ≤ 0.05
AND walk-forward degradation ≤ 0.5

4. 评估结果(2026-06-06 跑批)

场景 交易数 胜率 总收益 MaxDD Sharpe DSR p 可部署
baseline_15m_21d 20 50.0% +2.07% 1.2% 41.7 0.000 NO
ta_15m_moderate_full 12 16.7% -3.67% 3.7% -216.5 1.000 NO
ta_1h_moderate_full 8 75.0% +1.77% 0.9% 28.6 0.000 NO
ta_1h_moderate_sf 8 37.5% -0.64% 2.2% -7.0 1.000 NO
ta_1h_strict_full 5 60.0% -0.17% 1.3% -3.8 1.000 NO
ta_1h_smartflow_full 5 40.0% -1.28% 2.9% -17.3 1.000 NO
smartflow_v9_style_15m 293 51.2% -10.71% 41.8% -2.3 1.000 NO
regime_trend_smartflow_15m 755 49.8% -25.04% 51.1% -3.3 1.000 NO

Smart flow v9 分段(train_end = 2025-01-01

分段 交易数 总收益 备注
In-sample (< 2025) 77 -1.12%
OOS (≥ 2025-01-01) 216 -9.70% v9 报告 OOS 为 +38.6% / 401 笔 — 未复现

5. 关键结论

5.1 框架本身 OK

  • Regime 分类、评分门禁、Meta-Label、风控分层、validation gate 逻辑正常
  • 最新 K 线:regime=trendsignal=flatexecute=false — 合理观望
  • 52 pytest 全绿

5.2 15m 默认 TA 不可实盘

  • 全样本 walk-forward(早期 eval):248 笔,-10.35%,Sharpe -13.1
  • 近 21 天偶然 +2.07%(20 笔)— 样本不足,不可部署

5.3 1h 降频有效但过严

  • strict:3 年仅 5 笔 → 无统计意义
  • moderate:8 笔 +1.77%,方向正确但 < 30 笔 deploy gate
  • 1h 是正确方向,需在 moderate/strict 之间继续网格搜索

5.4 Smart flow 当前失效

  • 当前 flow_15m_rolling_ETH_specific.parquet 按 v9 口径回测 整体 -10.71%
  • TA + flow 叠加 无改善(58 次 TA 信号被 flow 拦截后剩余 5 笔仍负)
  • Regime + flow 过度交易(755 笔,-25%)

5.5 v9 历史 vs 现状差异

指标 REPORT_v9 (历史) 当前复现
ETH OOS 交易数 401 216
ETH OOS 收益 +38.6% -9.7%
可能原因 地址池/flow 数据已 stale;市场结构变化;PG 导出时间差

6. 推荐下一步(按优先级)

  1. Refresh smart flow 地址池
    cd /mnt/c/Users/raphael/crypto_factor_lab
    bash scripts/smart_flow_cron.sh   # 或 smart_flow_pipeline.py
  2. 重跑报告
    cd ~/quant-system-core-logic
    uv run python scripts/run_eth_walkforward_report.py
  3. 若 OOS 恢复正收益 → 采用架构:
    • Alpha 层:gated smart flow(v9 口径,非重叠 16×15m hold)
    • Gate 层:Regime ≠ EXTREME/HIGH_VOL;TA 评分 ≥ moderate threshold
    • Risk 层:现有 5%/10%/20% 回撤分层 + 1h cooldown
  4. 禁止 在未过 deploy gate 前启用实盘

7. 配置快照(代码内常量)

# 1h strict
ScoringConfig(entry_threshold=8)
RiskConfig(min_seconds_between_orders=3600, max_trades_per_day=5)

# 1h moderate
ScoringConfig(entry_threshold=7)
RiskConfig(min_seconds_between_orders=1800, max_trades_per_day=8)

# Smart flow v9
GATE_PCT = 0.9
GATE_WINDOW = 672
HOLD_BARS = 16
COST_BPS = 5
TRAIN_END_OOS = "2025-01-01"

8. 相关 commit / 文件清单

新增/修改

  • src/quant_core/alpha/smart_flow.py
  • scripts/run_eth_evaluation.py
  • scripts/run_eth_walkforward_report.py
  • tests/test_smart_flow.py
  • reports/eth_walkforward_report.json
  • reports/eth_walkforward_report.md
  • 本文档

运行命令

# 快评(21 天 + live decision)
uv run python scripts/run_eth_evaluation.py

# 全量 8 场景报告
uv run python scripts/run_eth_walkforward_report.py

9. 变更日志

日期 事件
2026-06-06 初版框架 52 tests;15m 全样本 eval 失败 (-10.35%)
2026-06-06 1h 降频 + smart flow 叠加 + 8 场景 walk-forward;0 deployable
2026-06-06 确认 v9 OOS 无法复现;文档化 + push git

Last updated: 2026-06-06