feat: require gate reset before post-stop reentry
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
"""Run the four production cadence/lockdown arms on one offline snapshot.
|
||||
"""Run the four production cadence/re-entry arms on one offline snapshot.
|
||||
|
||||
The command executes the complete backtest once weekly and once daily. Each
|
||||
backtest contains two otherwise identical live-policy portfolio arms: no
|
||||
post-stop lockdown and the production five-session lockdown. It writes both
|
||||
full reports plus one compact four-arm comparison report.
|
||||
backtest contains two otherwise identical live-policy portfolio arms: immediate
|
||||
post-stop re-entry and the production gate-reset rule. It writes both full
|
||||
reports plus one compact four-arm comparison report.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -77,7 +77,8 @@ def _print_arm(row: dict) -> None:
|
||||
print(
|
||||
f" {row['arm']}: Sharpe {row.get('sharpe')}, "
|
||||
f"CAGR {row.get('cagr_pct')}%, DD {row.get('max_drawdown_pct')}%, "
|
||||
f"trades {row.get('trades')}, skipped cooldown {row.get('skipped_cooldown', 0)}"
|
||||
f"trades {row.get('trades')}, post-stop re-entries "
|
||||
f"{row.get('post_stop_reentries', 0)}"
|
||||
)
|
||||
|
||||
|
||||
@@ -139,16 +140,16 @@ async def _main() -> None:
|
||||
expected = {
|
||||
"prod_live_setup_weekly",
|
||||
"prod_live_setup_daily",
|
||||
"cooldown_5_weekly",
|
||||
"cooldown_5_daily",
|
||||
"gate_reset_weekly",
|
||||
"gate_reset_daily",
|
||||
}
|
||||
if {row.get("arm") for row in arms} != expected:
|
||||
raise RuntimeError("The generated cadence report does not contain all four arms")
|
||||
arm_order = {
|
||||
"prod_live_setup_weekly": 0,
|
||||
"prod_live_setup_daily": 1,
|
||||
"cooldown_5_weekly": 2,
|
||||
"cooldown_5_daily": 3,
|
||||
"gate_reset_weekly": 2,
|
||||
"gate_reset_daily": 3,
|
||||
}
|
||||
arms.sort(key=lambda row: arm_order[str(row["arm"])])
|
||||
|
||||
@@ -164,7 +165,7 @@ async def _main() -> None:
|
||||
"note": (
|
||||
"All four arms use the same snapshot, activation settings, target model, "
|
||||
"live Admin exit policy, fees, sizing, and portfolio constraints. Within "
|
||||
"each cadence pair, only the five-session post-stop lockdown differs."
|
||||
"each cadence pair, only the post-stop gate-reset rule differs."
|
||||
),
|
||||
}
|
||||
comparison_path = out_dir / f"{prefix}-comparison.json"
|
||||
|
||||
Reference in New Issue
Block a user