diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index eae398010..bde887998 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -695,17 +695,12 @@ class Backtesting: trading_mode=self.trading_mode, leverage=leverage, interest_rate=interest_rate, - isolated_liq=isolated_liq, orders=[], ) trade.adjust_stop_loss(trade.open_rate, self.strategy.stoploss, initial=True) if self.trading_mode == TradingMode.FUTURES: - if isolated_liq is None: - raise OperationalException( - f'isolated_liq is none for {pair} while trading futures, ' - 'this should never happen') trade.set_isolated_liq(isolated_liq) order = Order( diff --git a/freqtrade/persistence/models.py b/freqtrade/persistence/models.py index 18491d687..2c96248d3 100644 --- a/freqtrade/persistence/models.py +++ b/freqtrade/persistence/models.py @@ -425,11 +425,13 @@ class LocalTrade(): self.stop_loss_pct = -1 * abs(percent) self.stoploss_last_update = datetime.utcnow() - def set_isolated_liq(self, isolated_liq: float): + def set_isolated_liq(self, isolated_liq: Optional[float]): """ Method you should use to set self.liquidation price. Assures stop_loss is not passed the liquidation price """ + if not isolated_liq: + return if self.stop_loss is not None: if self.is_short: self.stop_loss = min(self.stop_loss, isolated_liq)