mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-12 19:23:55 +00:00
chore: Improve wording
This commit is contained in:
parent
aec749fdb6
commit
5c371133a0
|
@ -3419,12 +3419,12 @@ class Exchange:
|
||||||
def get_maintenance_ratio_and_amt(
|
def get_maintenance_ratio_and_amt(
|
||||||
self,
|
self,
|
||||||
pair: str,
|
pair: str,
|
||||||
nominal_value: float,
|
notional_value: float,
|
||||||
) -> Tuple[float, Optional[float]]:
|
) -> Tuple[float, Optional[float]]:
|
||||||
"""
|
"""
|
||||||
Important: Must be fetching data from cached values as this is used by backtesting!
|
Important: Must be fetching data from cached values as this is used by backtesting!
|
||||||
:param pair: Market symbol
|
: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)
|
:return: (maintenance margin ratio, maintenance amount)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -3441,7 +3441,7 @@ class Exchange:
|
||||||
pair_tiers = self._leverage_tiers[pair]
|
pair_tiers = self._leverage_tiers[pair]
|
||||||
|
|
||||||
for tier in reversed(pair_tiers):
|
for tier in reversed(pair_tiers):
|
||||||
if nominal_value >= tier["minNotional"]:
|
if notional_value >= tier["minNotional"]:
|
||||||
return (tier["maintenanceMarginRate"], tier["maintAmt"])
|
return (tier["maintenanceMarginRate"], tier["maintAmt"])
|
||||||
|
|
||||||
raise ExchangeError("nominal value can not be lower than 0")
|
raise ExchangeError("nominal value can not be lower than 0")
|
||||||
|
|
|
@ -600,7 +600,7 @@ async def test__async_get_historic_ohlcv_binance(default_conf, mocker, caplog, c
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"pair,nominal_value,mm_ratio,amt",
|
"pair,notional_value,mm_ratio,amt",
|
||||||
[
|
[
|
||||||
("XRP/USDT:USDT", 0.0, 0.025, 0),
|
("XRP/USDT:USDT", 0.0, 0.025, 0),
|
||||||
("BNB/USDT:USDT", 100.0, 0.0065, 0),
|
("BNB/USDT:USDT", 100.0, 0.0065, 0),
|
||||||
|
@ -615,12 +615,12 @@ def test_get_maintenance_ratio_and_amt_binance(
|
||||||
mocker,
|
mocker,
|
||||||
leverage_tiers,
|
leverage_tiers,
|
||||||
pair,
|
pair,
|
||||||
nominal_value,
|
notional_value,
|
||||||
mm_ratio,
|
mm_ratio,
|
||||||
amt,
|
amt,
|
||||||
):
|
):
|
||||||
mocker.patch(f"{EXMS}.exchange_has", return_value=True)
|
mocker.patch(f"{EXMS}.exchange_has", return_value=True)
|
||||||
exchange = get_patched_exchange(mocker, default_conf, exchange="binance")
|
exchange = get_patched_exchange(mocker, default_conf, exchange="binance")
|
||||||
exchange._leverage_tiers = leverage_tiers
|
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)
|
assert (round(result_ratio, 8), round(result_amt, 8)) == (mm_ratio, amt)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user