#!/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.orchestrator import TradingOrchestrator from core.trading_executor import TradingExecutor from web.dashboard import TradingDashboard def main(): """Run the main TradingDashboard""" # Setup logging setup_logging() logger = logging.getLogger(__name__) try: logger.info("=" * 60) logger.info("STARTING MAIN TRADING DASHBOARD") logger.info("=" * 60) logger.info("Features:") logger.info("- Live trading with BUY/SELL controls") logger.info("- Real-time RL training monitoring") logger.info("- Position management & P&L tracking") logger.info("- Performance metrics & trade history") logger.info("- Model accuracy & confidence tracking") logger.info("=" * 60) # Get configuration config = get_config() # Initialize components data_provider = DataProvider() orchestrator = TradingOrchestrator(data_provider=data_provider) trading_executor = TradingExecutor() # Create the main trading dashboard 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 shutdown requested by user") except Exception as e: logger.error(f"Error running main trading dashboard: {e}") import traceback logger.error(traceback.format_exc()) if __name__ == "__main__": main()