Add force paper trading mode to ensure activity during testing

This commit is contained in:
2026-02-26 18:00:55 -08:00
parent dbf6bf4e73
commit 1da0c04242
3 changed files with 8 additions and 1 deletions

View File

@@ -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

7
bot.py
View File

@@ -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:

View File

@@ -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")