From cc37b9c93b3447293391807b621ef155e08ccff1 Mon Sep 17 00:00:00 2001 From: xxm Date: Sun, 16 Aug 2026 20:16:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B8=A9=E5=8C=BA=E5=B9=B4=E5=8C=96?= =?UTF-8?q?=E5=8F=A3=E5=BE=84=E2=80=94=E2=80=94=E7=BA=BF=E6=80=A7=E6=94=BE?= =?UTF-8?q?=E5=A4=A7=E6=94=B9=E4=B8=BA=E6=8C=89=E6=B8=A9=E5=8C=BAtrades?= =?UTF-8?q?=E5=AE=9E=E9=99=85=E8=B7=A8=E5=BA=A6=E5=A4=8D=E5=88=A9=E5=B9=B4?= =?UTF-8?q?=E5=8C=96(b=5Ftd1=201547%=E5=A4=B1=E7=9C=9F=E6=A0=B9=E5=9B=A0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/profile-scripts/regime_perf_by_period.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/deploy/profile-scripts/regime_perf_by_period.py b/deploy/profile-scripts/regime_perf_by_period.py index ae8b20cd..2af55711 100644 --- a/deploy/profile-scripts/regime_perf_by_period.py +++ b/deploy/profile-scripts/regime_perf_by_period.py @@ -147,9 +147,17 @@ def process_period(conn, market, period_tag): if not sim: continue ret = sim.get("total_return_pct") - # 线性年化:收益 × (窗口总天数 / 该温区窗口内天数) - rd = reg_days.get(reg, 0) - cagr = round(ret * (total_days / rd), 1) if ret is not None and rd > 0 and total_days > 0 else None + # 复利年化(2026-08-16 修正):按该温区 trades 实际时间跨度 + # 原线性放大 ret×(total_days/rd) 对高频复利策略失真(b_td1 388%×4=1547%) + _eds = [t.get("entry_date") for t in reg_trades if t.get("entry_date")] + if ret is not None and _eds: + from datetime import datetime as _dt + _d0 = _dt.strptime(min(_eds), "%Y-%m-%d") + _d1 = _dt.strptime(max(_eds), "%Y-%m-%d") + span_days = max((_d1 - _d0).days, 30) + cagr = round(((1 + ret / 100) ** (365 / span_days) - 1) * 100, 1) + else: + cagr = None conn.execute( """INSERT OR REPLACE INTO strategy_regime_perf_by_period (strategy, market, regime, period_tag, trades, win_rate, avg_pnl, avg_hold_days,