Research note
How the macro-theme engine works
A five-step inference chain from macro situation to best stock pick: the human-curated catalog, the quant scoring, and what the system does not do.
The /themes page implements a 5-step inference chain: (1) macro / geopolitical situation → (2) sectors disrupted or advanced → (3) bottlenecks within those sectors → (4) companies fulfilling the bottlenecks → (5) best stock pick within the company set. The chain has two distinct halves with different feasibility profiles, and the engine handles them differently:
Steps 1–3: human-curated catalog
Steps 1–3 are qualitative and require domain knowledge that a purely quantitative engine can't generate. They live in a human-authored YAML catalog (backend/app/data/themes.yaml) covering 6 active themes:
- AI Infrastructure & Compute
- Energy Security & Dispatchable Power
- US Reshoring & Industrial Renaissance
- Defense & Geopolitical Tension
- Healthcare Innovation: GLP-1 & Beyond
- Deglobalization & Supply Chain Re-routing
Each theme bundles: a thesis paragraph, a list of macro indicators with the direction the theme prefers, a list of sector ETFs it touches, and a list of bottlenecks each with 2–4 candidate company tickers.
Steps 4–5: pure quant scoring
Steps 4–5 are quantitative. The engine scores activation and ranks companies entirely from market data:
Theme activation (0–100)
| Component | Weight | What it measures |
|---|---|---|
| Macro match | 40% | How the live indicator readings align with the theme's preferred direction |
| Sector strength | 35% | Weighted RS-Ratio + RS-Mom + RS-Accel of the theme's sector ETFs |
| Money flow | 25% | Weighted flow_intensity of the theme's sector ETFs |
Best-pick score per company (0–100)
| Component | Weight | What it measures |
|---|---|---|
| RS vs SPY 60d | 35% | Outperformance over 60 trading days, in pp |
| 20d return | 25% | Recent month price action |
| 20d acceleration | 25% | 2nd-order RoC: is the move speeding up or fading? |
| 5d return | 15% | Recency / confirmation |
What the system does not do
- No live news feed. The macro/geopolitical situation is inferred from market indicators (yields, oil, dollar, credit spreads), not from headlines.
- No fundamental analysis. Best-pick scoring is pure technical / momentum. PE, growth, margins, balance-sheet quality are not in the score.
- No theme auto-discovery. Themes are human-curated; novel macro themes need to be added to the catalog by hand.
- Not a recommendation. A high-scoring stock on this screen is a candidate worth deeper diligence, nothing more.
Worked example
When AI Infrastructure scores 60.9/100 and the best pick is MU at score 98, the chain looked like:
- Macro match 49 — neutral; macro is mixed but not hostile to capex.
- Sector strength 77 — XLK is in Leading with rising RS-Accel.
- Flow 57 — money positive into the theme's ETFs.
- Bottleneck = HBM memory & advanced packaging — MU sits here as the dedicated US pure-play.
- MU score 98 — 20d return +51%, 60d RS vs SPY +72.5pp, and momentum is ▲ confirming (still accelerating).
Each link in the chain is independently verifiable on the dashboard: the macro composite on /, sector strength on /rotation, the company's setup on its rotation row.
This article is also a chapter of the Education page.