Fix weekend filter: use precise forex market hours (Fri 22:00–Sun 22:00 UTC)

The old `weekday() >= 5` check blocked all of Sunday, but the forex
market reopens Sunday 22:00 UTC (Sydney open). Now uses proper time-based
check so the bot fetches data and generates signals on Sunday evening.
This commit is contained in:
harwinder
2026-05-17 19:23:21 -04:00
parent 15a7074574
commit cc53448c34
4 changed files with 34 additions and 6 deletions
+16 -1
View File
@@ -18,6 +18,21 @@ from config import PlatformConfig, Timeframe, XAUUSD, PAIR_INFO
logger = logging.getLogger(__name__)
def _is_forex_weekend(now=None) -> bool:
"""Forex market closed: Friday 22:00 UTC → Sunday 22:00 UTC."""
if now is None:
now = pd.Timestamp.now(tz="UTC")
wd = now.weekday()
hour = now.hour
if wd == 4 and hour >= 22:
return True
if wd == 5:
return True
if wd == 6 and hour < 22:
return True
return False
class DataIntegrityError(Exception):
"""Raised when data fails validation checks."""
pass
@@ -125,7 +140,7 @@ class ForexDataProvider:
now = pd.Timestamp.now(tz="UTC")
if now.weekday() >= 5:
if _is_forex_weekend(now):
return True
last_bar = df.index[-1]