Pārlūkot izejas kodu

Refactor trade lifecycle management in InfoCommands for improved clarity and functionality.

- Replaced references to the old trade lifecycle manager with the new trade manager, streamlining the handling of pending stop loss activations.
- Updated logic to ensure consistent retrieval of pending stop loss trades, enhancing the overall monitoring of stop loss conditions.
Carles Sentis 1 nedēļu atpakaļ
vecāks
revīzija
794136186d
2 mainītis faili ar 4 papildinājumiem un 4 dzēšanām
  1. 3 3
      src/commands/info_commands.py
  2. 1 1
      trading_bot.py

+ 3 - 3
src/commands/info_commands.py

@@ -480,7 +480,7 @@ class InfoCommands:
                                             displayed_sl_parent_refs.add(bot_ref_id)
                                 
                                 # Also check for pending SL in trade lifecycle (new system)
-                                lifecycle_manager = stats.trade_lifecycle_manager
+                                lifecycle_manager = stats.trade_manager
                                 if lifecycle_manager:
                                     pending_trade = lifecycle_manager.get_lifecycle_by_entry_order_id(exchange_order_id, status='pending')
                                     if pending_trade and pending_trade.get('stop_loss_price'):
@@ -537,8 +537,8 @@ class InfoCommands:
                     orders_text += "📭 No open orders\n\n"
                     
                     # Check for pending SLs from trade lifecycle even if no exchange orders
-                    if stats and stats.trade_lifecycle_manager:
-                        pending_sl_trades = stats.trade_lifecycle_manager.get_pending_stop_loss_activations()
+                    if stats and stats.trade_manager:
+                        pending_sl_trades = stats.trade_manager.get_pending_stop_loss_activations()
                         
                         if pending_sl_trades:
                             orders_text += "\n⏳ <b>Pending Stop Loss Activations</b>\n\n"

+ 1 - 1
trading_bot.py

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