Sfoglia il codice sorgente

Refactor InfoCommandsHandler to accept the bot instance, improving command access and structure. This change enhances the integration of command handlers for balance, positions, orders, stats, price, market, performance, daily, weekly, monthly, trades, and risk, streamlining the overall command management within the TelegramTradingBot.

Carles Sentis 1 settimana fa
parent
commit
f7ce690ebf
2 ha cambiato i file con 17 aggiunte e 16 eliminazioni
  1. 16 15
      src/bot/core.py
  2. 1 1
      trading_bot.py

+ 16 - 15
src/bot/core.py

@@ -71,21 +71,22 @@ class TelegramTradingBot:
 
         # Create a class to hold all info commands
         class InfoCommandsHandler:
-            def __init__(self):
-                self.balance_command = self.balance_cmds.balance_command
-                self.positions_command = self.positions_cmds.positions_command
-                self.orders_command = self.orders_cmds.orders_command
-                self.stats_command = self.stats_cmds.stats_command
-                self.price_command = self.price_cmds.price_command
-                self.market_command = self.market_cmds.market_command
-                self.performance_command = self.performance_cmds.performance_command
-                self.daily_command = self.daily_cmds.daily_command
-                self.weekly_command = self.weekly_cmds.weekly_command
-                self.monthly_command = self.monthly_cmds.monthly_command
-                self.trades_command = self.trades_cmds.trades_command
-                self.risk_command = self.risk_cmds.risk_command
-
-        self.info_commands = InfoCommandsHandler()
+            def __init__(self, bot):
+                self.bot = bot
+                self.balance_command = bot.balance_cmds.balance_command
+                self.positions_command = bot.positions_cmds.positions_command
+                self.orders_command = bot.orders_cmds.orders_command
+                self.stats_command = bot.stats_cmds.stats_command
+                self.price_command = bot.price_cmds.price_command
+                self.market_command = bot.market_cmds.market_command
+                self.performance_command = bot.performance_cmds.performance_command
+                self.daily_command = bot.daily_cmds.daily_command
+                self.weekly_command = bot.weekly_cmds.weekly_command
+                self.monthly_command = bot.monthly_cmds.monthly_command
+                self.trades_command = bot.trades_cmds.trades_command
+                self.risk_command = bot.risk_cmds.risk_command
+
+        self.info_commands = InfoCommandsHandler(self)
         
         # Pass info and management command handlers to TradingCommands
         self.trading_commands = TradingCommands(

+ 1 - 1
trading_bot.py

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