Add force paper trading mode to ensure activity during testing
This commit is contained in:
7
bot.py
7
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:
|
||||
|
||||
Reference in New Issue
Block a user