fix: compare timeout with <= instead of <

closes #12590

Backtesting assumes round dates, so a timeout at "candle length" needs
to timeout at the hour - not after the hour.
otherwise the timeout becomes either double (60 instead of 30) -
or longer by one "timeframe detail" (31 instead of 30).
This commit is contained in:
Matthias
2025-12-05 07:10:04 +01:00
parent 68e54248fd
commit 338c1c5424

View File

@@ -1718,7 +1718,7 @@ class IStrategy(ABC, HyperStrategyMixin):
timeout_unit = self.config.get("unfilledtimeout", {}).get("unit", "minutes")
timeout_kwargs = {timeout_unit: -timeout}
timeout_threshold = current_time + timedelta(**timeout_kwargs)
timedout = order.status == "open" and order.order_date_utc < timeout_threshold
timedout = order.status == "open" and order.order_date_utc <= timeout_threshold
if timedout:
return True
time_method = (