diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 15b6bb2e7..73ea51119 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -3419,12 +3419,12 @@ class Exchange: def get_maintenance_ratio_and_amt( self, pair: str, - nominal_value: float, + notional_value: float, ) -> Tuple[float, Optional[float]]: """ Important: Must be fetching data from cached values as this is used by backtesting! :param pair: Market symbol - :param nominal_value: The total trade amount in quote currency + :param notional_value: The total trade amount in quote currency :return: (maintenance margin ratio, maintenance amount) """ @@ -3441,7 +3441,7 @@ class Exchange: pair_tiers = self._leverage_tiers[pair] for tier in reversed(pair_tiers): - if nominal_value >= tier["minNotional"]: + if notional_value >= tier["minNotional"]: return (tier["maintenanceMarginRate"], tier["maintAmt"]) raise ExchangeError("nominal value can not be lower than 0") diff --git a/tests/exchange/test_binance.py b/tests/exchange/test_binance.py index 1de464097..a5f9ea654 100644 --- a/tests/exchange/test_binance.py +++ b/tests/exchange/test_binance.py @@ -600,7 +600,7 @@ async def test__async_get_historic_ohlcv_binance(default_conf, mocker, caplog, c @pytest.mark.parametrize( - "pair,nominal_value,mm_ratio,amt", + "pair,notional_value,mm_ratio,amt", [ ("XRP/USDT:USDT", 0.0, 0.025, 0), ("BNB/USDT:USDT", 100.0, 0.0065, 0), @@ -615,12 +615,12 @@ def test_get_maintenance_ratio_and_amt_binance( mocker, leverage_tiers, pair, - nominal_value, + notional_value, mm_ratio, amt, ): mocker.patch(f"{EXMS}.exchange_has", return_value=True) exchange = get_patched_exchange(mocker, default_conf, exchange="binance") exchange._leverage_tiers = leverage_tiers - (result_ratio, result_amt) = exchange.get_maintenance_ratio_and_amt(pair, nominal_value) + (result_ratio, result_amt) = exchange.get_maintenance_ratio_and_amt(pair, notional_value) assert (round(result_ratio, 8), round(result_amt, 8)) == (mm_ratio, amt)