async def fetch_huobi_trading_pairs(self) -> List[str]: try: from hummingbot.market.huobi.huobi_market import HuobiMarket client: aiohttp.ClientSession = self.http_client() async with client.get(HUOBI_ENDPOINT, timeout=API_CALL_TIMEOUT) as response: if response.status == 200: all_trading_pairs: Dict[str, any] = await response.json() valid_trading_pairs: list = [] for item in all_trading_pairs["data"]: if item["state"] == "online": valid_trading_pairs.append(item["symbol"]) trading_pair_list: List[str] = [] for raw_trading_pair in valid_trading_pairs: converted_trading_pair: Optional[str] = \ HuobiMarket.convert_from_exchange_trading_pair(raw_trading_pair) if converted_trading_pair is not None: trading_pair_list.append(converted_trading_pair) else: self.logger().debug( f"Could not parse the trading pair {raw_trading_pair}, skipping it..." ) return trading_pair_list except Exception: # Do nothing if the request fails -- there will be no autocomplete for huobi trading pairs pass return []
async def fetch_huobi_trading_pairs() -> List[str]: from hummingbot.market.huobi.huobi_market import HuobiMarket async with aiohttp.ClientSession() as client: async with client.get(HUOBI_ENDPOINT, timeout=API_CALL_TIMEOUT) as response: if response.status == 200: try: all_trading_pairs: Dict[str, any] = await response.json() valid_trading_pairs: list = [] for item in all_trading_pairs["data"]: if item["state"] == "online": valid_trading_pairs.append(item["symbol"]) return [ HuobiMarket.convert_from_exchange_trading_pair(p) for p in valid_trading_pairs ] except Exception: pass # Do nothing if the request fails -- there will be no autocomplete for huobi trading pairs return []