From 9d0a9df60e9e6af5e7edad3a65e072babdc4a85f Mon Sep 17 00:00:00 2001 From: momentum dev Date: Wed, 22 Jul 2026 09:29:55 -0500 Subject: [PATCH] backtest: raise session clamp 45 -> 300 (env BACKTEST_MAX_SESSIONS) The stored minute-bar history is 273 sessions (~13 months); the 45-session clamp blocked months-scale ranges now that the nightly labeler keeps setup_events current. Requests stay serialized behind _backtest_lock; a full-history run takes minutes by operator choice. Co-Authored-By: Claude Fable 5 --- api/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/main.py b/api/main.py index b649635..181b15d 100644 --- a/api/main.py +++ b/api/main.py @@ -581,7 +581,10 @@ class DashboardState: from strategy.exits import ExitConfig from strategy.population import PopulationConfig - MAX_SESSIONS = 45 + # cap protects the (serialized) request thread; 300 spans the full stored + # minute-bar history (~273 sessions) so months-scale ranges work via + # since/until — a full-history request runs minutes, operator's choice. + MAX_SESSIONS = int(os.environ.get("BACKTEST_MAX_SESSIONS", "300")) pop = PopulationConfig.from_env() regime_on = os.environ.get("TRADING_REGIME_GATE_ENABLED", "0").strip().lower() in { "1", "true", "yes", "on"}