From 133dc1d343b51d91f73ce04ab57caa9afa9a8a40 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 4 Jun 2024 19:42:04 +0200 Subject: [PATCH] api_async is mandatory ... --- freqtrade/exchange/exchange.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 6ddc524e5..5771682b5 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -151,7 +151,7 @@ class Exchange: :return: None """ self._api: ccxt.Exchange - self._api_async: ccxt_async.Exchange = None + self._api_async: ccxt_async.Exchange self._markets: Dict = {} self._trading_fees: Dict[str, Any] = {} self._leverage_tiers: Dict[str, List[Dict]] = {} @@ -532,14 +532,13 @@ class Exchange: def _load_async_markets(self, reload: bool = False) -> Dict[str, Any]: try: - if self._api_async: - markets = self.loop.run_until_complete( - self._api_async.load_markets(reload=reload, params={}) - ) + markets = self.loop.run_until_complete( + self._api_async.load_markets(reload=reload, params={}) + ) - if isinstance(markets, Exception): - raise markets - return markets + if isinstance(markets, Exception): + raise markets + return markets except asyncio.TimeoutError as e: logger.warning("Could not load markets. Reason: %s", e) raise TemporaryError from e