Small fixes to align backtesting with live
This commit is contained in:
parent
0bfb0febe9
commit
76907cb4d6
@ -539,7 +539,8 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
logger.debug(f"Calling adjust_trade_position for pair {trade.pair}")
|
logger.debug(f"Calling adjust_trade_position for pair {trade.pair}")
|
||||||
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)(
|
||||||
trade=trade, current_time=datetime.now(timezone.utc), current_rate=current_entry_rate,
|
trade=trade,
|
||||||
|
current_time=datetime.now(timezone.utc), current_rate=current_entry_rate,
|
||||||
current_profit=current_entry_profit, min_stake=min_entry_stake,
|
current_profit=current_entry_profit, min_stake=min_entry_stake,
|
||||||
max_stake=min(max_entry_stake, stake_available),
|
max_stake=min(max_entry_stake, stake_available),
|
||||||
current_entry_rate=current_entry_rate, current_exit_rate=current_exit_rate,
|
current_entry_rate=current_entry_rate, current_exit_rate=current_exit_rate,
|
||||||
|
@ -522,8 +522,8 @@ class Backtesting:
|
|||||||
if stake_amount is not None and stake_amount < 0.0:
|
if stake_amount is not None and stake_amount < 0.0:
|
||||||
amount = abs(stake_amount) / current_rate
|
amount = abs(stake_amount) / current_rate
|
||||||
if amount > trade.amount:
|
if amount > trade.amount:
|
||||||
# selling more than available is not supported.
|
# This is currently ineffective as remaining would become < min tradable
|
||||||
return trade
|
amount = trade.amount
|
||||||
remaining = (trade.amount - amount) * current_rate
|
remaining = (trade.amount - amount) * current_rate
|
||||||
if remaining < min_stake:
|
if remaining < min_stake:
|
||||||
# Remaining stake is too low to be sold.
|
# Remaining stake is too low to be sold.
|
||||||
|
Loading…
Reference in New Issue
Block a user