Log Exchange responses for set_leverage

This commit is contained in:
Matthias 2022-08-18 09:52:03 +02:00
parent 46e8d9a5e4
commit 075e9b8526
2 changed files with 5 additions and 3 deletions

View File

@ -2377,7 +2377,8 @@ class Exchange:
return
try:
self._api.set_leverage(symbol=pair, leverage=leverage)
res = self._api.set_leverage(symbol=pair, leverage=leverage)
self._log_exchange_response('set_leverage', res)
except ccxt.DDoSProtection as e:
raise DDosProtection(e) from e
except (ccxt.NetworkError, ccxt.ExchangeError) as e:
@ -2441,7 +2442,8 @@ class Exchange:
return
try:
self._api.set_margin_mode(margin_mode.value, pair, params)
res = self._api.set_margin_mode(margin_mode.value, pair, params)
self._log_exchange_response('set_margin_mode', res)
except ccxt.DDoSProtection as e:
raise DDosProtection(e) from e
except (ccxt.NetworkError, ccxt.ExchangeError) as e:

View File

@ -148,7 +148,7 @@ class Wallets:
# Position is not open ...
continue
size = self._exchange._contracts_to_amount(symbol, position['contracts'])
collateral = position['collateral']
collateral = position['collateral'] or 0.0
leverage = position['leverage']
self._positions[symbol] = PositionWallet(
symbol, position=size,