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
2 changes: 1 addition & 1 deletion Trading/Exchange/binance/binance_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def get_additional_connector_config(self):
"filterClosed": False, # return empty positions as well
}
}
if trading_constants.FETCH_MIN_EXCHANGE_MARKETS:
if self.FETCH_MIN_EXCHANGE_MARKETS:
config[ccxt_constants.CCXT_OPTIONS][ccxt_constants.CCXT_FETCH_MARKETS] = (
[
BinanceMarkets.LINEAR.value, BinanceMarkets.INVERSE.value
Expand Down
13 changes: 11 additions & 2 deletions Trading/Exchange/coinbase/coinbase_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,19 @@ def _keys_adapter(self, creds: exchanges.ExchangeCredentialsData) -> exchanges.E
return creds

@_coinbase_retrier
async def _load_markets(self, client, reload: bool):
async def _load_markets(
self,
client,
reload: bool,
market_filter: typing.Optional[typing.Callable[[dict], bool]] = None
):
# override for retrier and populate ALIASED_SYMBOLS
try:
await client.load_markets(reload=reload)
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):
Expand Down
13 changes: 11 additions & 2 deletions Trading/Exchange/kucoin/kucoin_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,19 @@ async def kucoin_retrier_wrapper(*args, **kwargs):
class KucoinConnector(ccxt_connector.CCXTConnector):

@_kucoin_retrier
async def _load_markets(self, client, reload: bool):
async def _load_markets(
self,
client,
reload: bool,
market_filter: typing.Optional[typing.Callable[[dict], bool]] = None
):
# override for retrier
try:
await client.load_markets(reload=reload)
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:
Expand Down