fixed liq-buffer tests

This commit is contained in:
Sam Germain
2022-02-11 03:48:09 -06:00
committed by Matthias
parent fb3a6e2ce8
commit 6ae85f9be1
3 changed files with 33 additions and 15 deletions

View File

@@ -3664,6 +3664,7 @@ def test_get_liquidation_price(mocker, default_conf):
default_conf['dry_run'] = False
default_conf['trading_mode'] = 'futures'
default_conf['margin_mode'] = 'isolated'
default_conf['liquidation_buffer'] = 0.0
exchange = get_patched_exchange(mocker, default_conf, api_mock)
liq_price = exchange.get_liquidation_price(
@@ -3675,6 +3676,17 @@ def test_get_liquidation_price(mocker, default_conf):
)
assert liq_price == 17.47
default_conf['liquidation_buffer'] = 0.05
exchange = get_patched_exchange(mocker, default_conf, api_mock)
liq_price = exchange.get_liquidation_price(
pair='NEAR/USDT:USDT',
open_rate=0.0,
is_short=False,
position=0.0,
wallet_balance=0.0,
)
assert liq_price == 18.8133
ccxt_exceptionhandlers(
mocker,
default_conf,
@@ -4073,6 +4085,7 @@ def test_liquidation_price(
):
default_conf['trading_mode'] = trading_mode
default_conf['margin_mode'] = margin_mode
default_conf['liquidation_buffer'] = 0.0
exchange = get_patched_exchange(mocker, default_conf, id=exchange_name)
exchange.get_maintenance_ratio_and_amt = MagicMock(return_value=(mm_ratio, maintenance_amt))
assert isclose(round(exchange.get_liquidation_price(