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
1 changed files with 4 additions and 3 deletions

View File

@ -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