|
@@ -52,9 +52,48 @@ class TelegramTradingBot:
|
|
|
|
|
|
# Initialize command handlers
|
|
|
self.management_commands = ManagementCommands(self.trading_engine, self.market_monitor)
|
|
|
+
|
|
|
+ # Instantiate new info command classes
|
|
|
+ self.balance_cmds = BalanceCommands(self.trading_engine, self.notification_manager)
|
|
|
+ self.positions_cmds = PositionsCommands(self.trading_engine, self.notification_manager)
|
|
|
+ self.orders_cmds = OrdersCommands(self.trading_engine, self.notification_manager)
|
|
|
+ self.stats_cmds = StatsCommands(self.trading_engine, self.notification_manager)
|
|
|
+ self.trades_cmds = TradesCommands(self.trading_engine, self.notification_manager)
|
|
|
+ self.market_cmds = MarketCommands(self.trading_engine, self.notification_manager)
|
|
|
+ self.performance_cmds = PerformanceCommands(self.trading_engine, self.notification_manager)
|
|
|
+ self.daily_cmds = DailyCommands(self.trading_engine, self.notification_manager)
|
|
|
+ self.weekly_cmds = WeeklyCommands(self.trading_engine, self.notification_manager)
|
|
|
+ self.monthly_cmds = MonthlyCommands(self.trading_engine, self.notification_manager)
|
|
|
+ self.risk_cmds = RiskCommands(self.trading_engine, self.notification_manager)
|
|
|
+ self.price_cmds = PriceCommands(self.trading_engine, self.notification_manager)
|
|
|
+ self.balance_adjustments_cmds = BalanceAdjustmentsCommands(self.trading_engine, self.notification_manager)
|
|
|
+ self.commands_cmds = CommandsInfo(self.trading_engine, self.notification_manager)
|
|
|
+
|
|
|
+ # 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()
|
|
|
+
|
|
|
# Pass info and management command handlers to TradingCommands
|
|
|
- self.trading_commands = TradingCommands(self.trading_engine, self.notification_manager,
|
|
|
- management_commands_handler=self.management_commands)
|
|
|
+ self.trading_commands = TradingCommands(
|
|
|
+ self.trading_engine,
|
|
|
+ self.notification_manager,
|
|
|
+ management_commands_handler=self.management_commands,
|
|
|
+ info_commands_handler=self.info_commands
|
|
|
+ )
|
|
|
|
|
|
def is_authorized(self, chat_id: str) -> bool:
|
|
|
"""Check if the chat ID is authorized to use the bot."""
|
|
@@ -91,22 +130,6 @@ class TelegramTradingBot:
|
|
|
self.application.add_handler(CommandHandler("tp", self.trading_commands.tp_command))
|
|
|
self.application.add_handler(CommandHandler("coo", self.trading_commands.coo_command))
|
|
|
|
|
|
- # Instantiate new info command classes
|
|
|
- self.balance_cmds = BalanceCommands(self.trading_engine, self.notification_manager)
|
|
|
- self.positions_cmds = PositionsCommands(self.trading_engine, self.notification_manager)
|
|
|
- self.orders_cmds = OrdersCommands(self.trading_engine, self.notification_manager)
|
|
|
- self.stats_cmds = StatsCommands(self.trading_engine, self.notification_manager)
|
|
|
- self.trades_cmds = TradesCommands(self.trading_engine, self.notification_manager)
|
|
|
- self.market_cmds = MarketCommands(self.trading_engine, self.notification_manager)
|
|
|
- self.performance_cmds = PerformanceCommands(self.trading_engine, self.notification_manager)
|
|
|
- self.daily_cmds = DailyCommands(self.trading_engine, self.notification_manager)
|
|
|
- self.weekly_cmds = WeeklyCommands(self.trading_engine, self.notification_manager)
|
|
|
- self.monthly_cmds = MonthlyCommands(self.trading_engine, self.notification_manager)
|
|
|
- self.risk_cmds = RiskCommands(self.trading_engine, self.notification_manager)
|
|
|
- self.price_cmds = PriceCommands(self.trading_engine, self.notification_manager)
|
|
|
- self.balance_adjustments_cmds = BalanceAdjustmentsCommands(self.trading_engine, self.notification_manager)
|
|
|
- self.commands_cmds = CommandsInfo(self.trading_engine, self.notification_manager)
|
|
|
-
|
|
|
# Info commands
|
|
|
self.application.add_handler(CommandHandler("balance", self.balance_cmds.balance_command))
|
|
|
self.application.add_handler(CommandHandler("positions", self.positions_cmds.positions_command))
|