Skip to content

Commit

Permalink
[Kucoin] warn on fetch position without currencies
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeDSM committed Nov 18, 2024
1 parent 4318329 commit f56c604
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Trading/Exchange/kucoin/kucoin_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,17 @@ async def get_balance(self, **kwargs: dict):
if self.exchange_manager.is_future:
# on futures, balance has to be fetched per currency
# use gather to fetch everything at once (and not allow other requests to get in between)
await asyncio.gather(*(
self._update_balance(balance, currency, **kwargs)
for currency in self.exchange_manager.exchange_config.get_all_traded_currencies()
))
currencies = self.exchange_manager.exchange_config.get_all_traded_currencies()
if not currencies:
self.logger.warning(
f"Can't fetch balance on {self.exchange_manager.exchange_name} futures when no traded currencies "
f"are set"
)
else:
await asyncio.gather(*(
self._update_balance(balance, currency, **kwargs)
for currency in currencies
))
return balance
return await super().get_balance(**kwargs)

Expand Down

0 comments on commit f56c604

Please sign in to comment.