added 2nd unit test
This commit is contained in:
@@ -460,6 +460,7 @@ class FreqtradeBot(LoggingMixin):
|
||||
else:
|
||||
logger.debug("Max adjustment entries is set to unlimited.")
|
||||
current_rate = self.exchange.get_rate(trade.pair, refresh=True, side="buy")
|
||||
current_rate_sell = self.exchange.get_rate(trade.pair, refresh=True, side="sell")
|
||||
current_profit = trade.calc_profit_ratio(current_rate)
|
||||
|
||||
min_stake_amount = self.exchange.get_min_pair_stake_amount(trade.pair,
|
||||
@@ -470,7 +471,8 @@ class FreqtradeBot(LoggingMixin):
|
||||
stake_amount = strategy_safe_wrapper(self.strategy.adjust_trade_position,
|
||||
default_retval=None)(
|
||||
trade=trade, current_time=datetime.now(timezone.utc), current_rate=current_rate,
|
||||
current_profit=current_profit, min_stake=min_stake_amount, max_stake=max_stake_amount)
|
||||
current_profit=current_profit, min_stake=min_stake_amount,
|
||||
max_stake=max_stake_amount, current_rate_sell=current_rate_sell)
|
||||
|
||||
if stake_amount is not None and stake_amount > 0.0:
|
||||
# We should increase our position
|
||||
@@ -487,7 +489,7 @@ class FreqtradeBot(LoggingMixin):
|
||||
}
|
||||
self.rpc.send_msg(msg)
|
||||
return
|
||||
amount = -stake_amount / current_rate
|
||||
amount = -stake_amount / current_rate_sell
|
||||
if trade.amount - amount < min_stake_amount:
|
||||
logger.info('Remaining amount would be too small')
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user