diff --git a/NN/exchanges/mexc_interface.py b/NN/exchanges/mexc_interface.py index 9c4cd94..23b3a6a 100644 --- a/NN/exchanges/mexc_interface.py +++ b/NN/exchanges/mexc_interface.py @@ -49,14 +49,14 @@ class MEXCInterface(ExchangeInterface): """Test connection to MEXC API by fetching account info.""" if not self.api_key or not self.api_secret: logger.error("MEXC API key or secret not set. Cannot connect.") - return False + return False # Test connection by making a small, authenticated request try: account_info = self.get_account_info() if account_info: logger.info("Successfully connected to MEXC API and retrieved account info.") - return True + return True else: logger.error("Failed to connect to MEXC API: Could not retrieve account info.") return False @@ -182,7 +182,7 @@ class MEXCInterface(ExchangeInterface): if balance.get('asset') == asset.upper(): return float(balance.get('free', 0.0)) logger.warning(f"Could not retrieve free balance for {asset}") - return 0.0 + return 0.0 def get_ticker(self, symbol: str) -> Optional[Dict[str, Any]]: """Get ticker information for a symbol.""" @@ -190,13 +190,13 @@ class MEXCInterface(ExchangeInterface): endpoint = "ticker/24hr" params = {'symbol': formatted_symbol} - response = self._send_public_request('GET', endpoint, params) + response = self._send_public_request('GET', endpoint, params) if response: # MEXC ticker returns a dictionary if single symbol, list if all symbols - if isinstance(response, dict): + if isinstance(response, dict): ticker_data = response - elif isinstance(response, list) and len(response) > 0: + elif isinstance(response, list) and len(response) > 0: # If the response is a list, try to find the specific symbol found_ticker = next((item for item in response if item.get('symbol') == formatted_symbol), None) if found_ticker: @@ -264,7 +264,7 @@ class MEXCInterface(ExchangeInterface): order_result = self._send_private_request('POST', endpoint, params) if order_result: logger.info(f"MEXC: Order placed successfully: {order_result}") - return order_result + return order_result else: logger.error(f"MEXC: Error placing order: {order_result}") return {} @@ -329,7 +329,7 @@ class MEXCInterface(ExchangeInterface): open_orders = self._send_private_request('GET', endpoint, params) if open_orders and isinstance(open_orders, list): logger.info(f"MEXC: Retrieved {len(open_orders)} open orders.") - return open_orders + return open_orders else: logger.error(f"MEXC: Error getting open orders: {open_orders}") return []