mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-08-03 10:27:42 +00:00
feat: Auto-start dashboard for fin_quant
Add automatic dashboard launch options for trading loop: 1. CLI extension (rdagent/app/cli.py) --with-dashboard/-d: Automatically starts dashboard --dashboard-port: Dashboard port (default: 5000) Usage: rdagent fin_quant --with-dashboard rdagent fin_quant -d --dashboard-port 5001 2. Start script (start_trading.sh) - Activates Conda environment - Starts dashboard in background - Starts fin_quant - Cleanup on exit Usage: ./start_trading.sh Dashboard is now accessible at http://localhost:5000/dashboard.html once fin_quant is running.
This commit is contained in:
@@ -6,7 +6,9 @@ This will
|
||||
- autoamtically load dotenv
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
@@ -108,7 +110,35 @@ def fin_quant_cli(
|
||||
loop_n: Optional[int] = None,
|
||||
all_duration: Optional[str] = None,
|
||||
checkout: CheckoutOption = True,
|
||||
with_dashboard: bool = typer.Option(False, "--with-dashboard/-d", help="Start dashboard automatically"),
|
||||
dashboard_port: int = typer.Option(5000, "--dashboard-port", help="Dashboard port"),
|
||||
):
|
||||
"""
|
||||
Start EURUSD quantitative trading loop.
|
||||
|
||||
Use --with-dashboard to automatically start the web dashboard.
|
||||
"""
|
||||
import subprocess
|
||||
import threading
|
||||
import time
|
||||
|
||||
# Start Dashboard wenn gewünscht
|
||||
if with_dashboard:
|
||||
def start_dashboard():
|
||||
print(f"\n🚀 Starting Dashboard on http://localhost:{dashboard_port}...")
|
||||
print(f" Open: http://localhost:{dashboard_port}/dashboard.html\n")
|
||||
subprocess.run(
|
||||
["python", "web/dashboard_api.py"],
|
||||
cwd=str(Path(__file__).parent.parent.parent),
|
||||
env={**os.environ, "FLASK_ENV": "development"}
|
||||
)
|
||||
|
||||
# Dashboard im Hintergrund starten
|
||||
dashboard_thread = threading.Thread(target=start_dashboard, daemon=True)
|
||||
dashboard_thread.start()
|
||||
time.sleep(2) # Kurze Verzögerung damit Dashboard starten kann
|
||||
|
||||
# Fin Quant starten
|
||||
fin_quant(path=path, step_n=step_n, loop_n=loop_n, all_duration=all_duration, checkout=checkout)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user