Add force paper trading mode to ensure activity during testing
This commit is contained in:
@@ -13,6 +13,7 @@ SLIPPAGE_BPS=5
|
|||||||
TRADE_INTERVAL_HOURS=2
|
TRADE_INTERVAL_HOURS=2
|
||||||
CURATE_INTERVAL_MINUTES=30
|
CURATE_INTERVAL_MINUTES=30
|
||||||
TIMEZONE=America/Los_Angeles
|
TIMEZONE=America/Los_Angeles
|
||||||
|
FORCE_PAPER_TRADES=true
|
||||||
|
|
||||||
OLLAMA_URL=http://10.30.20.110:11434
|
OLLAMA_URL=http://10.30.20.110:11434
|
||||||
OLLAMA_CURATOR_MODEL=gemma3:latest
|
OLLAMA_CURATOR_MODEL=gemma3:latest
|
||||||
|
|||||||
7
bot.py
7
bot.py
@@ -43,7 +43,7 @@ def curate_cycle():
|
|||||||
def run_cycle():
|
def run_cycle():
|
||||||
db = SessionLocal()
|
db = SessionLocal()
|
||||||
try:
|
try:
|
||||||
if not market_open():
|
if not market_open() and not (settings.paper_mode and settings.force_paper_trades):
|
||||||
return
|
return
|
||||||
spent = _daily_spent(db)
|
spent = _daily_spent(db)
|
||||||
if spent >= settings.max_daily_notional:
|
if spent >= settings.max_daily_notional:
|
||||||
@@ -82,6 +82,11 @@ def run_cycle():
|
|||||||
db.commit()
|
db.commit()
|
||||||
db.refresh(drow)
|
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
|
should_trade = decision["action"] in {"buy", "sell"} and decision["confidence"] >= settings.min_confidence
|
||||||
|
|
||||||
if should_trade:
|
if should_trade:
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ class Settings:
|
|||||||
trade_interval_hours = int(os.getenv("TRADE_INTERVAL_HOURS", "2"))
|
trade_interval_hours = int(os.getenv("TRADE_INTERVAL_HOURS", "2"))
|
||||||
curate_interval_minutes = int(os.getenv("CURATE_INTERVAL_MINUTES", "30"))
|
curate_interval_minutes = int(os.getenv("CURATE_INTERVAL_MINUTES", "30"))
|
||||||
timezone = os.getenv("TIMEZONE", "America/Los_Angeles")
|
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_url = os.getenv("OLLAMA_URL", "http://10.30.20.110:11434")
|
||||||
ollama_curator_model = os.getenv("OLLAMA_CURATOR_MODEL", "gemma3:latest")
|
ollama_curator_model = os.getenv("OLLAMA_CURATOR_MODEL", "gemma3:latest")
|
||||||
|
|||||||
Reference in New Issue
Block a user