Align backtest and bot method

This commit is contained in:
Matthias
2023-12-29 19:31:54 +01:00
parent 063b55d41a
commit e664527da6

View File

@@ -530,7 +530,7 @@ class Backtesting:
def _get_adjust_trade_entry_for_candle(
self, trade: LocalTrade, row: Tuple, current_time: datetime
) -> LocalTrade:
current_rate = row[OPEN_IDX]
current_rate: float = row[OPEN_IDX]
current_profit = trade.calc_profit_ratio(current_rate)
min_stake = self.exchange.get_min_pair_stake_amount(trade.pair, current_rate, -0.1)
max_stake = self.exchange.get_max_pair_stake_amount(trade.pair, current_rate)
@@ -564,7 +564,7 @@ class Backtesting:
if amount == 0.0:
return trade
remaining = (trade.amount - amount) * current_rate
if remaining != 0 and remaining < min_stake:
if min_stake and remaining != 0 and remaining < min_stake:
# Remaining stake is too low to be sold.
return trade
exit_ = ExitCheckTuple(ExitType.PARTIAL_EXIT)