Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions Trading/Exchange/coinbase/coinbase_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,7 @@ async def _load_markets(
market_filter: typing.Optional[typing.Callable[[dict], bool]] = None
):
# override for retrier and populate ALIASED_SYMBOLS
try:
if self.exchange_manager.exchange.FETCH_MIN_EXCHANGE_MARKETS and market_filter:
with ccxt_client_util.filtered_fetched_markets(client, market_filter):
await client.load_markets(reload=reload)
else:
await client.load_markets(reload=reload)
except Exception as err:
# ensure this is not a proxy error, raise dedicated error if it is
if proxy_error := ccxt_client_util.get_proxy_error_if_any(self, err):
raise ccxt_client_util.get_proxy_error_class(proxy_error)(proxy_error) from err
raise
await self._filtered_if_necessary_load_markets(client, reload, market_filter)
# only call _refresh_alias_symbols from here as markets just got reloaded,
# no market can be missing unlike when using cached markets
_refresh_alias_symbols(client)
Expand Down Expand Up @@ -260,11 +250,7 @@ async def _ensure_auth(self):
# Override of ccxt_connector._ensure_auth to use get_open_orders instead and propagate authentication errors
try:
# load markets before calling _ensure_auth() to avoid fetching markets status while they are cached
with self.error_describer():
await self.load_symbol_markets(
reload=not self.exchange_manager.use_cached_markets,
market_filter=self.exchange_manager.market_filter,
)
await self._unauth_ensure_exchange_init()
# replace self.exchange_manager.exchange.get_balance by get_open_orders
# to mitigate coinbase balance cache side effect
await self.exchange_manager.exchange.get_open_orders(symbol="BTC/USDC")
Expand Down
20 changes: 5 additions & 15 deletions Trading/Exchange/kucoin/kucoin_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,11 @@ async def _load_markets(
market_filter: typing.Optional[typing.Callable[[dict], bool]] = None
):
# override for retrier
try:
if self.exchange_manager.exchange.FETCH_MIN_EXCHANGE_MARKETS and market_filter:
with ccxt_client_util.filtered_fetched_markets(client, market_filter):
await client.load_markets(reload=reload)
else:
await client.load_markets(reload=reload)
# sometimes market fees are missing because they are fetched from all tickers
# and all ticker can miss symbols on kucoin
if client.markets:
ccxt_client_util.fix_client_missing_markets_fees(client, reload, _CACHED_CONFIRMED_FEES_BY_SYMBOL)
except Exception as err:
# ensure this is not a proxy error, raise dedicated error if it is
if proxy_error := ccxt_client_util.get_proxy_error_if_any(self, err):
raise ccxt_client_util.get_proxy_error_class(proxy_error)(proxy_error) from err
raise
await self._filtered_if_necessary_load_markets(client, reload, market_filter)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

# sometimes market fees are missing because they are fetched from all tickers
# and all ticker can miss symbols on kucoin
if client.markets:
ccxt_client_util.fix_client_missing_markets_fees(client, reload, _CACHED_CONFIRMED_FEES_BY_SYMBOL)

class Kucoin(exchanges.RestExchange):
FIX_MARKET_STATUS = True
Expand Down