From 075e9b852601eb87ed6421a7acf9bc7d59e7d134 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 18 Aug 2022 09:52:03 +0200 Subject: [PATCH] Log Exchange responses for set_leverage --- freqtrade/exchange/exchange.py | 6 ++++-- freqtrade/wallets.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index dbc3447be..ef5b96096 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -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: diff --git a/freqtrade/wallets.py b/freqtrade/wallets.py index 14e5a6743..41115c72e 100644 --- a/freqtrade/wallets.py +++ b/freqtrade/wallets.py @@ -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,