fix: round exit-prices to proper precision
this avoids odd visualization in freqUI where prices had 16 decimals out of backtesting
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user