AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Market Portfolio Risk

skill-thanhdatngo2003-claude-market-skills-market-portfolio-risk · by ThanhDatNgo2003

>

No reviews yet
0 installs
26 views
0.0% view→install

Install

$ agentstack add skill-thanhdatngo2003-claude-market-skills-market-portfolio-risk

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No 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.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-thanhdatngo2003-claude-market-skills-market-portfolio-risk)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
5mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Market Portfolio Risk? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Market Portfolio & Risk Management

> ⛔ CRITICAL: LẤY GIÁ TỪ SCRIPT/API — KHÔNG BAO GIỜ WEBSEARCH GIÁ > > Hành động ĐẦU TIÊN khi nhận danh mục: chạy python scripts/analyze_all.py [TICKER1] [TICKER2] ... cho MỖI holding. > Script dùng VPS API (realtime) + yfinance (fallback) để lấy giá CHÍNH XÁC từ sàn + phân tích kỹ thuật + cơ bản + dự báo. > Nếu script fail: dùng WebFetch gọi https://bgapidatafeed.vps.com.vn/getliststockdata/[TICKER] > > KHÔNG BAO GIỜ WebSearch giá. WebSearch chỉ cho: tin tức, sentiment, analyst, bear case. > Nếu bạn WebSearch giá thay vì chạy script/API → tỷ trọng và rebalance sẽ SAI.

🧠 BƯỚC 0 — ĐỌC JOURNAL TRƯỚC KHI PHÂN TÍCH (Learning Loop)

Skill này có bộ nhớ dài hạn lưu tại ~/.claude/skills-data/market-analyst/. Mỗi lần phân tích đều được ghi journal và Claude phải đọc track record cũ trước khi đưa ra recommendation mới.

Quy trình BẮT BUỘC:

  1. Trước phân tích — chạy: python scripts/journal_manager.py context [TICKER] --price [GIA_HIEN_TAI]
  • Trả về: track record cũ, calibration score, lessons learned, lịch sử thesis
  • Nếu bull_hit_rate /dev/null

python scripts/analyze_all.py VCB FPT HPG

Truyền TẤT CẢ holdings trong danh mục vào 1 lệnh.

Script sử dụng VPS API (realtime, không cần package) + yfinance (fallback) để lấy:
- ✅ Giá REALTIME chính xác từ sàn (VPS API: `bgapidatafeed.vps.com.vn`)
- ✅ OHLC, volume, khối ngoại mua/bán, order book, room ngoại
- ✅ Phân tích kỹ thuật: RSI, MACD, Bollinger, Ichimoku, VWAP, Elliott Wave, S/R
- ✅ Phân tích cơ bản: P/E, ROE, margins, Piotroski F-Score (từ yfinance)
- ✅ Dự báo 3 kịch bản Bull/Base/Bear
- ✅ `IMPORTANT_INSTRUCTIONS` — liệt kê những gì CẦN và KHÔNG CẦN WebSearch

**Lưu ý giá VPS API:** Trả theo đơn vị nghìn (18.1 = 18,100 VND). Script tự convert.

Portfolio analysis cần data chính xác vì: (1) tỷ trọng thực tế phụ thuộc giá hiện tại, (2) Sharpe/VaR tính sai nếu giá sai, (3) rebalance suggestions dựa trên tỷ trọng sai sẽ gây hại.

**Ưu tiên 2 — Nếu script fail (ví dụ trong Claude.ai sandbox):** Dùng **WebFetch** gọi VPS API trực tiếp:

WebFetch URL: https://bgapidatafeed.vps.com.vn/getliststockdata/[TICKER] Prompt: "Trả về JSON: lastPrice, r, c, f, highPrice, lowPrice, openPrice, lot, fBVol, fSVolume, fRoom, avePrice"

Gọi TỪNG MÃ MỘT. Nếu fail, THỬ LẠI 1 lần.

**Ưu tiên 3 — Fallback cuối cùng:** WebSearch giá từ `finance.vietstock.vn` hoặc `cafef.vn`.

Nếu thiếu thông tin danh mục (tên, tỷ trọng, vốn), hỏi lại — phân tích trên dữ liệu không đủ sẽ cho kết quả misleading.

## Bước 2: WebSearch BỔ SUNG (CHỈ cho tin tức & sentiment)

WebSearch KHÔNG dùng để lấy:
- ❌ Giá cổ phiếu (đã có từ VPS API)
- ❌ OHLC, volume, khối ngoại (đã có từ VPS API)

WebSearch CHỈ dùng cho:
- ✅ Tin tức mới nhất ảnh hưởng holdings
- ✅ Analyst consensus & khuyến nghị
- ✅ Bear case / rủi ro / contrarian
- ✅ Insider activity
- ✅ Bối cảnh vĩ mô & sector outlook

### Tại sao cần research cho portfolio review

Portfolio analysis cần dữ liệu hiện tại: tin tức mới có thể thay đổi correlation structure. Sector outlook thay đổi → rebalance priority thay đổi.

**Queries cho mỗi holding chính (1-2 queries/holding):**

"[ticker] tin tức triển vọng mới nhất" "[ticker] rủi ro 2026" ← BẮT BUỘC cho contrarian check "ngành [sector] outlook rủi ro 2026"


**Queries cho bối cảnh (2-3 queries):**

"lãi suất tiền gửi VN hiện tại" "correlation cổ phiếu vàng crypto 2026" "VN-Index tin tức xu hướng mới nhất"


### Nguồn data bổ sung
- Script/VPS API đã cung cấp giá realtime cho từng holding — dùng làm nền tảng
- WebSearch cho tin tức, sentiment, sector outlook, và bối cảnh

### Checklist đánh giá

1. **Concentration risk**: Mã nào chiếm > 20%? Ngành nào chiếm > 40%? Concentration cao = rủi ro hệ thống cao khi ngành đó gặp vấn đề.

2. **Correlation analysis**: Các mã trong danh mục có tương quan cao không? Ví dụ: VCB + BID + CTG = 3 mã ngân hàng, correlation > 0.8 → thực tế chỉ như 1 position. Danh mục "đa dạng" trên giấy nhưng concentrated thực tế.

3. **Sector exposure**: Map holdings theo sector, tính % exposure. Cảnh báo nếu > 40% trong 1 sector — vì chu kỳ kinh tế ảnh hưởng từng sector khác nhau.

4. **Cap-size distribution**: Bao nhiêu % blue-chip vs mid-cap vs small-cap? Danh mục toàn blue-chip thường underperform trong bull market (vì mid/small cap có beta cao hơn). Gợi ý thêm mid/small cap nếu thiếu.

5. **Safety buffer**: Có cash/trái phiếu/vàng không? Danh mục 100% equities sẽ rất đau khi thị trường correction 20%+. Tính tỷ lệ trái phiếu phù hợp theo tuổi và risk profile. Trái phiếu (đặc biệt TPCP) có correlation âm với cổ phiếu — giảm volatility danh mục hiệu quả. Options/Covered Warrants có thể dùng như hedging tool: Protective Put bảo vệ danh mục trước sự kiện rủi ro, Covered Call tạo thu nhập thêm trong thị trường sideway (xem `references/options_greeks.md`).

6. **Risk match**: Phù hợp mục tiêu/tuổi/horizon không? Người 55 tuổi không nên 80% crypto.

Tham khảo `references/risk_management.md` cho benchmarks và best practices.

## Bước 3: Dự báo Portfolio — 3 kịch bản

Portfolio forecast quan trọng vì giúp investor hình dung best case và worst case bằng số tiền thực tế, không phải % trừu tượng.

| Kịch bản | Xác suất | Portfolio Return | Giá trị cuối | Trigger |
|-----------|----------|-----------------|--------------|---------|
| Bull | 25-30% | +X% | [số tiền] | [thị trường + holdings đều tốt] |
| Base | 45-55% | +Y% | [số tiền] | [kịch bản trung tâm] |
| Bear | 20-30% | -Z% | [số tiền] | [rủi ro nào hiện thực hóa] |

**Expected Portfolio Return = Sum(probability x return)**. So sánh với lãi suất tiền gửi ngân hàng — nếu expected return  threshold

**Issues & Findings:**
- CRITICAL (đỏ): "Ngành ngân hàng chiếm 65% — rủi ro hệ thống khi NHNN siết credit growth"
- HIGH (cam): "Correlation VCB-BID = 0.85 — đa dạng hóa kém hiệu quả"
- MEDIUM (xanh dương): "Không có mid/small cap — miss sector rotation alpha"
- OK (xanh lá): "Cash buffer 10% — đủ để buying-the-dip"

**3 Kịch bản Portfolio Forecast:**
- Visual: 3 cards (Bull xanh, Base xanh dương, Bear đỏ)
- Mỗi card: xác suất, return %, giá trị tuyệt đối, trigger
- Expected Return hiển thị bold

**Rebalance Suggestions:**
- Bảng: Tài sản | Hiện tại → Đề xuất | Hành động | Số tiền
- Color-coded: MUA THEM (xanh), BAN BOT (đỏ), GIU NGUYEN (xám)
- Gợi ý mid/small cap cụ thể nếu danh mục thiếu
- Timeline: "Thực hiện trong 2-4 tuần, không rebalance tất cả cùng lúc"
- Lưu ý thuế bán 0.1% khi tính cost of rebalancing

**Expandable sections:**
- Correlation Matrix (bảng hoặc heatmap)
- Risk Analysis chi tiết (VaR, stress test)
- Model Portfolios tham khảo (Conservative/Balanced/Growth)
- FIRE Calculator (nếu user hỏi nghỉ hưu sớm)

**Disclaimer đầy đủ**

### Correlation Reference (khi không có data thực)
| | VN-Index | S&P 500 | BTC | Vàng | USD |
|---|---|---|---|---|---|
| VN-Index | 1.0 | 0.4 | 0.3 | 0.1 | -0.3 |
| S&P 500 | 0.4 | 1.0 | 0.6 | 0.0 | -0.2 |
| BTC | 0.3 | 0.6 | 1.0 | 0.1 | -0.3 |
| Vàng | 0.1 | 0.0 | 0.1 | 1.0 | -0.7 |

### FIRE Calculator (nếu được hỏi)
- Rule of 25: Chi tiêu hàng năm x 25 = target number
- Monthly savings needed với return rates (conservative 6%, moderate 10%, aggressive 15%)
- Timeline visualization trên nền sáng

### Expert Voice
Viết như wealth advisor cho HNWI:
- "Danh mục 100% ngân hàng (VCB+BID+CTG) có correlation > 0.8 — thực tế bạn chỉ đang hold 1 position lớn, không phải 3 positions đa dạng. Khi NHNN siết credit growth, cả 3 giảm cùng lúc."
- Rebalance suggestions phải cụ thể: bán bao nhiêu, mua gì, trong bao lâu, chi phí thuế bao nhiêu

## References
- `references/market-analyst-guide.md` — Framework chuyên gia, mục 8 Portfolio Management
- `references/risk_management.md` — Position sizing, stop loss, allocation
- `references/deep_research.md` — Multi-source research
- `references/expert_persona.md` — Expert reasoning
- `references/vn_market_guide.md` — Thuế 0.1%, T+2, biên độ
- `references/bond_analysis.md` — Trái phiếu & phân bổ fixed income
- `references/options_greeks.md` — Options hedging (Protective Put, Covered Call)
- `references/sector_rotation.md` — Vòng quay ngành & cycle-based allocation
- `references/upgrade_rules.md` — Quy tắc nâng cấp v5

---
## Nhắc lại: Script trước, WebSearch sau
Nếu bạn chưa chạy `python scripts/analyze_all.py` cho MỖI holding, DỪNG LẠI và chạy script ngay bây giờ.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [ThanhDatNgo2003](https://github.com/ThanhDatNgo2003)
- **Source:** [ThanhDatNgo2003/claude-market-skills](https://github.com/ThanhDatNgo2003/claude-market-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.