- name
- market-intelligence
- description
- Complete market intelligence layer — macro analysis, regime classification, news impact, sentiment, institutional behavior, event timelines, pair correlations, and trading fundamentals. Includes NLP sentiment scoring, news straddle strategies, COT positioning, seasonality analysis, contrarian sentiment composites, economic indicator tracking, and event timeline linking.
MACRO & INTERMARKET: "DXY", "dollar index", "VIX", "volatility index", "yield curve", "bond yields", "10-year", "2-10 spread", "yield inversion", "risk on risk off", "inter-market", "commodity flows", "gold vs dollar", "oil vs CAD", "equities vs forex", "macro overview", "big picture", "cross-asset", "safe havens", "intermarket divergence", "gold dollar divergence", "oil CAD divergence", "bond equity divergence", "cross-market divergence", "asset class divergence".
REGIME CLASSIFICATION: "is the market trending", "what regime are we in", "ranging or trending", "market conditions", "volatility regime", "classify market state", "adapt strategy", "regime change", "market phase", "consolidation or breakout", "trending market detection".
NEWS & EVENTS: "what news is moving the market", "why did EURUSD drop", "upcoming events", "news impact on gold", "Fed decision impact", "ECB hawkish dovish", "central bank decision", "NFP", "CPI", "GDP", "economic calendar", "geopolitical risk", "market sentiment", "news blackout", "event impact", "surprise reading", "above below expectations".
SENTIMENT & POSITIONING: "market sentiment", "what are traders saying", "retail positioning", "Fear and Greed Index", "crowd sentiment", "contrarian signal", "Twitter sentiment", "Reddit WallStreetBets", "social media trading", "TradingView ideas", "bullish bearish crowd", "retail long short ratio", "IG client sentiment", "Myfxbook sentiment", "COT strategy", "commitment of traders", "speculative positioning", "commercial hedgers", "COT signal", "contrarian trade", "fade the crowd", "retail is wrong", "extreme sentiment".
INSTITUTIONAL BEHAVIOR: "what are banks doing", "institutional positioning", "central bank policy", "Fed hawkish dovish", "ECB stance", "bank forecasts", "smart money", "institutional flows", "Goldman Sachs view", "JPMorgan forecast", "hedge fund positioning", "bank intervention", "reserve changes", "monetary policy impact", "dealer positioning", "rate decision impact", "policy divergence", "intervention detection".
EVENT TIMELINE: "what happened when", "why did the market move", "connect the dots", "timeline of events", "what caused this price move", "link news to price action", "temporal analysis", "event chain", "cause and effect", "reconstruct what happened on date", "what will happen next based on history", "correlate events".
PAIR CORRELATIONS: "correlate EURUSD and GBPUSD", "which pairs move together", "find divergences", "correlation matrix", "historical vs current correlation", "correlation breakdown", "hedging pairs", "pair clustering", "correlation regime change", "adaptive strategy switching", "when correlations break", "correlation spike", "decorrelation", "dynamic strategy switching", "auto-switch strategy", "transition detector".
TRADING FUNDAMENTALS: "explain market structure", "what is a market order", "types of orders", "limit order vs stop order", "iceberg order", "TWAP VWAP orders", "asset classes", "scalping vs day trading vs swing trading", "trading timeframes", "market participants", "market microstructure", "tick size", "lot size", "price discovery", "OTC market".
ALTERNATIVE DATA: "alternative data", "Google Trends trading", "search trends", "web traffic signals", "nowcasting", "satellite data trading", "shipping index", "Baltic Dry", "unusual data sources", "non-traditional indicators", "big data trading signals", incorporate non-standard data into trading decisions.
SEASONALITY: "seasonality", "monthly patterns", "best month to trade", "day of week edge", "hour of day analysis", "seasonal tendencies", "January effect", "sell in May", "summer doldrums", "end of quarter", "seasonal patterns forex", "when does EURUSD perform best", calendar-bas…
- related_skills
- ["fundamental-analysis","social-sentiment-scraper","news-intelligence","economic-calendar"]
- tags
- ["trading","research","macro","news","regime","intelligence"]
- skill_level
- intermediate
- kind
- reference
- category
- trading/data
- status
- active
> **Skill:** Market Intelligence | **Domain:** trading | **Category:** research | **Level:** intermediate
> **Tags:** `trading`, `research`, `macro`, `news`, `regime`, `intelligence`
# Market Intelligence — Complete Analysis Layer
> The informational foundation of all trading decisions.
> Macro context → regime → news → sentiment → institutional → correlation → execute.
## Sections
1. **Macro Dashboard** — DXY, VIX, yield curves, commodity-FX links, intermarket divergence
2. **Regime Classifier** — trending/ranging/volatile/quiet + strategy mapping
3. **News & Events** — economic calendar, impact scoring, event-price matching, sentiment
4. **Sentiment & Positioning** — retail positioning, COT, Fear/Greed, contrarian signals
5. **Institutional Monitor** — central banks, investment banks, COT analysis, intervention detection
6. **Event Timeline** — event linking, causal chains, narrative building, prediction
7. **Pair Correlations** — rolling correlation, divergence detection, clustering, regime switching
8. **Trading Fundamentals** — market structure, order types, asset classes, timeframes
9. **Alternative Data** — Google Trends signals, economic nowcasting, shipping/supply chain, search sentiment
10. **Seasonality** — monthly/day-of-week/hourly statistical edges with significance testing
---
## Reference Files
- **[references/macro-regime.md](references/macro-regime.md)** — Macro dashboard (DXY/VIX/yield curves/commodities) + regime classifier (ADX/BB-width/MA-alignment + strategy map)
- **[references/news-sentiment.md](references/news-sentiment.md)** — Economic calendar, news impact scoring, event-price matching, retail sentiment, COT, Fear/Greed, contrarian composite
- **[references/institutional-timeline.md](references/institutional-timeline.md)** — Central bank tracker, policy divergence, investment bank monitor, COT analyzer, intervention detector + full event timeline linker
- **[references/correlation-fundamentals.md](references/correlation-fundamentals.md)** — Pair correlation engine (rolling/historical/divergence/clustering/lead-lag) + correlation regime switcher + trading fundamentals reference
- **[references/alternative-data.md](references/alternative-data.md)** — AlternativeDataSources class: Google Trends signal, economic nowcast (Baltic Dry/copper-gold/credit spreads), search volume sentiment mapping
- **[references/seasonality.md](references/seasonality.md)** — SeasonalityAnalyzer class: monthly/day-of-week/hourly return statistics with t-tests, p-values, win rates, and significance flags
## Quick Decision Guide
| Task | Load |
|------|------|
| Is market risk-on or risk-off? | `references/macro-regime.md` |
| What does the yield curve signal? | `references/macro-regime.md` |
| Gold/Oil divergence from DXY? | `references/macro-regime.md` |
| What regime is EURUSD in? | `references/macro-regime.md` |
| Which strategy type fits now? | `references/macro-regime.md` |
| What events are this week? | `references/news-sentiment.md` |
| Is crowd long or short? | `references/news-sentiment.md` |
| COT extreme positioning? | `references/news-sentiment.md` |
| What is the Fed/ECB doing? | `references/institutional-timeline.md` |
| Rate decision impact model | `references/institutional-timeline.md` |
| Policy divergence between banks | `references/institutional-timeline.md` |
| Why did price move on [date]? | `references/institutional-timeline.md` |
| Which pairs are correlated? | `references/correlation-fundamentals.md` |
| Correlation regime shift? | `references/correlation-fundamentals.md` |
| What strategy works now (regime)? | `references/correlation-fundamentals.md` |
| What is a limit order / TWAP? | `references/correlation-fundamentals.md` |
| Google Trends signal / nowcast? | `references/alternative-data.md` |
| Baltic Dry / shipping index signal? | `references/alternative-data.md` |
| Search volume sentiment (fear/greed)? | `references/alternative-data.md` |
| Best month / day / hour to trade? | `references/seasonality.md` |
| January effect / sell in May? | `references/seasonality.md` |
| Seasonal edge with significance test? | `references/seasonality.md` |
## Core Macro Intelligence Quick Card
```
RISK-ON: VIX < 15, SPX rising → AUD, NZD up | JPY, CHF, Gold down
RISK-OFF: VIX > 25, SPX falling → JPY, CHF, Gold up | AUD, NZD, EM down
DXY UP: EUR, GBP, Gold down | USDJPY, USDCAD up
DXY DOWN: EUR, GBP, Gold up | USDJPY, USDCAD down
YIELD ↑: USD strengthens, Gold weakens
YIELD INVERSION (2-10 < 0): Recession warning, risk-off ahead
OIL ↑: CAD, NOK strengthen
TREND REGIME: ADX > 25, MAs aligned → use trend following
RANGE REGIME: ADX < 20, BB narrow → use mean reversion
VOLATILE: ADX < 20, BB wide → reduce size, wait for clarity
```
---
## Implementations (Merged from sentiment-macro)
---
## News Sentiment NLP Engine
```python
import re, numpy as np
SENTIMENT_LEXICON = {
"hawkish": 0.8, "dovish": -0.8, "rate hike": 0.7, "rate cut": -0.7,
"inflation rises": 0.5, "inflation falls": -0.3, "recession": -0.8,
"strong jobs": 0.6, "weak jobs": -0.6, "stimulus": 0.5, "tightening": 0.4,
"crisis": -0.9, "default": -0.9, "war": -0.7, "peace": 0.3,
"surge": 0.6, "plunge": -0.7, "rally": 0.5, "crash": -0.8,
"beat expectations": 0.6, "miss expectations": -0.6, "surprise": 0.3,
"upgrade": 0.5, "downgrade": -0.5, "bullish": 0.5, "bearish": -0.5,
}
class NewsSentimentNLP:
@staticmethod
def score_headline(headline: str) -> dict:
h = headline.lower()
matched = [(kw, score) for kw, score in SENTIMENT_LEXICON.items() if kw in h]
avg = np.mean([s for _, s in matched]) if matched else 0
entities = re.findall(r"\b(Fed|ECB|BOE|BOJ|NFP|CPI|GDP|FOMC|IMF)\b", headline, re.IGNORECASE)
return {
"headline": headline,
"sentiment_score": round(avg, 3),
"label": "BULLISH" if avg > 0.2 else "BEARISH" if avg < -0.2 else "NEUTRAL",
"matched_keywords": [kw for kw, _ in matched],
"entities": entities,
"confidence": min(len(matched) / 3, 1.0),
}
@staticmethod
def batch_score(headlines: list) -> dict:
scores = [NewsSentimentNLP.score_headline(h) for h in headlines]
avg = np.mean([s["sentiment_score"] for s in scores])
return {"overall": round(avg, 3), "n_headlines": len(headlines),
"bullish": sum(1 for s in scores if s["label"] == "BULLISH"),
"bearish": sum(1 for s in scores if s["label"] == "BEARISH")}
```
---
## Market News Impact
### Overview
Monitors and analyzes major economic news, central bank decisions, geopolitical events,
and market-moving developments. Matches news events to price reactions across instruments.
Provides forward-looking event calendars with expected impact ratings.
### Architecture
```
┌───────────────────────────────────────────────────────────┐
│ Market News Impact Engine │
├──────────────┬───────────────┬───────────────┬────────────┤
│ News Fetcher │ Event Calendar│ Impact Matcher│ Sentiment │
│ & Classifier │ & Scheduler │ & Scorer │ Analyzer │
└──────────────┴───────────────┴───────────────┴────────────┘
```
### 1. News Source Architecture
#### Source Priority (highest quality first)
```python
NEWS_SOURCES = {
"central_banks": {
"fed": {"url": "https://www.federalreserve.gov/newsevents.htm", "priority": 1},
"ecb": {"url": "https://www.ecb.europa.eu/press/html/index.en.html", "priority": 1},
"boj": {"url": "https://www.boj.or.jp/en/", "priority": 1},
"boe": {"url": "https://www.bankofengland.co.uk/news", "priority": 1},
"rba": {"url": "https://www.rba.gov.au/media-releases/", "priority": 1},
"snb": {"url": "https://www.snb.ch/en/", "priority": 1},
"boc": {"url": "https://www.bankofcanada.ca/press/", "priority": 1},
"rbnz": {"url": "https://www.rbnz.govt.nz/news", "priority": 1},
},
"economic_data": {
"forexfactory": {"url": "https://www.forexfactory.com/calendar", "priority": 1},
"investing_com": {"url": "https://www.investing.com/economic-calendar/", "priority": 2},
"tradingeconomics": {"url": "https://tradingeconomics.com/calendar", "priority": 2},
},
"financial_news": {
"reuters": {"url": "https://www.reuters.com/markets/", "priority": 1},
"bloomberg": {"url": "https://www.bloomberg.com/markets", "priority": 1},
"wsj": {"url": "https://www.wsj.com/news/markets", "priority": 2},
"ft": {"url": "https://www.ft.com/markets", "priority": 2},
"cnbc": {"url": "https://www.cnbc.com/world-markets/", "priority": 3},
},
"geopolitical": {
"reuters_world": {"url": "https://www.reuters.com/world/", "priority": 1},
"bbc_world": {"url": "https://www.bbc.com/news/world", "priority": 2},
},
}
```
#### News Fetching Framework
```python
import requests
from bs4 import BeautifulSoup
from datetime import datetime, timedelta
from typing import Optional
import json
class NewsFetcher:
"""
Fetch and classify market-moving news from multiple sources.
In Claude context: use web_search tool as the primary fetcher.
"""
# Impact classification keywords
HIGH_IMPACT_KEYWORDS = [
"rate decision", "interest rate", "nfp", "non-farm", "cpi", "inflation",
"gdp", "fomc", "fed chair", "ecb president", "quantitative",
"emergency", "war", "sanctions", "default", "recession", "crisis",
"tariff", "trade war", "stimulus", "bailout"]
MEDIUM_IMPACT_KEYWORDS = [
"pmi", "employment", "retail sales", "housing", "trade balance",
"industrial production", "consumer confidence", "jobless claims",
"manufacturing", "services", "earnings", "ism"]
@staticmethod
def classify_impact(headline: str) -> str:
"""Classify a headline into impact level."""
h = headline.lower()
if any(kw in h for kw in NewsFetcher.HIGH_IMPACT_KEYWORDS):
return "HIGH"
if any(kw in h for kw in NewsFetcher.MEDIUM_IMPACT_KEYWORDS):
return "MEDIUM"
return "LOW"
@staticmethod
def extract_affected_currencies(headline: str) -> list[str]:
"""Extract which currencies are likely affected by a headline."""
currency_map = {
"fed": ["USD"], "fomc": ["USD"], "nfp": ["USD"], "us ": ["USD"],
"ecb": ["EUR"], "euro": ["EUR"], "eurozone": ["EUR"],
"boe": ["GBP"], "uk ": ["GBP"], "britain": ["GBP"], "sterling": ["GBP"],
"boj": ["JPY"], "japan": ["JPY"], "yen": ["JPY"],
"rba": ["AUD"], "australia": ["AUD"],
"boc": ["CAD"], "canada": ["CAD"],
"snb": ["CHF"], "swiss": ["CHF"],
"rbnz": ["NZD"], "zealand": ["NZD"],
Voir sur GitHub