Update intermediate close_profit calculation

This commit is contained in:
Matthias
2023-11-18 19:47:09 +01:00
parent 0815bb6244
commit ca3f349d84

View File

@@ -1066,7 +1066,10 @@ class LocalTrade:
exit_amount = o.safe_amount_after_fee
prof = self.calculate_profit(exit_rate, exit_amount, float(avg_price))
close_profit_abs += prof.profit_abs
close_profit = prof.profit_ratio
if total_stake > 0:
# This needs to be calculated based on the last occuring exit to be aligned
# with realized_profit.
close_profit = (close_profit_abs / total_stake) * self.leverage
else:
total_stake = total_stake + self._calc_open_trade_value(tmp_amount, price)
max_stake_amount += (tmp_amount * price)