From 25c74e26d1a59699e8ae5e54f94d5fe0cb47a3d4 Mon Sep 17 00:00:00 2001 From: eSeR1805 Date: Thu, 5 May 2022 12:18:19 +0300 Subject: [PATCH] Models:Trade: Revert trade open_rate update. --- freqtrade/persistence/models.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/freqtrade/persistence/models.py b/freqtrade/persistence/models.py index 62f3d7d55..d1846f9ef 100644 --- a/freqtrade/persistence/models.py +++ b/freqtrade/persistence/models.py @@ -866,16 +866,10 @@ class LocalTrade(): return float(f"{profit_ratio:.8f}") def recalc_trade_from_orders(self): - filled_orders_count = len(self.select_filled_orders(self.entry_side)) - latest_order_in_trade = self.select_order(self.entry_side, True) - # No fills - update open_rate in case order was replaced - if (filled_orders_count == 0 and latest_order_in_trade is not None and - latest_order_in_trade.price is not None): - # after ensuring there is a populated order price - self.open_rate = latest_order_in_trade.price + # We need at least 2 entry orders for averaging amounts and rates. # TODO: this condition could probably be removed - if filled_orders_count < 2: + if len(self.select_filled_orders(self.entry_side)) < 2: self.stake_amount = self.amount * self.open_rate / self.leverage # Just in case, still recalc open trade value