Pro tier upgrade: quant rearchitect + WebSocket level-breach monitor

- Restore XAU/USD (Pro plan), drop USD/CAD, raise rate limit to 55/min
- Reduce signal engine to 4 uncorrelated pillars (EMA, RSI, BB, Candlestick)
  with regime-adaptive weights (trending boosts EMA, ranging boosts RSI+BB)
- Add structure-based S/R (swing highs/lows) for trade setup targeting
- Fix confidence death spiral: all adjustments now additive, not multiplicative
- Dynamic R:R trade setup: SL behind swing level, TP at next structure level,
  reject if R:R < 1.5
- Fix news engine for all 4 pairs (was hardcoded to USDJPY)
- Add WebSocket monitor: streams live ticks, triggers M15 scan on level breach
  with 5-min cooldown per pair — catches breakouts between candle boundaries
- Add correlation filter (EUR/USD+GBP/USD, XAU/USD+USD/JPY exposure warnings)
This commit is contained in:
harwinder
2026-05-11 16:33:23 -04:00
parent cc66e65f2d
commit 058ef57d8f
8 changed files with 435 additions and 196 deletions
Regular → Executable
+19 -10
View File
@@ -104,6 +104,7 @@ class NewsEngine:
"AUD": ["aussie", "rba", "australian", "australia"],
"CAD": ["loonie", "boc", "canadian", "canada"],
"NZD": ["kiwi", "rbnz", "new zealand"],
"XAU": ["gold", "xau", "precious metal", "safe haven", "bullion"],
}
# High-impact event types (these move markets significantly)
@@ -187,15 +188,21 @@ class NewsEngine:
return context
@staticmethod
def _parse_pair(pair_symbol: str) -> Tuple[str, str]:
if "/" in pair_symbol:
parts = pair_symbol.split("/")
return parts[0], parts[1]
clean = pair_symbol.replace("=X", "")
return clean[:3], clean[3:]
def get_event_risk_level(self, pair_symbol: str, context: FundamentalContext) -> Tuple[str, str]:
"""
Get event risk level for a specific pair.
Returns (risk_level, description).
risk_level: "clear", "caution", "danger"
"""
clean = pair_symbol.replace("=X", "")
base = clean[:3]
quote = clean[3:]
base, quote = self._parse_pair(pair_symbol)
# Check upcoming high-impact events
for event in context.events_upcoming_1h:
@@ -222,9 +229,7 @@ class NewsEngine:
Returns (score, description) where score is -1 to +1.
Positive = bullish for the pair, negative = bearish.
"""
clean = pair_symbol.replace("=X", "")
base = clean[:3]
quote = clean[3:]
base, quote = self._parse_pair(pair_symbol)
base_sent = context.news_sentiment.get(base, 0.0)
quote_sent = context.news_sentiment.get(quote, 0.0)
@@ -413,7 +418,11 @@ class NewsEngine:
@staticmethod
def _get_affected_pairs(currency: str) -> List[str]:
"""Map a currency event to USD/JPY (the only watched pair)."""
if currency in ("USD", "JPY"):
return ["USDJPY=X"]
return []
_MAP = {
"USD": ["EURUSD=X", "USDJPY=X", "GBPUSD=X", "XAU/USD"],
"EUR": ["EURUSD=X"],
"JPY": ["USDJPY=X"],
"GBP": ["GBPUSD=X"],
"XAU": ["XAU/USD"],
}
return _MAP.get(currency, [])