|
@@ -40,19 +40,23 @@ class MonitoringCoordinator:
|
|
|
self.risk_manager = RiskManager(hl_client, notification_manager, config)
|
|
|
self.alarm_manager = AlarmManager() # AlarmManager only needs alarms_file (defaults to data/price_alarms.json)
|
|
|
|
|
|
- # Initialize copy trading monitor if available
|
|
|
- if COPY_TRADING_AVAILABLE:
|
|
|
- try:
|
|
|
- # DISABLE AGAIN: Still causing blocking issues
|
|
|
- # self.copy_trading_monitor = CopyTradingMonitor(hl_client, notification_manager)
|
|
|
- # logger.info("✅ Copy trading monitor initialized (with non-blocking state manager)")
|
|
|
- self.copy_trading_monitor = None
|
|
|
- logger.info("🚫 Copy trading monitor disabled - still causing blocking")
|
|
|
- except Exception as e:
|
|
|
- logger.error(f"❌ Failed to initialize copy trading monitor: {e}")
|
|
|
- self.copy_trading_monitor = None
|
|
|
- else:
|
|
|
+ # Initialize copy trading monitor (Step 2: Initialize but don't start)
|
|
|
+ try:
|
|
|
+ from src.monitoring.copy_trading_monitor import CopyTradingMonitor
|
|
|
+ self.copy_trading_monitor = CopyTradingMonitor(
|
|
|
+ self.hl_client,
|
|
|
+ self.notification_manager
|
|
|
+ )
|
|
|
+ logger.info("✅ Copy trading monitor initialized (Step 2: not auto-starting)")
|
|
|
+ self.copy_trading_available = True
|
|
|
+ except ImportError as e:
|
|
|
+ logger.warning(f"Copy trading monitor not available: {e}")
|
|
|
self.copy_trading_monitor = None
|
|
|
+ self.copy_trading_available = False
|
|
|
+ except Exception as e:
|
|
|
+ logger.error(f"Error initializing copy trading monitor: {e}")
|
|
|
+ self.copy_trading_monitor = None
|
|
|
+ self.copy_trading_available = False
|
|
|
|
|
|
# Exchange order synchronization (will be initialized with trading stats)
|
|
|
self.exchange_order_sync = None
|
|
@@ -79,13 +83,15 @@ class MonitoringCoordinator:
|
|
|
await self.risk_manager.start()
|
|
|
# AlarmManager doesn't have start() method - it's always ready
|
|
|
|
|
|
- # Start copy trading monitor if enabled
|
|
|
- if self.copy_trading_monitor and hasattr(self.copy_trading_monitor, 'enabled') and self.copy_trading_monitor.enabled:
|
|
|
- try:
|
|
|
- asyncio.create_task(self.copy_trading_monitor.start_monitoring())
|
|
|
- logger.info("🔄 Copy trading monitor started (with non-blocking state manager)")
|
|
|
- except Exception as e:
|
|
|
- logger.error(f"❌ Failed to start copy trading monitor: {e}")
|
|
|
+ # Start copy trading monitor if enabled (Step 2: Don't auto-start yet)
|
|
|
+ # if self.copy_trading_monitor and hasattr(self.copy_trading_monitor, 'enabled') and self.copy_trading_monitor.enabled:
|
|
|
+ # try:
|
|
|
+ # asyncio.create_task(self.copy_trading_monitor.start_monitoring())
|
|
|
+ # logger.info("🔄 Copy trading monitor started (with non-blocking state manager)")
|
|
|
+ # except Exception as e:
|
|
|
+ # logger.error(f"❌ Failed to start copy trading monitor: {e}")
|
|
|
+ if self.copy_trading_monitor:
|
|
|
+ logger.info("🔄 Copy trading monitor initialized but not auto-started (Step 2 testing)")
|
|
|
|
|
|
# Initialize exchange order sync with trading stats
|
|
|
self._init_exchange_order_sync()
|