Use buy side for price since mostly used for DCA.

This commit is contained in:
Reigo Reinmets 2021-12-20 22:45:46 +02:00
parent f6d36ce56b
commit c9243fb4f6

View File

@ -471,17 +471,18 @@ class FreqtradeBot(LoggingMixin):
If the strategy triggers the adjustment, a new order gets issued. If the strategy triggers the adjustment, a new order gets issued.
Once that completes, the existing trade is modified to match new data. 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: for order in trade.orders:
if order.ft_is_open: if order.ft_is_open:
return return
logger.debug(f"adjust_trade_position for pair {trade.pair}") logger.debug(f"adjust_trade_position for pair {trade.pair}")
sell_rate = self.exchange.get_rate(trade.pair, refresh=True, side="sell") current_rate = self.exchange.get_rate(trade.pair, refresh=True, side="buy")
current_profit = trade.calc_profit_ratio(sell_rate) current_profit = trade.calc_profit_ratio(current_rate)
stake_amount = strategy_safe_wrapper(self.strategy.adjust_trade_position, stake_amount = strategy_safe_wrapper(self.strategy.adjust_trade_position,
default_retval=None)( default_retval=None)(
pair=trade.pair, trade=trade, current_time=datetime.now(timezone.utc), 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: if stake_amount is not None and stake_amount > 0.0:
# We should increase our position # We should increase our position