Instruction file imported from fjkiani/lotto-machine (
.cursor/rules/rapidapi-exploitation-plan.mdc). Copyright stays with the author.
📡 RapidAPI Exploitation Plan - Yahoo Finance 15
Created: 2025-12-19 API: Yahoo Finance 15 (RapidAPI) Status: TESTED & VALIDATED ✅
🎯 MISSION
Exploit the Yahoo Finance 15 RapidAPI to enhance our:
- News Intelligence - Real-time market narrative extraction
- Price Data - Live quotes and historical data
- Technical Indicators - SMA, RSI, MACD, ADX
- Narrative Brain - Contextual market storytelling
🔑 API CREDENTIALS
RAPIDAPI_KEY = "9f107deaabmsh2efbc3559ddca05p17f1abjsn271e6df32f7c"
RAPIDAPI_HOST = "yahoo-finance15.p.rapidapi.com"
BASE_URL = "https://yahoo-finance15.p.rapidapi.com/api"
Store in .env:
YAHOO_RAPIDAPI_KEY=9f107deaabmsh2efbc3559ddca05p17f1abjsn271e6df32f7c
YAHOO_RAPIDAPI_HOST=yahoo-finance15.p.rapidapi.com
✅ VALIDATED ENDPOINTS
1. 📰 News Intelligence - /v2/markets/news
Status: ✅ WORKING - GOLD MINE
Request:
GET /api/v2/markets/news?ticker=SPY&type=ALL
Response (50 articles):
{
"meta": {"status": 200, "total": 50},
"body": [
{
"url": "https://seekingalpha.com/article/...",
"img": "https://cdn.snapi.dev/images/...",
"title": "S&P 500: Butterfly Effect From Japan Rate Hike",
"text": "Japan's anticipated rate hike marks a historic shift...",
"source": "Seeking Alpha",
"type": "Article",
"tickers": ["#IVV", "#SPXL", "#SSO", "#UPRO", "#VOO"],
"time": "Dec 18, 2025, 5:22 PM EST",
"ago": "2 hours ago"
}
]
}
Exploitation Strategy:
- Fetch news for SPY, QQQ every 15 minutes
- Filter by recency ("1 hour ago", "2 hours ago")
- Extract key themes using LLM (Diffbot or local)
- Detect sentiment divergence (bullish/bearish headlines)
- Feed context to Narrative Brain
Key Data Points:
title- Headline for quick scantext- Summary for contextsource- Weight by credibility (Seeking Alpha > random blog)tickers- Cross-reference with our universeago- Filter for freshness
2. 📊 Real-Time Quotes - /v1/markets/stock/quotes
Status: ✅ WORKING - COMPREHENSIVE
Request:
GET /api/v1/markets/stock/quotes?ticker=SPY,QQQ
Response (Key Fields):
{
"symbol": "SPY",
"regularMarketPrice": 676.47,
"regularMarketChange": 5.07,
"regularMarketChangePercent": 0.755,
"regularMarketVolume": 107490904,
"regularMarketDayHigh": 680.72,
"regularMarketDayLow": 674.9,
"regularMarketOpen": 677.6,
"regularMarketPreviousClose": 671.4,
"fiftyDayAverage": 674.83,
"twoHundredDayAverage": 621.51,
"fiftyTwoWeekHigh": 689.7,
"fiftyTwoWeekLow": 481.8,
"trailingPE": 27.28,
"dividendYield": 1.06,
"ytdReturn": 17.69,
"marketState": "POSTPOST",
"postMarketPrice": 676.445,
"postMarketChange": -0.025
}
Exploitation Strategy:
- Use for real-time price confirmation
- Calculate gap from previous close (pre-market gap signals)
- Compare to 50/200 day averages
- Track post-market moves
3. 📈 Historical Data - /v1/markets/stock/history
Status: ✅ WORKING
Request:
GET /api/v1/markets/stock/history?ticker=SPY&period=1d&interval=1m
Response:
- Minute-by-minute OHLCV data
- Use for intraday pattern detection
- Feed to signal generators
4. 📐 Technical Indicators - /v1/indicators/*
Endpoints:
/v1/indicators/sma?ticker=SPY&period=20
/v1/indicators/rsi?ticker=SPY&period=14
/v1/indicators/macd?ticker=SPY
/v1/indicators/adx?ticker=SPY&period=14
Status: ⏳ TO BE TESTED
✅ OPTIONS ENDPOINTS - GOLD MINE!
1. 📊 Most Active Options - /v1/markets/options/most-active
Status: ✅ WORKING - INCREDIBLE DATA!
Request:
GET /api/v1/markets/options/most-active?type=STOCKS
Response (Top 20 by Volume):
{
"meta": {"status": 200, "total": 500},
"body": [
{
"symbol": "TSLA",
"symbolName": "Tesla Inc",
"lastPrice": "483.37",
"priceChange": "+16.11",
"percentChange": "+3.45%",
"optionsTotalVolume": "2,956,982",
"optionsPutVolumePercent": "40.0%",
"optionsCallVolumePercent": "60.0%",
"optionsPutCallVolumeRatio": "0.67",
"optionsImpliedVolatilityRank1y": "8.02%"
}
]
}
Key Signals:
- P/C Ratio < 0.7: BULLISH call accumulation (TSLA, RIVN, AMZN)
- P/C Ratio > 1.0: BEARISH put accumulation (MSTR, NFLX, ORCL)
- Volume Spike + Direction: Institutional flow indication
2. 🔥 Unusual Options Activity - /v1/markets/options/unusual-options-activity
Status: ✅ WORKING - 1,859 UNUSUAL OPTIONS!
Request:
GET /api/v1/markets/options/unusual-options-activity?type=STOCKS
Response:
{
"meta": {"status": 200, "total": 1859},
"body": [
{
"symbol": "SEI|20260116|40.00P",
"baseSymbol": "SEI",
"baseLastPrice": "43.06",
"symbolType": "Put",
"strikePrice": "40.00",
"expirationDate": "01/16/26",
"daysToExpiration": "29",
"volume": "12,147",
"openInterest": "151",
"volumeOpenInterestRatio": "80.44",
"volatility": "92.86%",
"delta": "-0.3374"
}
]
}
Exploitation Strategy:
- Vol/OI Ratio > 30: Unusual activity (potential insider knowledge)
- Near-dated + High Vol/OI: Catalyst expected
- Far OTM + High Vol/OI: Lottery ticket/hedge
3. 📈 Options Chain - /v1/markets/options
Status: ✅ WORKING
Request:
GET /api/v1/markets/options?ticker=SPY&display=straddle
Response:
- Full options chain with straddle display
- All expirations and strikes
- Bid/Ask, Greeks, Volume, OI
❌ NON-WORKING ENDPOINTS
| Endpoint | Status | Alternative |
|---|---|---|
/v1/stock/modules |
❌ Redirect | N/A |
🧠 NARRATIVE BRAIN INTEGRATION
News → Narrative Pipeline
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ RapidAPI News │────▶│ LLM Summarizer │────▶│ Narrative Brain │
│ (50 articles) │ │ (Filter top 5) │ │ (Context Store) │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│
▼
┌─────────────────┐
│ Discord Alert │
│ (Context-Aware) │
└─────────────────┘
Implementation Plan
Phase 1: News Fetcher (2 hours)
# core/data/rapidapi_news_client.py
class RapidAPINewsClient:
def __init__(self):
self.api_key = os.getenv('YAHOO_RAPIDAPI_KEY')
self.host = os.getenv('YAHOO_RAPIDAPI_HOST')
def fetch_news(self, ticker: str, limit: int = 50) -> List[NewsArticle]:
"""Fetch latest news for ticker"""
url = f"https://{self.host}/api/v2/markets/news"
params = {"ticker": ticker, "type": "ALL"}
headers = {
"x-rapidapi-key": self.api_key,
"x-rapidapi-host": self.host
}
response = requests.get(url, params=params, headers=headers)
return self._parse_articles(response.json())
def get_recent_news(self, ticker: str, hours: int = 4) -> List[NewsArticle]:
"""Get news from last N hours"""
all_news = self.fetch_news(ticker)
return [n for n in all_news if self._is_recent(n.ago, hours)]
Phase 2: News Analyzer (3 hours)
# core/intelligence/news_analyzer.py
class NewsAnalyzer:
def __init__(self):
self.news_client = RapidAPINewsClient()
self.llm = GeminiClient() # or Diffbot
def analyze_market_narrative(self, ticker: str) -> NarrativeContext:
"""Extract narrative from recent news"""
news = self.news_client.get_recent_news(ticker, hours=4)
# Group by source credibility
credible_news = [n for n in news if n.source in CREDIBLE_SOURCES]
# Create prompt for LLM
prompt = f"""
Analyze these {len(credible_news)} headlines about {ticker}:
{self._format_headlines(credible_news)}
Extract:
1. Overall sentiment (BULLISH/BEARISH/NEUTRAL)
2. Key themes (3-5 bullet points)
3. Potential catalysts
4. Risk factors mentioned
5. Institutional positioning hints
Format as JSON.
"""
analysis = self.llm.generate(prompt)
return NarrativeContext(
ticker=ticker,
sentiment=analysis['sentiment'],
themes=analysis['themes'],
catalysts=analysis['catalysts'],
risks=analysis['risks']
)
Phase 3: Narrative Brain Enhancement (2 hours)
# Update live_monitoring/orchestrator/narrative_brain.py
class NarrativeBrain:
def __init__(self):
self.news_analyzer = NewsAnalyzer()
self.memory = NarrativeMemory()
def generate_contextual_alert(self, signal, dp_data) -> str:
"""Generate alert with news context"""
# Get recent news narrative
narrative = self.news_analyzer.analyze_market_narrative(signal.symbol)
# Check for divergence
divergence = self._detect_divergence(signal, narrative)
# Build contextual alert
alert = f"""
🧠 **CONTEXTUAL MARKET ALERT**
📊 **Signal:** {signal.signal_type} on {signal.symbol}
💰 **Action:** {signal.action} @ ${signal.entry:.2f}
📰 **News Narrative:**
{self._format_themes(narrative.themes)}
🎯 **Catalysts:** {', '.join(narrative.catalysts)}
⚠️ **Risks:** {', '.join(narrative.risks)}
{'🔄 **DIVERGENCE DETECTED:** ' + divergence if divergence else ''}
📚 **Historical Context:**
{self.memory.get_relevant_context(signal.symbol)}
"""
return alert
📅 IMPLEMENTATION TIMELINE
Week 1: Foundation
| Day | Task | Hours |
|---|---|---|
| 1 | Create RapidAPINewsClient |
2 |
| 1 | Test all endpoints, document responses | 2 |
| 2 | Create NewsAnalyzer with LLM integration |
3 |
| 2 | Build credibility scoring | 1 |
| 3 | Integrate with Narrative Brain | 2 |
| 3 | Add news context to Discord alerts | 2 |
Week 2: Enhancement
| Day | Task | Hours |
|---|---|---|
| 4 | Add Diffbot for article summarization | 3 |
| 4 | Build divergence detection | 2 |
| 5 | Add real-time quote integration | 2 |
| 5 | Technical indicators integration | 2 |
| 6 | Full system testing | 3 |
🎯 SUCCESS METRICS
- News Freshness: Alert within 30 min of major news
- Context Quality: Users understand "why" in every alert
- Divergence Detection: Catch signal/narrative mismatches
- Reduced Noise: Only alert on material narratives
📁 FILES TO CREATE
core/data/
├── rapidapi_news_client.py # News fetcher
├── rapidapi_quotes_client.py # Quote fetcher
└── rapidapi_indicators.py # Technical indicators
core/intelligence/
├── news_analyzer.py # LLM-powered analysis
├── narrative_context.py # Context dataclass
└── divergence_detector.py # Signal vs narrative
live_monitoring/orchestrator/
├── enhanced_narrative_brain.py # Updated brain
🔗 RELATED DOCS
🚀 IMMEDIATE NEXT STEPS
- ⏳ Add
YAHOO_RAPIDAPI_KEYto.env - ⏳ Create
rapidapi_news_client.py - ⏳ Test news fetching in production
- ⏳ Integrate with Narrative Brain
- ⏳ Deploy enhanced alerts
ALPHA'S MANTRA: "News is noise until we extract the signal. The API gives us the noise. The Narrative Brain gives us the edge." 📰🧠💰