Explorar el Código

Refactor notification handling in CopyTradingMonitor

- Replaced calls to send_message with send_generic_notification for improved consistency in notification management.
- Updated multiple instances in the CopyTradingMonitor class to utilize the new notification method, enhancing code clarity and maintainability.
Carles Sentis hace 5 días
padre
commit
7aa9e36ccc
Se han modificado 2 ficheros con 5 adiciones y 5 borrados
  1. 4 4
      src/monitoring/copy_trading_monitor.py
  2. 1 1
      trading_bot.py

+ 4 - 4
src/monitoring/copy_trading_monitor.py

@@ -160,7 +160,7 @@ class CopyTradingMonitor:
             if self.notifications_enabled:
                 try:
                     await asyncio.wait_for(
-                        self.notification_manager.send_message(startup_message),
+                        self.notification_manager.send_generic_notification(startup_message),
                         timeout=5.0
                     )
                 except Exception as e:
@@ -408,7 +408,7 @@ class CopyTradingMonitor:
             # Send notification
             if self.notifications_enabled:
                 status = "✅ SUCCESS" if success else "❌ FAILED"
-                await self.notification_manager.send_message(
+                await self.notification_manager.send_generic_notification(
                     f"🔄 Copy Trade {status}\n"
                     f"Action: {trade.action}\n"
                     f"Asset: {trade.coin}\n"
@@ -425,7 +425,7 @@ class CopyTradingMonitor:
             await self.state_manager.add_copied_trade_async(trade.original_trade_hash)
             
             if self.notifications_enabled:
-                await self.notification_manager.send_message(
+                await self.notification_manager.send_generic_notification(
                     f"❌ Copy Trade Error\n"
                     f"Asset: {trade.coin}\n"
                     f"Action: {trade.action}\n"
@@ -595,7 +595,7 @@ class CopyTradingMonitor:
                 duration_hours = session_info['session_duration_seconds'] / 3600
                 duration_str = f"\nSession duration: {duration_hours:.1f} hours"
             
-            await self.notification_manager.send_message(
+            await self.notification_manager.send_generic_notification(
                 f"🛑 Copy Trading Stopped\n"
                 f"📊 Tracked positions: {session_info['tracked_positions_count']}\n"
                 f"🔄 Copied trades: {session_info['copied_trades_count']}"

+ 1 - 1
trading_bot.py

@@ -14,7 +14,7 @@ from datetime import datetime
 from pathlib import Path
 
 # Bot version
-BOT_VERSION = "3.0.330"
+BOT_VERSION = "3.0.331"
 
 # Add src directory to Python path
 sys.path.insert(0, str(Path(__file__).parent / "src"))