phase-7: code restructure
This commit is contained in:
@@ -1,165 +0,0 @@
|
||||
# Market News Analysis & Catalyst Screener
|
||||
|
||||
A structured workflow for converting daily news into actionable trade ideas, validated by the screener's fundamental and market-adjusted analysis.
|
||||
|
||||
---
|
||||
|
||||
## 1. How This Fits Into the Screener Workflow
|
||||
|
||||
```
|
||||
Daily News
|
||||
↓
|
||||
Catalyst Prompt (Section 2) → Generates tickers + bias + horizon
|
||||
↓
|
||||
market_screener (npm start) → Fundamental + Market-Adjusted scoring
|
||||
↓
|
||||
Validation (Section 4) → Is the fundamental thesis intact?
|
||||
↓
|
||||
Decision → Act / Monitor / Discard
|
||||
```
|
||||
|
||||
**Key principle:** The screener doesn't tell you *when* to trade — catalysts do that. The screener tells you whether the *underlying business* supports the trade or whether you're purely momentum-chasing.
|
||||
|
||||
---
|
||||
|
||||
## 2. Catalyst Analysis Prompt
|
||||
|
||||
Copy and paste this into your LLM daily. Provide it with 3–5 news headlines.
|
||||
|
||||
> **Role:** You are a quantitative financial analyst specialising in catalyst-driven trading.
|
||||
>
|
||||
> **Task:** Analyse the provided news and map each story to the assets structurally forced to respond.
|
||||
>
|
||||
> **For each catalyst, identify:**
|
||||
> 1. **Type:** Macro (Fed, rates, GDP) | Sector (regulatory, supply chain, commodity) | Company (earnings, guidance, M&A)
|
||||
> 2. **Primary ticker:** The asset directly impacted.
|
||||
> 3. **Ripple-effect ticker:** A supply chain partner, direct competitor, or sector peer that moves *before* the market catches on. This is the alpha play.
|
||||
> 4. **Bias:** Bull or Bear — with a one-sentence mechanistic reason (not sentiment).
|
||||
> 5. **Horizon:** Short (1–5 days) | Medium (1–4 weeks) | Long (1+ quarter).
|
||||
> 6. **Sensitivity:** How exposed is this ticker to the catalyst?
|
||||
> - **5** — Direct revenue impact > 20% of annual sales
|
||||
> - **4** — Direct revenue impact 10–20%
|
||||
> - **3** — Indirect exposure via cost structure or supply chain
|
||||
> - **2** — Sector correlation, limited direct exposure
|
||||
> - **1** — Macro tailwind/headwind only
|
||||
>
|
||||
> **Constraints:**
|
||||
> - Exclude generic analyst upgrades and "market sentiment" stories.
|
||||
> - Only include events with a measurable impact on valuation or supply chain fundamentals.
|
||||
> - Do not suggest tickers with average daily volume below 500k.
|
||||
> - For Bear plays: require at least one of — elevated short interest (>5% of float), negative earnings revision trend, or sector rotation evidence.
|
||||
|
||||
---
|
||||
|
||||
## 3. Quantitative Impact Matrix
|
||||
|
||||
Output from the prompt above. Log results here before running the screener.
|
||||
|
||||
| Catalyst | Type | Primary | Ripple | Bias | Sensitivity | Horizon | Mechanics |
|
||||
| :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
|
||||
| [Event] | Macro/Sector/Co. | [TICKER] | [TICKER] | Bull/Bear | 1–5 | Short/Med/Long | [One-line financial logic] |
|
||||
|
||||
---
|
||||
|
||||
## 4. Ripple-Effect Reference Map
|
||||
|
||||
When a catalyst hits a primary ticker, these are the typical second-order targets by category.
|
||||
|
||||
| Primary Event | Ripple Targets | Logic |
|
||||
| :--- | :--- | :--- |
|
||||
| **Semis beat** (NVDA, AMD) | TSMC, ASML, AMAT, KLAC | Fab capacity demand follows chip demand |
|
||||
| **Semis miss** | INTC, MU, WDC | Inventory builds at competitors |
|
||||
| **Cloud CapEx guidance up** (MSFT, GOOGL, AMZN) | EQIX, DLR (data center REITs), NFLX infra | Power + cooling demand, bandwidth |
|
||||
| **Oil supply shock** | XOM, CVX (Bull); DAL, UAL (Bear) | Energy input costs hit airlines directly |
|
||||
| **Fed rate hike** | TLT, IEF (Bear); XLF, BRK (Bull) | Long-duration bonds reprice; bank margins expand |
|
||||
| **Fed rate cut** | TLT, XLRE (Bull); XLF (Bear) | REITs re-rate; bank NIM compresses |
|
||||
| **Strong USD** | EEM, multinational exporters (Bear) | Revenue headwind for USD-earners abroad |
|
||||
| **Retail sales miss** | WMT, TGT (Bear); AMZN (neutral/Bull) | Discretionary demand shift to e-commerce |
|
||||
| **Pharma approval** | Competitor biotech (Bear) | Market share displacement |
|
||||
| **Cybersecurity breach (major)** | CRWD, PANW, FTNT (Bull) | Accelerates enterprise security spend |
|
||||
|
||||
---
|
||||
|
||||
## 5. Validation Checklist
|
||||
|
||||
Before acting on a catalyst, run the tickers through the screener and answer:
|
||||
|
||||
### For Bull plays:
|
||||
- [ ] Does it pass the **Market-Adjusted** analysis? (minimum bar — if not, it's pure momentum)
|
||||
- [ ] Does it pass **Fundamental** analysis? (if yes → Strong Buy conviction; if not → Speculation)
|
||||
- [ ] Is FCF yield positive? (sustains the business through the catalyst period)
|
||||
- [ ] Is D/E manageable? (high leverage + catalyst = binary outcome, size accordingly)
|
||||
- [ ] Is the 52-week position below 85%? (if near highs, the market may have priced it in)
|
||||
|
||||
### For Bear plays:
|
||||
- [ ] Does it **fail both** analyses? (confirms the fundamental short thesis)
|
||||
- [ ] Is short interest > 5% of float? (existing agreement in the market)
|
||||
- [ ] Is the horizon realistic? (overvalued stocks can stay overvalued — Bear plays need a catalyst *timeframe*)
|
||||
|
||||
### Horizon vs screener relevance:
|
||||
| Horizon | Use screener for... |
|
||||
| :--- | :--- |
|
||||
| Short (1–5 days) | Confirm the stock isn't already broken (avoid catching falling knives on longs) |
|
||||
| Medium (1–4 weeks) | Gate check — does fundamental quality support a re-rating? |
|
||||
| Long (1+ quarter) | Full weight on both analyses — you need the fundamentals on your side |
|
||||
|
||||
---
|
||||
|
||||
## 6. Current Market Regime Context
|
||||
|
||||
> **This section should be refreshed from `npm start` output before each session.**
|
||||
|
||||
The screener derives the current regime from live Yahoo Finance data on startup:
|
||||
|
||||
| Signal | What it means for catalysts |
|
||||
| :--- | :--- |
|
||||
| **Rate Regime: HIGH** (10Y > 5%) | Long-duration trades are punished. Favour cash-generative, short-horizon plays. Short TLT, long XLF. |
|
||||
| **Rate Regime: NORMAL** (2–5%) | Standard playbook applies. |
|
||||
| **Rate Regime: LOW** (< 2%) | Growth and duration trades work. REITs and long bonds are viable longs. |
|
||||
| **Volatility: HIGH** (VIX > 25) | Position sizes down. Mean-reversion trades outperform momentum. |
|
||||
| **Volatility: NORMAL** (VIX 15–25) | Trend-following works. |
|
||||
| **Volatility: LOW** (VIX < 15) | Risk-on. Momentum and growth outperform. Watch for complacency reversals. |
|
||||
|
||||
---
|
||||
|
||||
## 7. Bear Catalyst Template
|
||||
|
||||
A structured short thesis requires more rigour than a bull thesis. Use this template.
|
||||
|
||||
> **Ticker:** [TICKER]
|
||||
>
|
||||
> **Catalyst:** [What event breaks the bull narrative?]
|
||||
>
|
||||
> **Fundamental support:**
|
||||
> - Fails screener gate: [which gate, e.g. "P/E 120x > inflated gate of 57x"]
|
||||
> - Trend: [revenue decelerating / margins compressing / FCF turning negative]
|
||||
>
|
||||
> **Market structure support (need at least one):**
|
||||
> - Short interest: [X% of float]
|
||||
> - Earnings revision trend: [# of downward revisions last 90 days]
|
||||
> - Sector rotation: [which sector ETF is seeing outflows]
|
||||
>
|
||||
> **Risk to thesis:** [What would invalidate the short — e.g. "earnings beat with raised guidance"]
|
||||
>
|
||||
> **Horizon:** [Short / Medium / Long]
|
||||
> **Stop:** [Price level or event that closes the trade]
|
||||
|
||||
---
|
||||
|
||||
## 8. Adding Catalyst Tickers to the Screener
|
||||
|
||||
Edit `index.js` and add tickers from the Impact Matrix to the `tickers` array, then run:
|
||||
|
||||
```bash
|
||||
npm start
|
||||
```
|
||||
|
||||
The screener will score each ticker under both the **Market-Adjusted** and **Fundamental** lenses and open `screener-report.html` with the full breakdown. Cross-reference the Signal column with your catalyst thesis:
|
||||
|
||||
| Signal | Catalyst interpretation |
|
||||
| :--- | :--- |
|
||||
| ✅ Strong Buy | Fundamental quality + catalyst momentum aligned. Highest conviction. |
|
||||
| ⚡ Momentum | Catalyst works in today's market but price is stretched on fundamentals. Respect the stop. |
|
||||
| ⚠️ Speculation | Pure catalyst play — fundamentals don't support it. Small size, tight stop. |
|
||||
| 🔄 Neutral | Catalyst may be already priced in. Wait for a better entry or skip. |
|
||||
| ❌ Avoid | Screener and catalyst are both negative. Only valid as a Bear trade. |
|
||||
@@ -0,0 +1,4 @@
|
||||
// Central export point for all system prompts
|
||||
// Add new prompts here as they're created
|
||||
|
||||
export { LLM_ANALYST_PROMPT } from './llm-analyst';
|
||||
@@ -0,0 +1,45 @@
|
||||
You are a professional equity analyst specialising in catalyst-driven trading.
|
||||
|
||||
You will be given today's market news headlines (with Yahoo-tagged tickers per story) and a ranked ticker frequency list showing how many stories mention each ticker.
|
||||
|
||||
Your job:
|
||||
1. Write a 2–3 sentence market summary capturing the dominant theme and tone.
|
||||
2. Assess overall market sentiment as BULLISH, NEUTRAL, or BEARISH.
|
||||
3. Identify up to 4 industries secondarily affected — not directly mentioned, but impacted via contagion, supply chain, regulation, or macro.
|
||||
4. Suggest up to 6 tickers worth screening. For each one provide:
|
||||
- **ticker** — must have ADV > 500k; exclude generic analyst upgrades with no valuation catalyst
|
||||
- **reason** — one mechanistic sentence (revenue/cost/supply-chain logic, not sentiment)
|
||||
- **bias** — BULL or BEAR
|
||||
- **horizon** — SHORT (1–5 days) | MEDIUM (1–4 weeks) | LONG (1+ quarter)
|
||||
- **sensitivity** — how exposed this ticker is to the catalyst:
|
||||
- 5 = direct revenue impact > 20% of annual sales
|
||||
- 4 = direct revenue impact 10–20%
|
||||
- 3 = indirect exposure via cost structure or supply chain
|
||||
- 2 = sector correlation, limited direct exposure
|
||||
- 1 = macro tailwind/headwind only
|
||||
|
||||
Constraints:
|
||||
- Prioritise tickers that appear multiple times in the frequency list — repeated mentions signal broader market awareness.
|
||||
- For BEAR picks: require at least one of — elevated short interest, negative earnings revision trend, or sector rotation evidence.
|
||||
- Do not suggest tickers already in the "already identified" list unless the story adds a new directional angle.
|
||||
- Prefer ripple-effect tickers (supply chain partners, direct competitors, sector peers) over the primary ticker already in the news — those are where the alpha is.
|
||||
|
||||
Return ONLY valid JSON in this exact shape — no markdown, no explanation:
|
||||
```json
|
||||
{
|
||||
"summary": "string",
|
||||
"sentiment": "BULLISH" | "NEUTRAL" | "BEARISH",
|
||||
"affectedIndustries": [
|
||||
{ "name": "string", "reason": "string" }
|
||||
],
|
||||
"relatedTickers": [
|
||||
{
|
||||
"ticker": "string",
|
||||
"reason": "string",
|
||||
"bias": "BULL" | "BEAR",
|
||||
"horizon": "SHORT" | "MEDIUM" | "LONG",
|
||||
"sensitivity": 1 | 2 | 3 | 4 | 5
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user