From df2432bc18cb364869ebd7cdbf6893166a3e2e5b Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 11 Apr 2024 20:57:03 +0200 Subject: [PATCH] Re-align adjust_trade_position bt with live. --- freqtrade/optimize/backtesting.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 326c48c62..1d36349d3 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -565,7 +565,8 @@ class Backtesting: if stake_amount is not None and stake_amount < 0.0: amount = amount_to_contract_precision( - abs(stake_amount * trade.leverage) / current_rate, trade.amount_precision, + abs(stake_amount * trade.amount / trade.stake_amount), + trade.amount_precision, self.precision_mode, trade.contract_size) if amount == 0.0: return trade