80 lines
2.4 KiB
Python
80 lines
2.4 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Run Main Trading Dashboard
|
|
|
|
Dedicated script to run the main TradingDashboard with all trading controls,
|
|
RL training monitoring, and position management features.
|
|
|
|
Usage:
|
|
python run_main_dashboard.py
|
|
"""
|
|
|
|
import sys
|
|
import logging
|
|
from pathlib import Path
|
|
|
|
# Add project root to path
|
|
project_root = Path(__file__).parent
|
|
sys.path.insert(0, str(project_root))
|
|
|
|
from core.config import setup_logging, get_config
|
|
from core.data_provider import DataProvider
|
|
from core.enhanced_orchestrator import EnhancedTradingOrchestrator
|
|
from core.trading_executor import TradingExecutor
|
|
from web.dashboard import TradingDashboard
|
|
|
|
def main():
|
|
"""Run the main TradingDashboard with enhanced orchestrator"""
|
|
# Setup logging
|
|
setup_logging()
|
|
logger = logging.getLogger(__name__)
|
|
|
|
try:
|
|
logger.info("=" * 70)
|
|
logger.info("STARTING MAIN TRADING DASHBOARD WITH ENHANCED RL")
|
|
logger.info("=" * 70)
|
|
|
|
# Create components with enhanced orchestrator
|
|
data_provider = DataProvider()
|
|
|
|
# Use enhanced orchestrator for comprehensive RL training
|
|
orchestrator = EnhancedTradingOrchestrator(
|
|
data_provider=data_provider,
|
|
symbols=['ETH/USDT', 'BTC/USDT'],
|
|
enhanced_rl_training=True
|
|
)
|
|
logger.info("Enhanced Trading Orchestrator created for comprehensive RL training")
|
|
|
|
trading_executor = TradingExecutor()
|
|
|
|
# Create dashboard with enhanced orchestrator
|
|
dashboard = TradingDashboard(
|
|
data_provider=data_provider,
|
|
orchestrator=orchestrator,
|
|
trading_executor=trading_executor
|
|
)
|
|
|
|
logger.info("TradingDashboard created successfully")
|
|
logger.info("Starting web server at http://127.0.0.1:8051")
|
|
logger.info("Open your browser to access the trading interface")
|
|
|
|
# Run the dashboard
|
|
dashboard.app.run(
|
|
host='127.0.0.1',
|
|
port=8051,
|
|
debug=False,
|
|
use_reloader=False
|
|
)
|
|
|
|
except KeyboardInterrupt:
|
|
logger.info("Dashboard stopped by user")
|
|
except Exception as e:
|
|
logger.error(f"Error running dashboard: {e}")
|
|
import traceback
|
|
logger.error(traceback.format_exc())
|
|
return 1
|
|
|
|
return 0
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main()) |