mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-03 10:33:08 +00:00
Align backtest and bot method
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user