From c9243fb4f61019d3c872631f021cbebea4460fbd Mon Sep 17 00:00:00 2001 From: Reigo Reinmets Date: Mon, 20 Dec 2021 22:45:46 +0200 Subject: [PATCH] Use buy side for price since mostly used for DCA. --- freqtrade/freqtradebot.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index b7318279c..7c5f1b687 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -471,17 +471,18 @@ class FreqtradeBot(LoggingMixin): If the strategy triggers the adjustment, a new order gets issued. Once that completes, the existing trade is modified to match new data. """ + # If there is any open orders, wait for them to finish. for order in trade.orders: if order.ft_is_open: return logger.debug(f"adjust_trade_position for pair {trade.pair}") - sell_rate = self.exchange.get_rate(trade.pair, refresh=True, side="sell") - current_profit = trade.calc_profit_ratio(sell_rate) + current_rate = self.exchange.get_rate(trade.pair, refresh=True, side="buy") + current_profit = trade.calc_profit_ratio(current_rate) stake_amount = strategy_safe_wrapper(self.strategy.adjust_trade_position, default_retval=None)( pair=trade.pair, trade=trade, current_time=datetime.now(timezone.utc), - current_rate=sell_rate, current_profit=current_profit) + current_rate=current_rate, current_profit=current_profit) if stake_amount is not None and stake_amount > 0.0: # We should increase our position