skills/market-top-detector/SKILL.md
Detects market top probability using O'Neil Distribution Days, Minervini Leading Stock Deterioration, and Monty Defensive Sector Rotation. Generates a 0-100 composite score with risk zone classification. Use when user asks about market top risk, distribution days, defensive rotation, leadership breakdown, or whether to reduce equity exposure. Focuses on 2-8 week tactical timing signals for 10-20% corrections.
npx skillsauth add kavi-lin/stock market-top-detectorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Detect the probability of a market top formation using a quantitative 6-component scoring system (0-100). Integrates three proven market top detection methodologies:
Unlike the Bubble Detector (macro/multi-month evaluation), this skill focuses on tactical 2-8 week timing signals that precede 10-20% market corrections.
English:
Japanese:
Required:
sector/market_top_yfinance.py, which reuses every analysis function from this skill but swaps the FMP client for yfinance — no API key, no WebSearch required. Works under Claude / Codex / Gemini / cron equally.Optional (improves sentiment + breadth scoring; missing → recorded in data_quality.missing_optional):
--breadth-50dma <pct> --breadth-50dma-date <YYYY-MM-DD>--put-call <ratio> --put-call-date <YYYY-MM-DD>--margin-debt-yoy <pct> --margin-debt-date <YYYY-MM-DD>--vix-term {steep_contango|contango|flat|backwardation} (auto-detected from yfinance ^VIX/^VIX3M if not supplied)Codex compatibility note (v3.14.2): The original SKILL spec mandated WebSearch to fetch the optional metrics above. That requirement is now downgraded — the script falls back to yfinance + TraderMonty breadth (auto-fetched) when those flags are absent, and reports the missing inputs in
data_quality.missing_optional. Claude users can still WebSearch + supply the flags for higher accuracy; Codex / cron users get a graceful degraded score.
Data Freshness: All optional inputs should be from the most recent 3 business days for accurate analysis.
| Aspect | Market Top Detector | Bubble Detector | |--------|-------------------|-----------------| | Timeframe | 2-8 weeks | Months to years | | Target | 10-20% correction | Bubble collapse (30%+) | | Methodology | O'Neil/Minervini/Monty | Minsky/Kindleberger | | Data | Price/Volume + Breadth | Valuation + Sentiment + Social | | Score Range | 0-100 composite | 0-15 points |
sector/market_top_yfinance.py (production / cron / Codex)python3 sector/market_top_yfinance.py --output-dir sector/market_top_cache/
# With optional sentiment / breadth inputs (Claude WebSearch may supply these):
python3 sector/market_top_yfinance.py \
--output-dir sector/market_top_cache/ \
--breadth-50dma 45.0 --breadth-50dma-date 2026-05-19 \
--put-call 0.72 --put-call-date 2026-05-19 \
--margin-debt-yoy 5.2 --margin-debt-date 2026-04-30 \
--vix-term contango
This is the entry used by daily_update.sh Step 3 and by bridge.py. It:
--breadth-200dma, disable --no-auto-breadth).skills/market-top-detector/scripts/ (composite scoring, distribution days, leading-stock health, defensive rotation, breadth divergence, index technical, sentiment, follow-through-day, historical comparator, scenario engine).data_quality.missing_optional instead of failing.When running under Claude (with WebSearch / WebFetch tools available), the model may collect the four optional inputs and pass them as flags above for a higher-confidence score:
1. S&P 500 50DMA breadth — "S&P 500 percent stocks above 50 day moving average"
2. CBOE equity Put/Call ratio — "CBOE equity put call ratio today"
3. Margin debt YoY — "FINRA margin debt latest year over year"
4. VIX term structure — usually auto-detected from ^VIX3M; WebSearch only when yfinance fails
Codex / cron callers skip this step entirely — the script falls back to yfinance + TraderMonty breadth and reports data_quality.missing_optional.
scripts/market_top_detector.pyThe original FMP-based entry python3 skills/market-top-detector/scripts/market_top_detector.py --api-key $FMP_API_KEY ... still works but requires FMP. Production switched to the yfinance adapter above in v3.x because FMP-only blocked Codex / cron runs. Keep using sector/market_top_yfinance.py unless you specifically need FMP data lineage.
Present the generated Markdown report to the user, highlighting:
| # | Component | Weight | Data Source | Key Signal |
|---|-----------|--------|-------------|------------|
| 1 | Distribution Day Count | 25% | FMP API | Institutional selling in last 25 trading days |
| 2 | Leading Stock Health | 20% | FMP API | Growth ETF basket deterioration |
| 3 | Defensive Sector Rotation | 15% | FMP API | Defensive vs Growth relative performance |
| 4 | Market Breadth Divergence | 15% | Auto (CSV) + optional CLI | 200DMA (auto from TraderMonty) / 50DMA (optional --breadth-50dma) breadth vs index level |
| 5 | Index Technical Condition | 15% | FMP API | MA structure, failed rallies, lower highs |
| 6 | Sentiment & Speculation | 10% | yfinance + optional CLI | VIX (yfinance), Put/Call + term structure (optional --put-call / --vix-term) |
| Score | Zone | Risk Budget | Action | |-------|------|-------------|--------| | 0-20 | Green (Normal) | 100% | Normal operations | | 21-40 | Yellow (Early Warning) | 80-90% | Tighten stops, reduce new entries | | 41-60 | Orange (Elevated Risk) | 60-75% | Profit-taking on weak positions | | 61-80 | Red (High Probability Top) | 40-55% | Aggressive profit-taking | | 81-100 | Critical (Top Formation) | 20-35% | Maximum defense, hedging |
Required: none — yfinance is keyless. Canonical entry sector/market_top_yfinance.py.
Optional: Claude WebSearch (to supply 50DMA breadth / Put-Call / margin debt as CLI flags); legacy FMP path for scripts/market_top_detector.py. Both improve accuracy when available; absence is logged in data_quality.missing_optional, never fails.
market_top_YYYY-MM-DD_HHMMSS.jsonmarket_top_YYYY-MM-DD_HHMMSS.mdreferences/market_top_methodology.mdreferences/distribution_day_guide.mdreferences/historical_tops.mdmarket_top_methodology.md for full framework understandingdistribution_day_guide.mdhistorical_tops.mddevelopment
# earnings-analyst — 個股財報深度分析 > **Trigger**: `財報 [TICKER]` > **Version**: V1.0 > **Data Source**: FMP HTTP REST(`$FMP_API_KEY`) ## 目的 針對單一個股產出**深度財報分析報告**(逐季趨勢、品質指標、估值、分析師共識),涵蓋 sector V1.4 與 `分析 [TICKER]` 既有 protocol **沒有**的「財報層級」深潛內容。 ## 與既有 skill 的差異 | Skill | 重點 | 觸發 | |---|---|---| | `us-stock-analysis` | 估值/技術/情緒 snapshot(yfinance + FMP partial) | Phase 2 fundamentals lane | | `earnings-valuation-forecaster` | 12M 目標價 3×3 敏感度 | ad-hoc / earnings 前 14 天 | | `earnings-trade-analyzer` |
testing
Daily Top N hot themes × Top M short-term movers per theme. Combines theme-detector heat scoring (medium-term) with short-term-target predictions (1d/5d/15d) into a "Tactical Opportunity Radar" recommendation log. Tags concentration WARNING when ≥2 picks share theme. Records FRED + market regime snapshot at recommendation time for future backtest cross-tabs. Standalone — not auto-wired into investment_protocol. Use for daily watchlist refresh / Dashboard推薦面板feed / batch screening across hot themes.
testing
Short-term (1d / 5d / 15d) directional projection for a US stock — "Tactical Opportunity Radar". Outputs target range + confidence breakdown + benchmark-relative alpha + trading meta (stop / position size hint / exit trigger). Each horizon uses independent weights from config/weights.yaml. Refuses to project when source data is stale (returns insufficient_data with reasons). Hard-clamped to prevent cold-start absurd predictions. Use when caller wants short-term directional bias on a specific ticker, NOT for long-term valuation (use earnings-valuation-forecaster for 12-month). Standalone — not auto-wired into investment_protocol.
tools
Shared Finnhub API client used by other skills. Provides rate-limited (60/min), cached, retry-aware access to 17 Finnhub endpoints covering quotes, OHLCV, fundamentals, earnings calendar, earnings surprises, insider transactions, recommendation history, price targets, upgrades/downgrades, dividends, splits, IPOs, and SEC filings. Also exports adapters that normalize Finnhub raw responses into FMP-compatible shapes so that downstream code can swap providers without changing call sites. Use when another skill needs Finnhub data or when building a unified provider layer.