2025-05-29 23:50:41 +08:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
"""
|
|
|
|
|
Main entry point for the Crypto Trading Bot Dashboard.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import sys
|
2025-06-03 12:49:46 +08:00
|
|
|
import logging
|
2025-05-29 23:50:41 +08:00
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
# Add project root to path
|
|
|
|
|
project_root = Path(__file__).parent
|
|
|
|
|
sys.path.insert(0, str(project_root))
|
|
|
|
|
|
|
|
|
|
|
2025-05-29 23:04:08 +08:00
|
|
|
def main():
|
2025-05-29 23:50:41 +08:00
|
|
|
"""Main application entry point."""
|
|
|
|
|
print("🚀 Crypto Trading Bot Dashboard")
|
|
|
|
|
print("=" * 40)
|
|
|
|
|
|
2025-06-03 12:49:46 +08:00
|
|
|
# Suppress SQLAlchemy database logging for cleaner console output
|
|
|
|
|
logging.getLogger('sqlalchemy').setLevel(logging.WARNING)
|
|
|
|
|
logging.getLogger('sqlalchemy.engine').setLevel(logging.WARNING)
|
|
|
|
|
logging.getLogger('sqlalchemy.pool').setLevel(logging.WARNING)
|
|
|
|
|
logging.getLogger('sqlalchemy.dialects').setLevel(logging.WARNING)
|
|
|
|
|
logging.getLogger('sqlalchemy.orm').setLevel(logging.WARNING)
|
|
|
|
|
|
2025-05-29 23:50:41 +08:00
|
|
|
try:
|
|
|
|
|
from config.settings import app, dashboard
|
|
|
|
|
print(f"Environment: {app.environment}")
|
|
|
|
|
print(f"Debug mode: {app.debug}")
|
|
|
|
|
|
|
|
|
|
if app.environment == "development":
|
|
|
|
|
print("\n🔧 Running in development mode")
|
2025-06-03 12:09:37 +08:00
|
|
|
print("Dashboard features available:")
|
|
|
|
|
print("✅ Basic Dash application framework")
|
|
|
|
|
print("✅ Real-time price charts (sample data)")
|
|
|
|
|
print("✅ System health monitoring")
|
|
|
|
|
print("🚧 Real data connection (coming in task 3.7)")
|
2025-05-29 23:50:41 +08:00
|
|
|
|
2025-06-03 12:09:37 +08:00
|
|
|
# Start the Dash application
|
|
|
|
|
print(f"\n🌐 Starting dashboard at: http://{dashboard.host}:{dashboard.port}")
|
|
|
|
|
print("Press Ctrl+C to stop the application")
|
2025-05-29 23:50:41 +08:00
|
|
|
|
2025-06-03 12:09:37 +08:00
|
|
|
from app import main as app_main
|
|
|
|
|
app_main()
|
2025-05-29 23:50:41 +08:00
|
|
|
|
|
|
|
|
except ImportError as e:
|
|
|
|
|
print(f"❌ Failed to import modules: {e}")
|
|
|
|
|
print("Run: uv sync")
|
|
|
|
|
sys.exit(1)
|
2025-06-03 12:09:37 +08:00
|
|
|
except KeyboardInterrupt:
|
|
|
|
|
print("\n\n👋 Dashboard stopped by user")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
except Exception as e:
|
|
|
|
|
print(f"❌ Failed to start dashboard: {e}")
|
|
|
|
|
sys.exit(1)
|
2025-05-29 23:04:08 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
main()
|