diff --git a/freqtrade/exchange/binance.py b/freqtrade/exchange/binance.py index 715c9fb04..d9eef4170 100644 --- a/freqtrade/exchange/binance.py +++ b/freqtrade/exchange/binance.py @@ -155,11 +155,11 @@ class Binance(Exchange): except ccxt.BaseError as e: raise OperationalException(e) from e - def get_max_leverage(self, pair: Optional[str], margin: Optional[float]) -> float: + def get_max_leverage(self, pair: str, stake_amount: Optional[float]) -> float: """ Returns the maximum leverage that a pair can be traded at :param pair: The base/quote currency pair being traded - :margin: The total value of the traders collateral in quote currency + :stake_amount: The total value of the traders collateral in quote currency """ if pair not in self._leverage_brackets: return 1.0 @@ -167,9 +167,11 @@ class Binance(Exchange): max_lev = 1.0 for [min_amount, margin_req] in pair_brackets: lev = 1/margin_req - nominal_value = margin * lev + nominal_value = stake_amount * lev if nominal_value >= min_amount: max_lev = lev + else: + break return max_lev @retrier diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 58321a2db..e737d2b2a 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -1807,7 +1807,7 @@ class Exchange: """ return - def get_max_leverage(self, pair: Optional[str], nominal_value: Optional[float]) -> float: + def get_max_leverage(self, pair: str, stake_amount: Optional[float]) -> float: """ Returns the maximum leverage that a pair can be traded at :param pair: The base/quote currency pair being traded