Fix 3 bugs (swing NaN, ROC div-by-zero, currency matching) and add 77 new tests
Bug fixes:
- Swing point detection: false positives when all neighbors are NaN (all([]) == True)
- ROC indicator: division by zero when historical close price is zero
- News currency extraction: substring matching ("usd" in "usda") replaced with word-boundary regex
- ADX DX calculation: use epsilon instead of NaN to avoid cascade
- Signal aggregator: refactor ternary append, add pip_value<=0 guard
New tests (77) cover: swing point edge cases, ROC/ADX/RSI/MACD/BB boundaries,
regime classification, composite scoring, quality grade thresholds, EUR filter
pipeline, trade setup edge cases, MTF agreement, weekend filter, and integration.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+3
-2
@@ -497,11 +497,12 @@ class NewsEngine:
|
||||
found = []
|
||||
|
||||
for currency, keywords in self.CURRENCY_KEYWORDS.items():
|
||||
if currency.lower() in headline_lower:
|
||||
if re.search(r'\b' + re.escape(currency.lower()) + r'\b', headline_lower):
|
||||
found.append(currency)
|
||||
continue
|
||||
for kw in keywords:
|
||||
if kw in headline_lower:
|
||||
kw_stripped = kw.strip()
|
||||
if kw_stripped and re.search(r'\b' + re.escape(kw_stripped) + r'\b', headline_lower):
|
||||
found.append(currency)
|
||||
break
|
||||
|
||||
|
||||
Reference in New Issue
Block a user