72 lines
2.3 KiB
Python
72 lines
2.3 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Run Clean Trading Dashboard
|
|
Simple runner for the modular dashboard implementation
|
|
"""
|
|
|
|
import logging
|
|
import sys
|
|
import os
|
|
|
|
# Setup logging
|
|
logging.basicConfig(
|
|
level=logging.INFO,
|
|
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
|
)
|
|
logger = logging.getLogger(__name__)
|
|
|
|
def main():
|
|
"""Main function to run the clean dashboard"""
|
|
try:
|
|
logger.info("Starting Clean Trading Dashboard...")
|
|
|
|
# Import core components
|
|
from core.data_provider import DataProvider
|
|
from core.orchestrator import TradingOrchestrator
|
|
from core.trading_executor import TradingExecutor
|
|
|
|
# Import clean dashboard
|
|
from web.clean_dashboard import create_clean_dashboard
|
|
|
|
# Initialize components
|
|
logger.info("Initializing trading components...")
|
|
data_provider = DataProvider()
|
|
|
|
# Try to use enhanced orchestrator if available
|
|
try:
|
|
from core.enhanced_orchestrator import EnhancedTradingOrchestrator
|
|
orchestrator = EnhancedTradingOrchestrator(
|
|
data_provider=data_provider,
|
|
symbols=['ETH/USDT', 'BTC/USDT']
|
|
)
|
|
logger.info("Using Enhanced Trading Orchestrator")
|
|
except ImportError:
|
|
orchestrator = TradingOrchestrator(data_provider=data_provider)
|
|
logger.info("Using Standard Trading Orchestrator")
|
|
|
|
trading_executor = TradingExecutor()
|
|
|
|
# Create and run dashboard
|
|
logger.info("Creating clean dashboard...")
|
|
dashboard = create_clean_dashboard(
|
|
data_provider=data_provider,
|
|
orchestrator=orchestrator,
|
|
trading_executor=trading_executor
|
|
)
|
|
|
|
logger.info("Dashboard created successfully!")
|
|
logger.info("Starting server on http://127.0.0.1:8051")
|
|
|
|
# Run the dashboard
|
|
dashboard.run_server(host='127.0.0.1', port=8051, debug=False)
|
|
|
|
except KeyboardInterrupt:
|
|
logger.info("Dashboard stopped by user")
|
|
except Exception as e:
|
|
logger.error(f"Error running clean dashboard: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
sys.exit(1)
|
|
|
|
if __name__ == "__main__":
|
|
main() |