backtest: replay the LIVE track only (v1) — shadow research tracks poisoned /backtest
replay_window reconstructed fires from ALL setup versions, so liq1/vr1/run1/pm1 (refuted shadow tracks, never traded live, 8:1 volume vs v1, tight-stop artifacts) dominated /backtest: 17k trades / 45 sessions at -1.8R/trade — garbage scale vs the harness-validated -0.08R/fire. reconstruct_fires_from_setups gains an optional setup_version filter (default None: experiments unchanged); replay_window pins it to v1. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d50115dea8
commit
a9aa37c885
2 files changed
+28
-2
No files matched your search
@@ -225,3 +225,22 @@ def test_backtest_route_serves_html():
|
||||
|
||||
if __name__ == "__main__": # pragma: no cover
|
||||
pytest.main([__file__, "-q"])
|
||||
|
||||
|
||||
def test_replay_window_replays_live_track_only():
|
||||
"""/backtest must judge the strategy that actually trades: setup_version v1.
|
||||
Shadow research tracks (liq1/vr1/run1/pm1 -- refuted, never traded live)
|
||||
share setup_events and would otherwise dominate the replay 8:1 with
|
||||
tight-stop artifacts (the 2026-07-17 -1.8R/trade garbage-scale bug)."""
|
||||
store = _seed_store()
|
||||
# a liq1 shadow fire on the same session/bars -- must NOT be replayed
|
||||
store.con.execute(
|
||||
"INSERT INTO setup_events (setup_id, symbol, session_date, setup_time, "
|
||||
"setup_name, setup_version, entry_reference_price, invalidation_price) "
|
||||
"VALUES (?,?,?,?,?,?,?,?)",
|
||||
[f"liq-AAA-{SESS1}", "AAA", SESS1,
|
||||
datetime(SESS1.year, SESS1.month, SESS1.day, 13, 35),
|
||||
"liquid_breakout", "liq1", 10.0, 9.0])
|
||||
from research.experiments.replay import replay_window
|
||||
out = replay_window(store, str(SESS1), str(SESS2))
|
||||
assert len(out["trades"]) == 4 # the 4 v1 fires only; liq1 excluded
|
||||
Reference in new issue
Block a user