From 59a81dc07ac85a4edbe50e3057e8e3c25d0f56e8 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 14 Mar 2026 17:00:44 +0100 Subject: [PATCH] fix: round exit-prices to proper precision this avoids odd visualization in freqUI where prices had 16 decimals out of backtesting --- freqtrade/optimize/backtesting.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 4311df21a..a95b29005 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -848,9 +848,7 @@ class Backtesting: exit_tag=exit_reason, ) if rate is not None and rate != close_rate: - close_rate = price_to_precision( - rate, trade.price_precision, trade.precision_mode_price - ) + close_rate = rate # We can't place orders lower than current low. # freqtrade does not support this in live, and the order would fill immediately if trade.is_short: @@ -892,6 +890,9 @@ class Backtesting: self.order_id_counter += 1 exit_candle_time = sell_row[DATE_IDX].to_pydatetime() order_type = self.strategy.order_types["exit"] + close_rate = price_to_precision( + close_rate, trade.price_precision, trade.precision_mode_price + ) # amount = amount or trade.amount amount = amount_to_contract_precision( amount or trade.amount, trade.amount_precision, self.precision_mode, trade.contract_size