Add 4-pair candle-boundary auto-scanner (free tier safe)

Expand from 2 to 4 pairs (EUR/USD, USD/JPY, GBP/USD, XAU/USD) with
automatic scanning at M15 and H1 candle close boundaries. Scheduler
staggers H1 by 60s to stay within 8 credits/min; daily budget is
480 of 800 allowed. Cache TTL is now candle-duration-aware so cross-TF
confirmation data is reused without extra API calls. Spread estimate
uses primary-TF data instead of fetching M5 separately.
This commit is contained in:
harwinder
2026-05-11 15:30:11 -04:00
parent a708609f8b
commit 873cf5487e
4 changed files with 315 additions and 51 deletions
Regular → Executable
+13 -1
View File
@@ -38,10 +38,14 @@ class MarketSession(Enum):
# ── Supported pairs ──────────────────────────────────────────────
USDJPY = "USDJPY=X"
EURUSD = "EURUSD=X"
GBPUSD = "GBPUSD=X"
XAUUSD = "XAUUSD=X"
PAIR_INFO = {
USDJPY: {"display": "USD/JPY", "pip_value": 0.01, "is_jpy_pair": True},
EURUSD: {"display": "EUR/USD", "pip_value": 0.0001, "is_jpy_pair": False},
GBPUSD: {"display": "GBP/USD", "pip_value": 0.0001, "is_jpy_pair": False},
XAUUSD: {"display": "XAU/USD", "pip_value": 0.10, "is_jpy_pair": False},
}
# Defaults (kept for backward compat)
@@ -117,7 +121,7 @@ class SignalConfig:
@dataclass
class NewsConfig:
"""Economic calendar & sentiment."""
tracked_currencies: List[str] = field(default_factory=lambda: ["USD", "JPY", "EUR"])
tracked_currencies: List[str] = field(default_factory=lambda: ["USD", "JPY", "EUR", "GBP"])
min_impact: str = "medium"
pre_event_buffer_minutes: int = 30
post_event_buffer_minutes: int = 15
@@ -163,4 +167,12 @@ class PlatformConfig:
refresh_interval: int = 300
scan_pairs: List[str] = field(
default_factory=lambda: [EURUSD, USDJPY, GBPUSD, XAUUSD]
)
scan_timeframes: List[Timeframe] = field(
default_factory=lambda: [Timeframe.M15, Timeframe.H1]
)
candle_buffer_seconds: int = 10
log_level: str = "INFO"