From 13c86452e9d3af5b5657069f9f38c1dbfa5e9dba Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 14 Dec 2025 18:29:37 +0100 Subject: [PATCH] refactor: only assign order_type once --- freqtrade/freqtradebot.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 8f34ee748..4c5207e93 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -2081,7 +2081,12 @@ class FreqtradeBot(LoggingMixin): ): exit_type = "stoploss" - order_type = ordertype or self.strategy.order_types[exit_type] + order_type = ( + (ordertype or self.strategy.order_types[exit_type]) + if exit_check.exit_type != ExitType.EMERGENCY_EXIT + else self.strategy.order_types.get("emergency_exit", "market") + ) + # set custom_exit_price if available proposed_limit_rate = limit custom_exit_price = limit @@ -2104,10 +2109,6 @@ class FreqtradeBot(LoggingMixin): # First cancelling stoploss on exchange ... trade = self.cancel_stoploss_on_exchange(trade, allow_nonblocking=True) - if exit_check.exit_type == ExitType.EMERGENCY_EXIT: - # Emergency exits (default to market!) - order_type = self.strategy.order_types.get("emergency_exit", "market") - amount = self._safe_exit_amount(trade, trade.pair, sub_trade_amt or trade.amount) time_in_force = self.strategy.order_time_in_force["exit"]