From 1da0c04242cc51b360680dc3dc4eba92ad4549eb Mon Sep 17 00:00:00 2001 From: drjones Date: Thu, 26 Feb 2026 18:00:55 -0800 Subject: [PATCH] Add force paper trading mode to ensure activity during testing --- .env.example | 1 + bot.py | 7 ++++++- config.py | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index bae04c5..ce033e0 100644 --- a/.env.example +++ b/.env.example @@ -13,6 +13,7 @@ SLIPPAGE_BPS=5 TRADE_INTERVAL_HOURS=2 CURATE_INTERVAL_MINUTES=30 TIMEZONE=America/Los_Angeles +FORCE_PAPER_TRADES=true OLLAMA_URL=http://10.30.20.110:11434 OLLAMA_CURATOR_MODEL=gemma3:latest diff --git a/bot.py b/bot.py index d484c4e..d45aaa3 100644 --- a/bot.py +++ b/bot.py @@ -43,7 +43,7 @@ def curate_cycle(): def run_cycle(): db = SessionLocal() try: - if not market_open(): + if not market_open() and not (settings.paper_mode and settings.force_paper_trades): return spent = _daily_spent(db) if spent >= settings.max_daily_notional: @@ -82,6 +82,11 @@ def run_cycle(): db.commit() db.refresh(drow) + if settings.paper_mode and settings.force_paper_trades and decision["action"] == "hold": + decision["action"] = "buy" + decision["confidence"] = max(decision.get("confidence", 0.0), settings.min_confidence) + decision["reason"] = f"{decision.get('reason','')} | force_paper_trades" + should_trade = decision["action"] in {"buy", "sell"} and decision["confidence"] >= settings.min_confidence if should_trade: diff --git a/config.py b/config.py index 1fd5955..64707fd 100644 --- a/config.py +++ b/config.py @@ -20,6 +20,7 @@ class Settings: trade_interval_hours = int(os.getenv("TRADE_INTERVAL_HOURS", "2")) curate_interval_minutes = int(os.getenv("CURATE_INTERVAL_MINUTES", "30")) timezone = os.getenv("TIMEZONE", "America/Los_Angeles") + force_paper_trades = os.getenv("FORCE_PAPER_TRADES", "true").lower() == "true" ollama_url = os.getenv("OLLAMA_URL", "http://10.30.20.110:11434") ollama_curator_model = os.getenv("OLLAMA_CURATOR_MODEL", "gemma3:latest")