Procházet zdrojové kódy

Implement sync_client checks for deposit and withdrawal operations in Telegram bot - Add validation to ensure sync_client is available before fetching deposits and withdrawals, enhancing error handling and robustness in transaction monitoring.

Carles Sentis před 6 dny
rodič
revize
a943a49b57
1 změnil soubory, kde provedl 8 přidání a 2 odebrání
  1. 8 2
      src/telegram_bot.py

+ 8 - 2
src/telegram_bot.py

@@ -2109,9 +2109,15 @@ This will place a limit {exit_side} order at ${profit_price:,.2f} to capture pro
             new_deposits = 0
             new_withdrawals = 0
             
+            # Check if sync_client is available
+            if not hasattr(self.client, 'sync_client') or not self.client.sync_client:
+                logger.warning("⚠️ CCXT sync_client not available for deposit/withdrawal checking")
+                self.last_deposit_withdrawal_check = current_time
+                return
+            
             # Check for deposits
             try:
-                deposits = self.client.client.fetch_deposits(code='USDC', since=since_timestamp)
+                deposits = self.client.sync_client.fetch_deposits(code='USDC', since=since_timestamp)
                 if deposits:
                     for deposit in deposits:
                         amount = float(deposit.get('amount', 0))
@@ -2130,7 +2136,7 @@ This will place a limit {exit_side} order at ${profit_price:,.2f} to capture pro
             
             # Check for withdrawals
             try:
-                withdrawals = self.client.client.fetch_withdrawals(code='USDC', since=since_timestamp)
+                withdrawals = self.client.sync_client.fetch_withdrawals(code='USDC', since=since_timestamp)
                 if withdrawals:
                     for withdrawal in withdrawals:
                         amount = float(withdrawal.get('amount', 0))