|
@@ -189,11 +189,19 @@ class HyperliquidClient:
|
|
logger.error("❌ Client not initialized")
|
|
logger.error("❌ Client not initialized")
|
|
return None
|
|
return None
|
|
|
|
|
|
- positions = self.sync_client.fetch_positions([symbol] if symbol else None)
|
|
|
|
|
|
+ # Add user parameter for Hyperliquid CCXT compatibility
|
|
|
|
+ params = {}
|
|
|
|
+ if Config.HYPERLIQUID_PRIVATE_KEY:
|
|
|
|
+ wallet_address = Config.HYPERLIQUID_PRIVATE_KEY
|
|
|
|
+ params['user'] = f"0x{wallet_address}" if not wallet_address.startswith('0x') else wallet_address
|
|
|
|
+
|
|
|
|
+ logger.debug(f"🔍 Fetching positions with params: {params}")
|
|
|
|
+ positions = self.sync_client.fetch_positions([symbol] if symbol else None, params=params)
|
|
logger.info(f"✅ Successfully fetched positions for {symbol or 'all symbols'}")
|
|
logger.info(f"✅ Successfully fetched positions for {symbol or 'all symbols'}")
|
|
return positions
|
|
return positions
|
|
except Exception as e:
|
|
except Exception as e:
|
|
logger.error(f"❌ Error fetching positions: {e}")
|
|
logger.error(f"❌ Error fetching positions: {e}")
|
|
|
|
+ logger.debug(f"💡 Attempted with params: {params}")
|
|
return None
|
|
return None
|
|
|
|
|
|
def get_market_data(self, symbol: str) -> Optional[Dict[str, Any]]:
|
|
def get_market_data(self, symbol: str) -> Optional[Dict[str, Any]]:
|
|
@@ -280,11 +288,19 @@ class HyperliquidClient:
|
|
logger.error("❌ Client not initialized")
|
|
logger.error("❌ Client not initialized")
|
|
return None
|
|
return None
|
|
|
|
|
|
- orders = self.sync_client.fetch_open_orders(symbol)
|
|
|
|
|
|
+ # Add user parameter for Hyperliquid CCXT compatibility
|
|
|
|
+ params = {}
|
|
|
|
+ if Config.HYPERLIQUID_PRIVATE_KEY:
|
|
|
|
+ wallet_address = Config.HYPERLIQUID_PRIVATE_KEY
|
|
|
|
+ params['user'] = f"0x{wallet_address}" if not wallet_address.startswith('0x') else wallet_address
|
|
|
|
+
|
|
|
|
+ logger.debug(f"🔍 Fetching open orders with params: {params}")
|
|
|
|
+ orders = self.sync_client.fetch_open_orders(symbol, params=params)
|
|
logger.info(f"✅ Successfully fetched open orders for {symbol or 'all symbols'}")
|
|
logger.info(f"✅ Successfully fetched open orders for {symbol or 'all symbols'}")
|
|
return orders
|
|
return orders
|
|
except Exception as e:
|
|
except Exception as e:
|
|
logger.error(f"❌ Error fetching open orders: {e}")
|
|
logger.error(f"❌ Error fetching open orders: {e}")
|
|
|
|
+ logger.debug(f"💡 Attempted with params: {params}")
|
|
return None
|
|
return None
|
|
|
|
|
|
def cancel_order(self, order_id: str, symbol: str, params: Optional[Dict] = None) -> bool:
|
|
def cancel_order(self, order_id: str, symbol: str, params: Optional[Dict] = None) -> bool:
|