66 lines
2.2 KiB
Python
66 lines
2.2 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test Dashboard Startup - Debug the scalping dashboard startup issue
|
|
"""
|
|
|
|
import logging
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
# Add project root to path
|
|
project_root = Path(__file__).parent
|
|
sys.path.insert(0, str(project_root))
|
|
|
|
# Setup logging
|
|
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
|
logger = logging.getLogger(__name__)
|
|
|
|
def test_dashboard_startup():
|
|
"""Test dashboard startup with detailed error reporting"""
|
|
try:
|
|
logger.info("Testing dashboard startup...")
|
|
|
|
# Test imports
|
|
logger.info("Testing imports...")
|
|
from core.data_provider import DataProvider
|
|
from core.enhanced_orchestrator import EnhancedTradingOrchestrator
|
|
from web.scalping_dashboard import create_scalping_dashboard
|
|
logger.info("✅ All imports successful")
|
|
|
|
# Test data provider
|
|
logger.info("Creating data provider...")
|
|
dp = DataProvider()
|
|
logger.info("✅ Data provider created")
|
|
|
|
# Test orchestrator
|
|
logger.info("Creating orchestrator...")
|
|
orch = EnhancedTradingOrchestrator(dp)
|
|
logger.info("✅ Orchestrator created")
|
|
|
|
# Test dashboard creation
|
|
logger.info("Creating dashboard...")
|
|
dashboard = create_scalping_dashboard(dp, orch)
|
|
logger.info("✅ Dashboard created successfully")
|
|
|
|
# Test data fetching
|
|
logger.info("Testing data fetching...")
|
|
test_data = dp.get_historical_data('ETH/USDT', '1m', limit=5)
|
|
if test_data is not None and not test_data.empty:
|
|
logger.info(f"✅ Data fetching works: {len(test_data)} candles")
|
|
else:
|
|
logger.warning("⚠️ No data returned from data provider")
|
|
|
|
# Start dashboard
|
|
logger.info("Starting dashboard on http://127.0.0.1:8051")
|
|
logger.info("Press Ctrl+C to stop")
|
|
dashboard.run(host='127.0.0.1', port=8051, debug=True)
|
|
|
|
except KeyboardInterrupt:
|
|
logger.info("Dashboard stopped by user")
|
|
except Exception as e:
|
|
logger.error(f"❌ Error: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
|
|
if __name__ == "__main__":
|
|
test_dashboard_startup() |