69 lines
1.9 KiB
Python
69 lines
1.9 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Dashboard Launcher - Start the Trading Dashboard
|
|
|
|
This script properly sets up the Python path and launches the dashboard
|
|
with all necessary components initialized.
|
|
"""
|
|
|
|
import sys
|
|
import os
|
|
import logging
|
|
|
|
# Add current directory to Python path
|
|
sys.path.insert(0, os.path.abspath('.'))
|
|
|
|
# Setup logging
|
|
logging.basicConfig(
|
|
level=logging.INFO,
|
|
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
|
)
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
def main():
|
|
"""Main entry point for dashboard"""
|
|
try:
|
|
logger.info("=" * 60)
|
|
logger.info("STARTING TRADING DASHBOARD")
|
|
logger.info("=" * 60)
|
|
|
|
# Import dashboard components
|
|
from web.dashboard import create_dashboard
|
|
from core.data_provider import DataProvider
|
|
from core.orchestrator import TradingOrchestrator
|
|
from core.trading_executor import TradingExecutor
|
|
|
|
logger.info("Initializing components...")
|
|
|
|
# Create components
|
|
data_provider = DataProvider()
|
|
orchestrator = TradingOrchestrator(data_provider)
|
|
trading_executor = TradingExecutor()
|
|
|
|
logger.info("Creating dashboard...")
|
|
|
|
# Create and run dashboard
|
|
dashboard = create_dashboard(
|
|
data_provider=data_provider,
|
|
orchestrator=orchestrator,
|
|
trading_executor=trading_executor
|
|
)
|
|
|
|
logger.info("Dashboard created successfully!")
|
|
logger.info("Starting web server...")
|
|
|
|
# Run the dashboard
|
|
dashboard.run(host='127.0.0.1', port=8050, debug=False)
|
|
|
|
except KeyboardInterrupt:
|
|
logger.info("Dashboard shutdown requested by user")
|
|
sys.exit(0)
|
|
except Exception as e:
|
|
logger.error(f"Error starting dashboard: {e}")
|
|
import traceback
|
|
logger.error(traceback.format_exc())
|
|
sys.exit(1)
|
|
|
|
if __name__ == "__main__":
|
|
main() |