Correct conditions for remaining stake checking

This commit is contained in:
Matthias
2023-12-14 20:34:58 +01:00
parent bb2024f789
commit 9e2e60e7ad
2 changed files with 2 additions and 5 deletions

View File

@@ -568,11 +568,8 @@ class Backtesting:
self.precision_mode, trade.contract_size)
if amount == 0.0:
return trade
if amount > trade.amount:
# This is currently ineffective as remaining would become < min tradable
amount = trade.amount
remaining = (trade.amount - amount) * current_rate
if 0 < remaining < min_stake:
if remaining != 0 and remaining < min_stake:
# Remaining stake is too low to be sold.
return trade
exit_ = ExitCheckTuple(ExitType.PARTIAL_EXIT)