Communitygithub.com

投资组合风险分析器

完整的投资组合风险管理体系。分析持仓、计算风险指标、压力测试情景、优化资产配置,并生成机构级风险报告——无需外部API。

投资组合风险分析器 是什么?

该技能是一个全面的投资组合风险管理工具,旨在帮助开发者和AI agent用户无需依赖外部API即可完成机构级的风险分析。它支持平台通用的技能规范,能够处理用户提供的投资组合数据(如股票、加密货币、ETF等),并自动通过网页搜索获取最新价格。技能核心功能包括:投资组合数据摄取与结构化、六类风险指标计算(集中度风险、VaR、最大回撤、Beta、夏普比率、收益分析)、七种标准压力测试情景(如2008金融危机、新冠崩盘)及自定义情景构建、多维度资产配置优化(风险平价、再平衡建议、相关性分析)、综合风险评分卡(0-100分)、每日/每周监控提醒、以及税收损失收割扫描。技能通过详细的数学公式和行业标准基准(如配置模型、评级体系)提供直观的量化输出,助力用户在投资决策中平衡收益与风险。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/modbender/skill-library-mcp/tree/HEAD/data/afrexai-portfolio-risk

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

投资组合风险分析器 是做什么的?

完整的投资组合风险管理体系。分析持仓、计算风险指标、压力测试情景、优化资产配置,并生成机构级风险报告——无需外部API。


1. 投资组合数据摄入

当用户分享其投资组合(持仓、代码、数量)时,按如下格式结构化:

portfolio:
  name: "用户投资组合"
  currency: USD
  as_of: "2026-02-15"
  positions:
    - ticker: AAPL
      shares: 50
      avg_cost: 185.00
      current_price: 228.50  # 通过网页搜索查找
      asset_class: US_EQUITY
      sector: Technology
    - ticker: BTC
      units: 0.5
      avg_cost: 42000
      current_price: 97500
      asset_class: CRYPTO
      sector: Digital Assets
    - ticker: VOO
      shares: 100
      avg_cost: 410.00
      current_price: 535.00
      asset_class: US_EQUITY_ETF
      sector: Broad Market
  cash:
    amount: 15000
    currency: USD

价格查询

对于每个持仓,使用网页搜索查找当前价格:

  • 搜索:[TICKER] stock price today
  • 对于加密货币:[COIN] price USD today
  • 记录来源和时间戳

投资组合汇总表

持仓数量成本基础当前价值权重盈亏盈亏 %
AAPL50$9,250$11,42518.2%+$2,175+23.5%
.....................
总计$XX,XXX$XX,XXX100%±$X,XXX±X.X%

2. 风险指标计算器

对每一项投资组合分析,计算以下所有指标:

2.1 集中度风险

持仓集中度:
- 任何单一持仓 >投资组合的20% = 高风险 ⚠️
- 任何单一持仓 >10% = 中等风险
- 前三大持仓 >50% = 高度集中

板块集中度:
- 任何板块 >30% = 超配
- 计算独特板块数量 — 少于4个 = 分散不足

资产类别细分:
- 股票:X%
- 固定收益:X%
- 加密货币:X%
- 现金:X%
- 另类投资:X%

2.2 风险价值 (VaR) — 参数法

计算给定置信水平下的最大预期损失:

日 VaR 计算:
1. 查找每个持仓的历史波动率(年化)
   - 使用网页搜索:"[TICKER] historical volatility 30 day"
   - 典型范围:大盘股15-25%,加密货币50-80%,债券5-10%

2. 转换为日波动率:
   日波动率 = 年波动率 / √252

3. 持仓 VaR(95%置信水平):
   持仓 VaR = 持仓价值 × 日波动率 × 1.645

4. 持仓 VaR(99%置信水平):
   持仓 VaR = 持仓价值 × 日波动率 × 2.326

5. 投资组合 VaR(简化版 — 假设股票相关性≈ 0.5):
   投资组合 VaR ≈ √(Σ(持仓 VaR²) + 2×0.5×Σ(VaR_i × VaR_j))

报告:
- 1天 95% VaR:$X,XXX(投资组合的X.X%)
- 1天 99% VaR:$X,XXX(投资组合的X.X%)
- 10天 95% VaR:$X,XXX(= 1天 VaR × √10)
- 月度 95% VaR:$X,XXX(= 1天 VaR × √21)

2.3 最大回撤估算

基于资产类别历史最大回撤:
- 美国大盘股:-50%(2008-09),典型调整 -20%
- 美国小盘股:-55%,典型调整 -25%
- 国际股票:-55%,典型 -25%
- 新兴市场:-65%,典型 -30%
- 投资级债券:-15%,典型 -5%
- 高收益债券:-30%,典型 -10%
- REITs:-70%,典型 -25%
- 加密货币(BTC):-85%,典型 -50%
- 黄金:-45%,典型 -15%
- 现金:0%

投资组合最大回撤估算:
= Σ(持仓权重 × 资产类别最大回撤)

报告:
- 估计最差回撤:-$XX,XXX(XX.X%)
- 估计典型调整:-$XX,XXX(XX.X%)
- 恢复时间估计:X-X个月(基于历史平均值)

2.4 Beta与市场敏感性

对于每个股票持仓:
- 通过网页搜索查找 Beta:"[TICKER] beta"
- 投资组合 Beta = Σ(持仓权重 × 持仓 Beta)

解读:
- Beta > 1.2:投资组合为激进型(放大市场波动)
- Beta 0.8-1.2:投资组合为中性
- Beta < 0.8:投资组合为防御型
- 负 Beta 持仓:对冲价值

市场影响:
- 如果标普500下跌10%,投资组合预期变动:Beta × -10%

2.5 夏普比率估算

投资组合预期回报率 = Σ(权重 × 预期回报率)
其中按资产类别的预期回报率:
- 美国大盘股:年化8-10%
- 美国小盘股:9-11%
- 国际发达市场:6-8%
- 新兴市场:8-12%
- 投资级债券:4-5%
- 高收益债券:6-7%
- 加密货币:高度可变(保守估计使用0%)
- REITs:7-9%
- 现金:当前货币市场利率(约4.5%)

无风险利率:当前3个月国债利率(如有需要可搜索)

夏普比率 = (投资组合预期回报率 - 无风险利率) / 投资组合波动率

评级:
- > 1.0:风险调整后回报极佳
- 0.5-1.0:良好
- 0-0.5:平庸 — 考虑再平衡
- < 0:较差 — 回报不足以证明风险合理

2.6 收益分析

对于派息持仓:
- 查找股息率:"[TICKER] dividend yield"
- 年度收入 = 股数 × 每股年股息
- 投资组合收益率 = 总年度股息 / 投资组合价值

报告:
- 月度估计收入:$XXX
- 年度估计收入:$X,XXX
- 成本收益率:X.X%
- 当前收益率:X.X%

3. 压力测试

针对投资组合运行以下情景并报告影响:

3.1 标准情景

scenarios:
  market_crash_2008:
    name: "2008年金融危机"
    impacts:
      US_EQUITY: -0.50
      INTL_EQUITY: -0.55
      EMERGING: -0.60
      BONDS: +0.05
      HIGH_YIELD: -0.30
      REITS: -0.70
      CRYPTO: -0.80  # 基于风险状况预测
      GOLD: +0.10
      CASH: 0

  covid_crash_2020:
    name: "新冠疫情崩盘(2020年2月-3月)"
    impacts:
      US_EQUITY: -0.34
      INTL_EQUITY: -0.35
      EMERGING: -0.35
      BONDS: +0.03
      HIGH_YIELD: -0.20
      REITS: -0.40
      CRYPTO: -0.50
      GOLD: -0.05
      CASH: 0

  dot_com_2000:
    name: "互联网泡沫破灭(2000-2002)"
    impacts:
      US_EQUITY: -0.45
      TECH: -0.75  # 专门适用于科技板块
      INTL_EQUITY: -0.40
      BONDS: +0.15
      CASH: 0

  rate_hike_shock:
    name: "快速加息(+300个基点)"
    impacts:
      US_EQUITY: -0.15
      BONDS: -0.15
      HIGH_YIELD: -0.10
      REITS: -0.25
      CRYPTO: -0.20
      GOLD: -0.10
      CASH: +0.01  # 收益率更高

  inflation_surge:
    name: "滞胀(持续8%以上通胀)"
    impacts:
      US_EQUITY: -0.20
      BONDS: -0.20
      CRYPTO: -0.10  # 有争议的对冲工具
      GOLD: +0.15
      REITS: -0.05
      COMMODITIES: +0.20
      CASH: -0.03  # 实际价值侵蚀

  crypto_winter:
    name: "加密货币寒冬(80%回撤)"
    impacts:
      CRYPTO: -0.80
      US_EQUITY: -0.05  # 轻微传染效应

3.2 压力测试报告格式

对于每个情景:

📉 情景:[名称]

| 持仓 | 当前价值 | 压力价值 | 损失 |
|----------|--------------|----------------|------|
| AAPL     | $11,425      | $5,713         | -$5,712 |
| ...      | ...          | ...            | ...  |
| 总计    | $XX,XXX      | $XX,XXX        | -$XX,XXX (-XX.X%) |

你能承受这个情景吗?[是/否,基于现金储备和收入需求]
恢复时间估计:X-X个月

3.3 自定义情景构建器

如果用户描述了特定的担忧,构建一个自定义情景:

用户:“如果科技股暴跌40%但债券反弹,会怎样?”
→ 构建自定义影响映射,应用于投资组合,报告结果

4. 投资组合优化

4.1 当前配置评估

将当前配置与标准模型进行比较:

激进型(年龄 <35,高风险承受能力):
  股票:80-90%,债券:5-10%,另类投资:5-10%,现金:2-5%

成长型(年龄 35-50):
  股票:60-75%,债券:15-25%,另类投资:5-10%,现金:5%

均衡型(年龄 50-60):
  股票:40-60%,债券:30-40%,另类投资:5-10%,现金:5-10%

保守型(年龄 60+,注重收入):
  股票:20-40%,债券:40-50%,另类投资:5%,现金:10-20%

当前配置匹配:[模型] 类型
推荐调整:[具体操作]

4.2 风险平价分析

风险平价目标:每个资产类别对投资组合的风险贡献相等

步骤:
1. 计算每个持仓的风险贡献:
   风险贡献 = 权重 × 波动率 × 与投资组合的相关性

2. 为了实现相等风险贡献:
   目标权重_i = (1/波动率_i) / Σ(1/波动率_j)

3. 报告:
   当前权重与风险平价权重的对比
   重新平衡所需的交易
   对夏普比率的预期影响

4.3 再平衡建议

检查再平衡触发条件:
- 任何持仓偏离目标超过5%?→ 需要再平衡
- 任何资产类别偏离目标超过10%?→ 需要再平衡
- 上次再平衡超过6个月?→ 需要审核

再平衡方法:
1. 计算目标权重
2. 计算当前权重
3. 确定所需交易(最小化交易次数)
4. 税务批次优化:优先卖出成本最高的批次(最小化税收)
5. 如果收割亏损,考虑洗售规则

输出交易清单:
| 操作 | 代码 | 数量 | 估计价值 | 原因 |
|--------|--------|--------|-----------|--------|
| 卖出   | AAPL   | 15     | $3,428    | 超配科技股 |
| 买入    | BND    | 25     | $1,850    | 低配债券 |

4.4 相关性分析

评估分散化质量:

高相关性对(>0.7)—— 这些无法相互分散:
- 科技股之间
- 美国股票ETF之间
- 高收益债券与股票

低相关性对(<0.3)—— 真正的分散工具:
- 股票与国债
- 美国股票与黄金
- 股票与管理期货

负相关性 —— 对冲工具:
- 做多股票 + 看跌期权
- 股票 + VIX产品
- 某些时期的成长股与价值股

为投资组合分散化评级:A/B/C/D/F

5. 风险评分卡(0-100)

生成单一风险评分:

risk_scorecard:
  concentration_risk:
    weight: 20
    score: X  # 100 = 充分分散,0 = 单一股票
    details: "最大持仓占比X%,涉及X个板块"

  volatility_risk:
    weight: 20
    score: X  # 100 = 低波动,0 = 极高波动
    details: "投资组合年化波动率:X%"

  drawdown_risk:
    weight: 20
    score: X  # 100 = 最小回撤风险,0 = 可能损失50%以上
    details: "最大估计回撤:X%"

  liquidity_risk:
    weight: 15
    score: X  # 100 = 全部高流动性,0 = 非流动性持仓
    details: "X%在流动性好的大盘股,X%在低流动性资产"

  income_resilience:
    weight: 10
    score: X  # 100 = 强劲收入,0 = 无收益
    details: "投资组合收益率:X%,X%来自可靠派息公司"

  market_sensitivity:
    weight: 15
    score: X  # 100 = 低Beta/防御型,0 = 高度激进
    details: "投资组合 Beta:X.XX"

  overall_score: X/100
  rating: "[保守型|中等型|激进型|投机型]"
  recommendation: "[关键行动项]"

评分解读

  • 80-100:堡垒型 — 保护良好,但可能过于保守不利于增长
  • 60-79:稳健型 — 风险管理良好,可能有小的改进空间
  • 40-59:中等型 — 合理但存在明显的风险敞口
  • 20-39:风险升高型 — 显著弱点,建议再平衡
  • 0-19:危险区 — 极度集中或波动,需要紧急行动

6. 监控与提醒

每日检查模板(用于定时任务/心跳监测)

对于每个投资组合持仓:
1. 检查价格相比前一日收盘的变化(网页搜索)
2. 标记任何一日波动超过3%的持仓
3. 标记任何触及止损水平的持仓
4. 检查未来7天内的盈利/事件

提醒阈值:
- 单一持仓一日下跌5% → 提醒
- 投资组合一日下跌3% → 提醒
- 持仓触及52周低点 → 关注
- VIX > 25 → 提高警惕
- VIX > 35 → 高度警报 — 检查对冲

每周回顾模板

## 投资组合周报 — [日期]

### 表现
- 投资组合价值:$XX,XXX(周度变化 ±X.X%)
- 最佳表现者:[代码] +X.X%
- 最差表现者:[代码] -X.X%
- 对比标普500:[跑赢/跑输] X.X%

### 风险变化
- VaR 变化:$X,XXX → $X,XXX
- 出现新的集中度问题?[是/否]
- 是否需要进行再平衡?[是/否]

### 即将发生事件
- 盈利发布:[代码和日期]
- 除息日:[代码和日期]
- 联储/宏观事件:[列表]

### 行动项
1. [具体建议]
2. [具体建议]

7. 税收损失收割扫描仪

对于每个存在未实现亏损的持仓:
1. 计算未实现亏损:(当前价格 - 平均成本)× 股数
2. 检查亏损是否 >$500(值得收割)
3. 识别节税替代品:
   - 同板块 ETF(避免洗售规则)
   - 相似因子风险敞口
   - 持有替代品31天以上后再切换回原品

报告:
| 代码 | 未实现亏损 | 替代品 | 洗售规则清算日期 |
|--------|----------------|-------------|---------------------|
| XYZ    | -$2,500        | 相似 ETF    | [日期 + 31天]       |

估计节税金额:$X,XXX(按X%边际税率)

8. 特殊资产类别

加密货币投资组合风险

额外的加密货币特定指标:

  • 比特币主导地位相关性
  • 交易所风险(中心化与自托管)
  • DeFi 持仓的协议风险
  • 稳定币敞口与脱钩风险
  • 质押/收益的税收影响

房地产(REITs/物业)

  • FFO 收益率与股息收益率对比
  • 利率敏感度
  • 地理集中度
  • 物业类型分散化(住宅/商业/工业)

期权持仓

如果投资组合包含期权:

  • Delta 敞口(等效股票头寸)
  • Theta 衰减(每日时间价值损失)
  • 隐含波动率与历史波动率对比
  • 最大损失计算

9. 最终输出与生成方法

报告生成顺序

  1. 首先展示“投资组合摘要表”
  2. 然后逐项展示“风险指标计算器”的每个部分
  3. 接着运行并显示“压力测试”结果
  4. 提供“投资组合优化”建议
  5. 最后展示“风险评分卡”
  6. 可选:生成“每日检查”提醒或“税收损失收割”机会

数据源优先级

始终优先使用最新数据:

  1. 用户提供的数值(成本基础、数量)
  2. 网页搜索结果(当前价格、股息率、Beta、波动率)
  3. 行业标准假设(预期回报率、最大回撤)

免责声明

每次分析的底部始终包含:

⚠️ 免责声明:此分析仅用于教育目的,不构成财务建议。请咨询持牌财务顾问以做出投资决策。所有风险指标均基于历史数据和假设,不能保证未来结果。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

modbender/skill-library-mcp

Paid acquisition strategy, budget allocation, and avoiding common advertising mistakes across platforms

modbender/skill-library-mcp

Borrow from Aave via credit delegation. Agent self-funds by borrowing against delegator collateral. Supports borrow, repay, health checks. Works on Aave V2/V3.

modbender/skill-library-mcp

Discover and register autonomous AI agents. Use when: browsing the agent registry, submitting an agent for verification, or embedding agent badges. NOT for: general web search or agent capability analysis.

modbender/skill-library-mcp

Create AI avatar and talking head videos with OmniHuman, Fabric, PixVerse via inference.sh CLI. Models: OmniHuman 1.5, OmniHuman 1.0, Fabric 1.0, PixVerse Lipsync. Capabilities: audio-driven avatars, lipsync videos, talking head generation, virtual presenters. Use for: AI presenters, explainer videos, virtual influencers, dubbing, marketing videos. Triggers: ai avatar, talking head, lipsync, avatar video, virtual presenter, ai spokesperson, audio driven video, heygen alternative, synthesia alternative, talking avatar, lip sync, video avatar, ai presenter, digital human

modbender/skill-library-mcp

AI代码编辑器规则模板集合 - 为Cursor、Windsurf、Claude Code、Cline等AI编辑器提供项目规则配置。适用于需要配置AI编码助手规则的开发者,包含全栈Web、移动端、Vue3+SpringBoot等技术栈模板。

modbender/skill-library-mcp

Generate landing page code from product descriptions

modbender/skill-library-mcp

Create AI marketing videos for ads, promos, product launches, and brand content. Models: Veo, Seedance, Wan, FLUX for visuals, Kokoro for voiceover. Types: product demos, testimonials, explainers, social ads, brand videos. Use for: Facebook ads, YouTube ads, product launches, brand awareness. Triggers: marketing video, ad video, promo video, commercial, brand video, product video, explainer video, ad creative, video ad, facebook ad video, youtube ad, instagram ad, tiktok ad, promotional video, launch video

modbender/skill-library-mcp

Generate AI music videos end-to-end. Creates music with Suno (sunoapi.org), generates visuals with OpenAI/Seedream/Google/Seedance, and assembles into music video with ffmpeg. Supports timestamped lyrics (auto SRT), Suno native music video generation, slideshow/video/hybrid modes. Token-based cost tracking per generation.

modbender/skill-library-mcp

Generate AI-powered notes from videos (document, outline, or graphic-text formats)

modbender/skill-library-mcp

The video AI notes tool is provided by Baidu. Based on the video download address provided by the user, it downloads and parses the video, and finally generates AI notes corresponding to the video (a total of three types of notes can be generated: document notes, outline notes, and image-text notes).

modbender/skill-library-mcp

Automated appointment management for beauty salons, clinics, studios, and photo booths. Handles booking requests, calendar sync, conflict detection, reminders, no-show tracking, and waitlist management.

modbender/skill-library-mcp

Bird identification, life list tracking, and trading card generation. Use this skill when the user: sends a bird photo to identify, says "set up my Birdfolio" or "set my region", asks "how's my checklist", asks "Birdfolio progress", asks "how many birds have I found", asks "show my Birdfolio" or "show my life list", asks "what's my rarest bird", or asks "tell me about [bird species]". Handles everything from first-time setup through ongoing life list tracking and visual trading card generation.

modbender/skill-library-mcp

Multi-project task and research management (JSON-first CLI)

modbender/skill-library-mcp

Track stock and crypto portfolios with CLI - real-time prices, P&L, dividend tracking, multiple portfolios

modbender/skill-library-mcp

Track cryptocurrency portfolios with real-time prices, P&L calculations, and allocation analysis. Query Bitcoin, Ethereum, Solana and 10,000+ token holdings.

modbender/skill-library-mcp

加密貨幣Portfolio追蹤 - 支援TRON/ETH/BSC,分析持倉、收益、Gas費用

modbender/skill-library-mcp

Lead strategy with competitive analysis, strategic planning, growth roadmaps, and business portfolio management.

modbender/skill-library-mcp

Create ATS-optimized resumes and CVs with proper structure, metrics, and industry targeting.

modbender/skill-library-mcp

Use this skill when the user asks to build, create, design, develop, or improve ANY frontend interface, web page, UI component, or visual element. This includes: - Building landing pages, websites, web apps, dashboards, portfolios, or any web interface - Creating UI components (buttons, forms, cards, navbars, modals, etc.) - Designing pages with React, Vue, Next.js, Svelte, or any frontend framework - Adding styling or improving visual design of existing components - Implementing specific design aesthetics (modern, dark, minimalist, brutalist, etc.) - User mentions "frontend", "UI", "UX", "design", "interface", "web design", or "styling" - User asks for "beautiful", "modern", "professional", "clean", or any aesthetic adjective - User requests help with CSS, Tailwind, styled-components, or any styling approach This skill automatically retrieves the appropriate design system prompt (Neo-brutalism, Modern Dark, Bauhaus, Cyberpunk, Material, etc.) to help create visually distinctive, production-grade frontend...

modbender/skill-library-mcp

Native video analysis using Google Gemini API. Upload and analyze video files — describe scenes, extract text/UI, answer questions about content, transcribe speech, identify objects and actions. Use when: (1) User sends a video file and wants it analyzed, (2) Video summarization or description needed, (3) Extracting text, UI elements, or information from screen recordings, (4) Answering questions about video content, (5) Comparing multiple videos, (6) Analyzing tutorials, demos, or walkthroughs.

相关技能