fix: don't call stoploss-adjust after trade has closed

closes #11990
This commit is contained in:
Matthias
2025-07-17 06:53:50 +02:00
parent d33768ecee
commit 30b32a0d2e
+8 -8
View File
@@ -2363,14 +2363,14 @@ class FreqtradeBot(LoggingMixin):
stake_currency=self.config["stake_currency"], stake_currency=self.config["stake_currency"],
dry_run=self.config["dry_run"], dry_run=self.config["dry_run"],
) )
if self.strategy.use_custom_stoploss: if self.strategy.use_custom_stoploss and trade.is_open:
current_rate = self.exchange.get_rate( current_rate = self.exchange.get_rate(
trade.pair, side="exit", is_short=trade.is_short, refresh=True trade.pair, side="exit", is_short=trade.is_short, refresh=True
) )
profit = trade.calc_profit_ratio(current_rate) profit = trade.calc_profit_ratio(current_rate)
self.strategy.ft_stoploss_adjust( self.strategy.ft_stoploss_adjust(
current_rate, trade, datetime.now(UTC), profit, 0, after_fill=True current_rate, trade, datetime.now(UTC), profit, 0, after_fill=True
) )
# Updating wallets when order is closed # Updating wallets when order is closed
self.wallets.update() self.wallets.update()
return trade return trade