Skip to content

Commit 13c8645

Browse files
committed
refactor: only assign order_type once
1 parent fe18731 commit 13c8645

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

freqtrade/freqtradebot.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,7 +2081,12 @@ def execute_trade_exit(
20812081
):
20822082
exit_type = "stoploss"
20832083

2084-
order_type = ordertype or self.strategy.order_types[exit_type]
2084+
order_type = (
2085+
(ordertype or self.strategy.order_types[exit_type])
2086+
if exit_check.exit_type != ExitType.EMERGENCY_EXIT
2087+
else self.strategy.order_types.get("emergency_exit", "market")
2088+
)
2089+
20852090
# set custom_exit_price if available
20862091
proposed_limit_rate = limit
20872092
custom_exit_price = limit
@@ -2104,10 +2109,6 @@ def execute_trade_exit(
21042109
# First cancelling stoploss on exchange ...
21052110
trade = self.cancel_stoploss_on_exchange(trade, allow_nonblocking=True)
21062111

2107-
if exit_check.exit_type == ExitType.EMERGENCY_EXIT:
2108-
# Emergency exits (default to market!)
2109-
order_type = self.strategy.order_types.get("emergency_exit", "market")
2110-
21112112
amount = self._safe_exit_amount(trade, trade.pair, sub_trade_amt or trade.amount)
21122113
time_in_force = self.strategy.order_time_in_force["exit"]
21132114

0 commit comments

Comments
 (0)