Install
$ agentstack add skill-patricksudo-fadacai-portfolio-stock-analysis ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
Stock Analysis
> 💡 模型指引:session context 100k → 先 /compact 再 Sonnet,或直接 /model opus(長 context 推理品質 Opus 更穩定)。重大決策(>5% 倉位)一律用 Opus。
Generate a standardized research report for one or more stock tickers.
Step 0: 分析前準備
預設模式(無 --current)— 純獨立分析
- 跳過 plan.md、feedback/*.md、持倉、journal 偵測
- 分析不考慮現有倉位或投資計畫,僅基於公開市場數據
- 保留 Step 0e:Verdict 之前必須完成「核心 thesis / 證偽條件 / 機率分布」三題
Step 0.5 (共用): Macro + Earnings + Fundamentals Cache Load
讀以下四份 cache:
briefing-out/cache/macro-snapshot.json— 用於 Step 0e 第一性檢查的 macro ground statebriefing-out/cache/earnings-history.json— 該 TICKER 的 trailing 8Q beat rate + surprisebriefing-out/cache/earnings-dates.json— 該 TICKER 的下次 earnings 日期briefing-out/cache/fundamentals-snapshot.json(TTL 24h)— TICKER 的三錨點輸入(peratio/pegratio/wallstreettarget/growth/margins)+forward_estimates(賣方共識 fwdEPS currfy/nextfy + EPS 修正動能)
若 TICKER 不在 earnings cache 中(如新標的)→ 跑一次 python3 tools/earnings_history.py --force;或標 (earnings cache miss)。
fundamentals cache 處理:
- TICKER 在 cache 且 mtime 30h → 先跑
python3 tools/fetch_fundamentals.py --ticker TICKER(單票 fetch + merge 進 cache,含 A4self_valuation),再讀 cache。這樣 cache miss/stale 也能取得 A4,不再直接標(self-val N/A)。Agent 3 仍同批抓get_fundamentals_snapshot+get_earnings_history作即時三錨點交叉(fetch_fundamentals 失敗時的 fallback)。 - 只有
fetch_fundamentals --ticker真的失敗(EODHD 無資料/token 缺)才標(self-val N/A)。 pe_ratio == 0.0 / null→ 丟棄 A1 錨;peg_ratio == 0.0 / null→ 丟棄 A2 錨,標(anchor unavailable)
這些 cache 資料用於:
- Section「Investment Thesis」: 引用 trailing 8Q beat rate 強化/弱化基本面論點
- Section「三錨點公允價」: A1/A2/A3 錨點計算 Fair PE + EV(取代手寫點估計)
- Section「Verdict」前呼叫
probability-honesty-checker時,強制將 macro + base rate 帶入 prompt(Step 1d、1h、1i 必填)
--current 模式 — 整合持倉與計畫
啟用後執行完整 CLAUDE.md Step 0 統一規範(0a → 0b → 0c → 0d → 0e):
- 讀
plan.md+feedback/*.md;了解此標的在計畫中的角色 - 呼叫
get_account_position取即時持倉 - 今日 journal 不存在 → 執行 gap-fill + 變動偵測 + 自動建立 journal
- 報告額外輸出「持倉確認」與「配置計畫定位」兩節
Arguments
- Single ticker:
/stock-analysis PLTR - Multiple tickers for comparison:
/stock-analysis DCO AIR - With specific focus:
/stock-analysis TEAM options(include options strategy suggestions) - With portfolio context:
/stock-analysis MU --current(activates plan.md + positions) - With Codex second opinion:
/stock-analysis MU --codexor/stock-analysis MU --2nd - Combined:
/stock-analysis MU --current --codex
Workflow
- Parse the ticker(s) from the arguments
- Gather Data using MCP tools and WebSearch:
Primary: Yahoo Finance MCP
mcp__yfinance-advanced__get_stock_info— fundamentals, analyst targets, margins, PE ratiosmcp__yfinance-advanced__get_financial_statement(income_stmt) — revenue, earnings trendsmcp__yfinance-advanced__get_recommendations(recommendations) — analyst consensusmcp__yfinance-advanced__get_yahoo_finance_news— recent headlinesmcp__yfinance-advanced__get_historical_stock_prices(period=6mo) — price trend
Secondary: SEC EDGAR MCP (for deeper analysis)
mcp__sec-edgar-mcp__get_financials(statement_type="all") — official SEC financial datamcp__sec-edgar-mcp__get_insider_transactions(days=90) — insider buying/sellingmcp__sec-edgar-mcp__get_recent_filings(days=60) — recent 8-K, 10-K/Q filingsmcp__sec-edgar-mcp__get_segment_data— revenue breakdown by geography/product
Technical: Technical Indicators MCP
mcp__technical-mcp__get_technical_indicators— RSI, MACD, Bollinger Bands, ATR, momentum score, trendmcp__technical-mcp__get_support_resistance— support/resistance levels, 52-week range
Sentiment: EODHD MCP
mcp__eodhd-mcp__get_news_sentiment— news with AI sentiment scoresmcp__eodhd-mcp__get_sentiment_trend— 30-day sentiment trajectory
Tertiary: FMP MCP (free tier, supplementary)
mcp__fmp-mcp__getStockPeers— peer companies for comparisonmcp__fmp-mcp__getCompanyProfile— company profile (fallback if yfinance incomplete)
Supplementary: WebSearch (if MCP data is insufficient)
- Search: "[TICKER] stock analysis 2026"
- Search: "[TICKER] earnings revenue growth"
平行數據收集(Agent 子代理 — subagent_type: "data-collector"):
使用 Agent tool 平行派遣以下 3 組子代理(每組指定 subagent_type: "data-collector",自動使用 Haiku 4.5 純數據收集):
- Agent 1 — Yahoo Finance(subagent_type: "data-collector"):
get_stock_info+get_financial_statement+get_recommendations+get_yahoo_finance_news+get_historical_stock_prices - Agent 2 — SEC EDGAR(subagent_type: "data-collector"):
get_financials(all)+get_insider_transactions(90d)+get_recent_filings(60d)+get_segment_data - Agent 3 — Technical + Sentiment + EODHD Fundamentals(subagent_type: "data-collector"):
get_technical_indicators+get_support_resistance+get_sentiment_trend+get_news_sentiment(ticker format: TICKER.US);若 fundamentals cache miss 或 mtime > 30h,同批加抓mcp__eodhd-mcp__get_fundamentals_snapshot(TICKER.US)+mcp__eodhd-mcp__get_earnings_history(TICKER.US)(不額外 round-trip)
多股比較時,為每個 ticker 各派一組 Agent。若 Agent tool 不可用,依序呼叫亦可。
⚠️ Agent 失敗 fallback:若 Agent 3(Technical)回傳空結果或聲稱「沒有 MCP 權限」,主 Claude 直接呼叫 mcp__technical-mcp__get_technical_indicators + mcp__technical-mcp__get_support_resistance + mcp__eodhd-mcp__get_sentiment_trend,絕不跳過技術分析 section。
- Check Current Portfolio(
--current模式才執行)
- 呼叫
get_account_position確認是否持有此標的 - 若持有,在報告開頭輸出「持倉確認」段落(成本、口數、損益)
4a. Thesis Ledger 雙向整合(--current 或有持倉時執行;新標的分析只做「寫」端)
讀端(consumer)— 了解「上次的論點驗證了沒」
python3 tools/thesis_ledger.py list --ticker TICKER
輸出「📋 {TICKER} 既有 thesis 狀態」段落:
| thesis slug | 命題 | 建立 | 狀態 | 上次 resolve 結果 | 公允價 before→after | 價格影響 | 下一步 |
|------------|------|------|------|-----------------|---------------------|---------|------|
| memory-cycle | DRAM ASP上漲... | 2026-01-10 | pending | — | — | — | 等 Q2財報 |
| q1-guide-exec | Q1 guide確認... | 2026-02-01 | passed | AI revenue +6% | $460→$490 | +6.5% | HOLD |
若帳本無此 ticker → 輸出「📋 {TICKER} 帳本:無既有 thesis」
若有 today-due thesis(due 命令輸出中出現此 ticker)→ 在此段末尾標: ⚠️ 今日到期 thesis:{slug} — 請在本次分析後執行 D2 三桶分解 + resolve
如果有到期需驗收的 thesis,執行 D2:
- 從本次 Agent 數據抓實際指標(財報數字/分析師 PT/毛利率等)
- 照 briefing Step 0.7 邏輯做 passed/failed/partial 三桶分解
- 呼叫
resolve帶結構化旗標(--fair-value-before從上次登錄時的公允價基準取,或從 history 最後一筆取)
寫端(producer)— 本次分析的新 thesis 登錄(Verdict 後執行)
凡 Verdict 含明確時間/事件觸發點的論點,在輸出末尾登錄:
python3 tools/thesis_ledger.py list --ticker TICKER # 先查既有 slug
python3 tools/thesis_ledger.py add --ticker TICKER --slug \
--thesis "" --falsification "" "" \
--trigger-type event|date --trigger-date YYYY-MM-DD \
[--event earnings] [--metric "到期要比的指標"] --source stock-analysis \
--ev ""
新增 --ev 時同時記錄當下基準公允價(= fair_value_before 的基準,日後 resolve 時用)
4b. 訊號擷取 & Thesis 候選(Signal Extraction,stock-analysis 預設開)
> 目的:從 news body + SEC 8-K + 財報逐字稿抽已量化陳述,用以補強/修正 thesis 機率分布輸入(Step 0e)。
反幻覺門檻(必守): 每個 signal 必須附 raw_quote(≤120 字逐字引用);無 quote → 無 signal;只有 narrative → 明寫「無可量化信號(only narrative)」。
資料管道優先順序:
- SEC 8-K(Agent 2
analyze_8k/get_recent_filings14d 內)→confidence: high - 財報逐字稿(
mcp__fmp-mcp__getEarningsTranscript最新一份,取 capex/ASP/wafer/utilization 句)→confidence: high;僅財報後 30 天內 - EODHD raw news body(
news-articles.jsonStep 0.67,或mcp__eodhd-mcp__get_news即時抓)→confidence: medium - FMP segment(
mcp__fmp-mcp__getRevenueProductSegmentation)→confidence: medium(有數字才算)
訊號 record(Claude 輸出,不寫 JSON cache):
metric: wafer_starts / capex / ASP_QoQ / segment_revenue / utilization / ...
value: "+8% QoQ"(逐字含單位)
direction: up | down | flat
ticker, source_url_or_desc, source_type: sec_8k | transcript | news | fmp_segment
date, confidence: high | medium | low
raw_quote: "" ← 無此欄 = 不成立
Signal → Thesis 轉換後登錄(confidence ∈ {high, medium} 且有明確前瞻 trigger):
python3 tools/thesis_ledger.py list --ticker # 先查重
python3 tools/thesis_ledger.py add --ticker --slug \
--thesis "" \
--falsification "" "" "" \
--trigger-type event|date --trigger-date YYYY-MM-DD \
--event earnings --metric "" \
--source signal-inference \
--ev "signal: , , conf="
confidence=low 或純 paraphrase → 在報告文字呈現即可,不入 ledger。exit-code-2 碰撞 → 改 slug 或 supersede。
輸出段落(報告末尾):
### §4b 訊號擷取
| metric | value | dir | source | confidence | raw_quote(首 80 字) |
|--------|-------|-----|--------|------------|----------------------|
| wafer_starts | +8% QoQ | up | Reuters/EODHD | medium | "...逐字引用..." |
THESIS 候選:[若有 high/medium conf 訊號]
- slug: wafer-starts-bit-growth → 已登錄 thesis_ledger
[若無]
- 無可量化信號(only narrative news,無 SEC 8-K / 逐字稿量化句)
- Generate Report for each ticker:
Standard Report Format
## [TICKER] - [Company Name] ($XX.XX)
**Sector:** [sector] | **Market Cap:** $XXB | **Forward PE:** XX.X
### Key Metrics
| Metric | Value |
|--------|-------|
| Revenue (TTM) | $X.XB |
| Revenue Growth (YoY) | XX% |
| EPS (TTM) | $X.XX |
| EPS Growth | XX% |
| Forward PE | XX.X |
| PEG Ratio | X.XX |
| Gross Margin | XX% |
| Free Cash Flow | $XM |
| Debt/Equity | X.XX |
### Investment Thesis
- Bull case (2-3 points)
- Bear case (2-3 points)
### Analyst Consensus
- Rating: Buy/Hold/Sell
- Price Target Range: $XX - $XX
- Median Target: $XX (upside/downside %)
### Technical Analysis
Use `mcp__technical-mcp__get_technical_indicators` and `mcp__technical-mcp__get_support_resistance`.
| Indicator | Value | Signal |
|-----------|-------|--------|
| RSI (14) | XX.X | Overbought/Neutral/Oversold |
| MACD | line/signal/histogram | Golden Cross/Death Cross/None |
| Bollinger %B | X.XX | Upper/Middle/Lower band |
| ATR (normalized) | X.X% | Low/Medium/High volatility |
| Momentum Score | XX | -100 to +100 |
| Trend | description | |
| Volume Ratio | X.XX | Above/Below average |
**Support & Resistance:**
| Level Type | Price | Distance % |
|------------|-------|-----------|
| Resistance 1 | $XX.XX | +X.X% |
| Support 1 | $XX.XX | -X.X% |
| 52W High | $XX.XX | -X.X% |
| 52W Low | $XX.XX | +X.X% |
**Entry Timing:**
- RSI > 70: avoid chasing, wait for pullback
- RSI --shares \
--cash --debt --growth [--wacc 0.10] [--terminal 0.03]
```
回 `intrinsic_value_per_share`。FCF≤0 → 工具自動回 N/A(標 `DCF 不適用(FCF 為負)`)。**DCF 僅 sanity flag,不進 EV**;高成長股 terminal 佔比常 >70%(工具會回 `terminal_pct_of_ev`),偏離大時註明「假設敏感、參考性低」。FMP getDCFValuation 僅作備援(通常 402)。
- **機率分布:**
| 情境 | 機率 | FwdEPS | A1 | A2 | A3 | Fair PE | 公允價 |
|------|------|--------|-----|-----|-----|---------|--------|
| 樂觀 | XX% | $X | XX | XX | XX | XX(max×1.25) | $XXX |
| 基準 | XX% | $X | — | — | — | XX(median) | $XXX |
| 悲觀 | XX% | $X | XX | XX | XX | XX(min×0.70) | $XXX |
Expected value = Σ(機率 × 公允價) = $XXX → vs 現價 $XXX:±X%
DCF 交叉(`simple_dcf.py` 自建,必做):`DCF: $XXX vs 基準公允 $XXX(差 ±X%);terminal 佔 EV X%`(FCF 20% 才說):
- A4 > A3 + 20%:「我的營收/利潤推估較 Street 樂觀 — 檢查是否有市場未定價的成長催化」
- A4 若 Codex 失敗 → 輸出 `⚠️ Codex 不可用:[error],跳過第二意見`,繼續正常輸出。
---
## Output Language
Use Traditional Chinese (繁體中文) for all text output.
## 存檔 + HTML 生成
報告完成後:
1. 使用 Write tool 把完整 markdown 寫到 `briefing-out/stock-analysis--YYYY-MM-DD.md`
2. 執行:
```bash
python3 tools/generate_html.py stock-analysis briefing-out/stock-analysis--YYYY-MM-DD.md --push
成功時印出網頁連結,失敗(repo 尚未建立)時印警告並繼續。
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: PatrickSUDO
- Source: PatrickSUDO/fadacai-portfolio
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.