rename column to liquidation_price
This commit is contained in:
@@ -613,7 +613,7 @@ def test_backtest__enter_trade_futures(default_conf_usdt, fee, mocker) -> None:
|
||||
# = 0.0008176703703703704
|
||||
|
||||
trade = backtesting._enter_trade(pair, row=row, direction='long')
|
||||
assert pytest.approx(trade.isolated_liq) == 0.00081767037
|
||||
assert pytest.approx(trade.liquidation_price) == 0.00081767037
|
||||
|
||||
# Binance, Short
|
||||
# liquidation_price
|
||||
@@ -625,7 +625,7 @@ def test_backtest__enter_trade_futures(default_conf_usdt, fee, mocker) -> None:
|
||||
# = 0.0011787191419141915
|
||||
|
||||
trade = backtesting._enter_trade(pair, row=row, direction='short')
|
||||
assert pytest.approx(trade.isolated_liq) == 0.0011787191
|
||||
assert pytest.approx(trade.liquidation_price) == 0.0011787191
|
||||
|
||||
# Stake-amount too high!
|
||||
mocker.patch("freqtrade.exchange.Exchange.get_min_pair_stake_amount", return_value=600.0)
|
||||
|
@@ -112,7 +112,7 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None:
|
||||
'exchange': 'binance',
|
||||
'leverage': 1.0,
|
||||
'interest_rate': 0.0,
|
||||
'isolated_liq': None,
|
||||
'liquidation_price': None,
|
||||
'is_short': False,
|
||||
'funding_fees': 0.0,
|
||||
'trading_mode': TradingMode.SPOT,
|
||||
@@ -194,7 +194,7 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None:
|
||||
'exchange': 'binance',
|
||||
'leverage': 1.0,
|
||||
'interest_rate': 0.0,
|
||||
'isolated_liq': None,
|
||||
'liquidation_price': None,
|
||||
'is_short': False,
|
||||
'funding_fees': 0.0,
|
||||
'trading_mode': TradingMode.SPOT,
|
||||
|
@@ -944,7 +944,7 @@ def test_execute_entry(mocker, default_conf_usdt, fee, limit_order,
|
||||
trade.is_short = is_short
|
||||
assert trade
|
||||
assert trade.open_rate_requested == 10
|
||||
assert trade.isolated_liq == liq_price
|
||||
assert trade.liquidation_price == liq_price
|
||||
|
||||
# In case of too high stake amount
|
||||
|
||||
|
@@ -116,38 +116,38 @@ def test_set_stop_loss_isolated_liq(fee):
|
||||
trading_mode=margin
|
||||
)
|
||||
trade.set_isolated_liq(0.09)
|
||||
assert trade.isolated_liq == 0.09
|
||||
assert trade.liquidation_price == 0.09
|
||||
assert trade.stop_loss is None
|
||||
assert trade.initial_stop_loss is None
|
||||
|
||||
trade._set_stop_loss(0.1, (1.0/9.0))
|
||||
assert trade.isolated_liq == 0.09
|
||||
assert trade.liquidation_price == 0.09
|
||||
assert trade.stop_loss == 0.1
|
||||
assert trade.initial_stop_loss == 0.1
|
||||
|
||||
trade.set_isolated_liq(0.08)
|
||||
assert trade.isolated_liq == 0.08
|
||||
assert trade.liquidation_price == 0.08
|
||||
assert trade.stop_loss == 0.1
|
||||
assert trade.initial_stop_loss == 0.1
|
||||
|
||||
trade.set_isolated_liq(0.11)
|
||||
trade._set_stop_loss(0.1, 0)
|
||||
assert trade.isolated_liq == 0.11
|
||||
assert trade.liquidation_price == 0.11
|
||||
assert trade.stop_loss == 0.11
|
||||
assert trade.initial_stop_loss == 0.1
|
||||
|
||||
# lower stop doesn't move stoploss
|
||||
trade._set_stop_loss(0.1, 0)
|
||||
assert trade.isolated_liq == 0.11
|
||||
assert trade.liquidation_price == 0.11
|
||||
assert trade.stop_loss == 0.11
|
||||
assert trade.initial_stop_loss == 0.1
|
||||
|
||||
trade.stop_loss = None
|
||||
trade.isolated_liq = None
|
||||
trade.liquidation_price = None
|
||||
trade.initial_stop_loss = None
|
||||
|
||||
trade._set_stop_loss(0.07, 0)
|
||||
assert trade.isolated_liq is None
|
||||
assert trade.liquidation_price is None
|
||||
assert trade.stop_loss == 0.07
|
||||
assert trade.initial_stop_loss == 0.07
|
||||
|
||||
@@ -157,29 +157,29 @@ def test_set_stop_loss_isolated_liq(fee):
|
||||
trade.initial_stop_loss = None
|
||||
|
||||
trade.set_isolated_liq(0.09)
|
||||
assert trade.isolated_liq == 0.09
|
||||
assert trade.liquidation_price == 0.09
|
||||
assert trade.stop_loss is None
|
||||
assert trade.initial_stop_loss is None
|
||||
|
||||
trade._set_stop_loss(0.08, (1.0/9.0))
|
||||
assert trade.isolated_liq == 0.09
|
||||
assert trade.liquidation_price == 0.09
|
||||
assert trade.stop_loss == 0.08
|
||||
assert trade.initial_stop_loss == 0.08
|
||||
|
||||
trade.set_isolated_liq(0.1)
|
||||
assert trade.isolated_liq == 0.1
|
||||
assert trade.liquidation_price == 0.1
|
||||
assert trade.stop_loss == 0.08
|
||||
assert trade.initial_stop_loss == 0.08
|
||||
|
||||
trade.set_isolated_liq(0.07)
|
||||
trade._set_stop_loss(0.1, (1.0/8.0))
|
||||
assert trade.isolated_liq == 0.07
|
||||
assert trade.liquidation_price == 0.07
|
||||
assert trade.stop_loss == 0.07
|
||||
assert trade.initial_stop_loss == 0.08
|
||||
|
||||
# Stop doesn't move stop higher
|
||||
trade._set_stop_loss(0.1, (1.0/9.0))
|
||||
assert trade.isolated_liq == 0.07
|
||||
assert trade.liquidation_price == 0.07
|
||||
assert trade.stop_loss == 0.07
|
||||
assert trade.initial_stop_loss == 0.08
|
||||
|
||||
@@ -1474,7 +1474,7 @@ def test_adjust_stop_loss_short(fee):
|
||||
trade.set_isolated_liq(0.63)
|
||||
trade.adjust_stop_loss(0.59, -0.1)
|
||||
assert trade.stop_loss == 0.63
|
||||
assert trade.isolated_liq == 0.63
|
||||
assert trade.liquidation_price == 0.63
|
||||
|
||||
|
||||
def test_adjust_min_max_rates(fee):
|
||||
@@ -1539,7 +1539,7 @@ def test_get_open_lev(fee, use_db):
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("init_persistence")
|
||||
def test_to_json(default_conf, fee):
|
||||
def test_to_json(fee):
|
||||
|
||||
# Simulate dry_run entries
|
||||
trade = Trade(
|
||||
@@ -1608,7 +1608,7 @@ def test_to_json(default_conf, fee):
|
||||
'exchange': 'binance',
|
||||
'leverage': None,
|
||||
'interest_rate': None,
|
||||
'isolated_liq': None,
|
||||
'liquidation_price': None,
|
||||
'is_short': None,
|
||||
'trading_mode': None,
|
||||
'funding_fees': None,
|
||||
@@ -1683,7 +1683,7 @@ def test_to_json(default_conf, fee):
|
||||
'exchange': 'binance',
|
||||
'leverage': None,
|
||||
'interest_rate': None,
|
||||
'isolated_liq': None,
|
||||
'liquidation_price': None,
|
||||
'is_short': None,
|
||||
'trading_mode': None,
|
||||
'funding_fees': None,
|
||||
|
Reference in New Issue
Block a user