Communitygithub.com

投资组合风险分解建模

通过因子归因、特质风险和边际风险贡献分析,分解投资组合风险。适用于风险分解、风险源归因或因子风险贡献分析场景。

投资组合风险分解建模 是什么?

该技能提供了一套完整的投资组合风险分解建模工作流,帮助开发者或量化分析师将总组合方差分解为系统性(因子)和特质性(证券特定)成分。它支持从持仓数据、因子暴露矩阵和协方差矩阵出发,计算总波动率、因子级风险归因、边际风险贡献(MCTR)和成分风险贡献(CCTR),并可结合基准进行主动风险分解。技能涵盖了Barra/Axioma等第三方因子模型的验证、压力测试与敏感性分析、以及质量检查(如Euler恒等式验证)。输出包括风险汇总表、因子归因表、MCTR/CCTR表、主动风险面板及压力情景结果,适用于投资委员会报告、风险监控或再平衡后漂移检测。该技能兼容桌面端和云端环境(如Jupyter Notebook、Python脚本),主要依赖NumPy、Pandas和Scipy等库进行矩阵运算。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Mr-Nobody-Anonymous/All-skills/tree/HEAD/awesome_skills/legal/modeling-portfolio-risk-decomposition

在你喜欢的 AI 中提问

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

文档

投资组合风险分解建模 是做什么的?

何时使用

  • 将总组合方差分解为系统性(因子)和特质性(证券特定)成分
  • 将风险归因于单个因子(市场、规模、价值、动量、板块、利率、信用利差等)
  • 计算边际风险贡献(MCTR)和成分风险贡献(CCTR),用于头寸级决策
  • 评估组合风险预算是否与预设的因子倾斜一致
  • 为投资委员会、风险监督或投资者沟通准备风险报告
  • 在再平衡或新增配置后进行因子暴露漂移压力测试

需收集的输入

  • 头寸级持仓:每只证券或资产在组合中的权重(w_i)
  • 因子暴露矩阵(B):每只证券在各因子上的载荷(来自回归、基本面模型或Barra/Axioma/Northfield等供应商)
  • 因子协方差矩阵(F):选定估计窗口内系统因子之间的协方差
  • 特质方差矩阵(D):证券特定残差方差的对角矩阵
  • 收益率序列(如需自行估计):持仓与候选因子代理的日度或月度总收益率
  • 基准(可选):用于主动风险分解的基准权重
  • 回溯窗口与频率:例如252个交易日(日度)或60个月(月度)——需确认与因子模型版本一致[核实]

工作流程

  1. 构建协方差结构

    • 组合总协方差:V = B F Bᵀ + D
    • 确保维度匹配(n只证券 × k个因子)
    • 若使用供应商模型,需核实因子协方差版本日期与持仓日期匹配[核实]
  2. 计算总组合方差

    • σ²_p = wᵀ V w
    • 以年化波动率报告:σ_p = √(σ²_p × 年化因子)
    • 常见年化:日度数据×252,月度数据×12
  3. 分解为系统性和特质性

    • 系统性方差:σ²_sys = wᵀ (B F Bᵀ) w
    • 特质性方差:σ²_idio = wᵀ D w
    • 报告比率σ²_sys / σ²_p —— 多元化良好的股票组合通常为85–95%;显著更低的值表明存在集中的特质性押注
  4. 因子级风险归因

    • 组合因子暴露:β_p = Bᵀ w(k × 1向量)
    • 因子j对方差的贡献:β_p,j × Σ_k (F_jk × β_p,k)
    • 所有因子贡献之和应等于σ²_sys(用作核对检查)
    • 按贡献绝对值对因子排序,识别主导风险驱动因素
  5. 边际风险贡献(MCTR)

    • MCTR_i = (V w)_i / σ_p —— 衡量权重_i小幅增加时组合波动率的变化
    • 成分风险贡献:CCTR_i = w_i × MCTR_i
    • 验证:Σ CCTR_i = σ_p(Euler分解恒等式)
  6. 主动风险分解(若提供基准)

    • 主动权重:w_a = w_组合 − w_基准
    • 跟踪误差:TE = √(w_aᵀ V w_a × 年化因子)
    • 使用相同的B F Bᵀ + D分解,将TE拆分为因子主动部分和股票特定主动部分
    • 报告主动因子押注及其对跟踪误差的贡献
  7. 敏感性与压力分析

    • 对单个因子收益施加冲击(如+/−1σ、+/−2σ),重新计算组合损益影响
    • 测试协方差制度切换:用危机时期的F(如2008年、2020年3月)替换并重新计算σ_p
    • 评估集中度:标记任何单一因子贡献超过总方差40%的情况,或任何单一名称贡献超过CCTR 10%的情况

输出

  • 风险汇总表:总波动率、系统性与特质性分解(绝对值和百分比)
  • 因子归因表:各因子的暴露、方差贡献和占总风险百分比——按大小排序
  • MCTR / CCTR表:每笔持仓的边际和成分贡献,突出前十大风险贡献者
  • 主动风险面板(如适用):跟踪误差、因子主动与股票特定主动分解
  • 压力情景结果:在指定因子冲击和制度协方差矩阵下的组合影响
  • 核对检查:确认方差分解之和等于总和;标记偏差超过0.1%的情况

质量检查

  • 因子贡献之和在舍入容差内等于系统性方差
  • CCTR值之和等于总组合波动率(Euler恒等式成立)
  • 无负的特质性方差(表明数据或模型错误)
  • 回溯窗口在因子模型、协方差估计和持仓快照之间保持一致[核实]
  • 因子模型覆盖至少90%的组合NAV(按权重计);标记未覆盖的头寸及其假设处理方式(基准代理、同行映射或剔除)
  • 交叉验证波动率估计值与实际滚动波动率的偏差——偏差超过30%需要调查
  • 若使用第三方风险模型,确认模型版本和发布日期与目标分析期匹配[核实]

Individual skills in this repo

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

Mr-Nobody-Anonymous/All-skills

Build agency portfolios. TRIGGERS - Use when user needs help with agency-portfolio-builder related tasks.

Mr-Nobody-Anonymous/All-skills

Generate landing pages with AI. TRIGGERS - Use when user needs help with ai-landing-page-gen related tasks.

Mr-Nobody-Anonymous/All-skills

Skill for discovering and researching autonomous AI agents, tools, and ecosystems using the AgentFolio directory.

Mr-Nobody-Anonymous/All-skills

Review investment portfolios with rebalancing recommendations. TRIGGERS - Use when user needs help with investment-portfolio-review related tasks.

Mr-Nobody-Anonymous/All-skills

Create makeup artist portfolio guides. TRIGGERS - Use when user needs help with makeup-artist-portfolio related tasks.

Mr-Nobody-Anonymous/All-skills

Build freelance portfolios with case studies. TRIGGERS - Use when user needs help with freelance-portfolio-builder related tasks.

Mr-Nobody-Anonymous/All-skills

Structures secondary portfolio construction with vintage diversification, strategy mix, and geographic allocation optimization. Use when building secondary portfolios, managing allocation targets, or optimizing portfolio composition.

Mr-Nobody-Anonymous/All-skills

Optimize landing page copy for conversions. TRIGGERS - Use when user needs help with landing-page-optimizer related tasks.

Mr-Nobody-Anonymous/All-skills

Build copywriting portfolios. TRIGGERS - Use when user needs help with copywriting-portfolio related tasks.

Mr-Nobody-Anonymous/All-skills

Design cryptocurrency portfolio strategies. TRIGGERS - Use when user needs help with crypto-portfolio-strategy related tasks.

Mr-Nobody-Anonymous/All-skills

Build UX design portfolios. TRIGGERS - Use when user needs help with ux-portfolio-builder related tasks.

Mr-Nobody-Anonymous/All-skills

Design cloud landing zones. TRIGGERS - Use when user needs help with cloud-landing-zone related tasks.

Mr-Nobody-Anonymous/All-skills

Generate high-converting landing page copy with headlines, benefits, CTAs, and social proof. TRIGGERS - Use when user wants landing page copy, sales page content, or conversion-focused web copy.

Mr-Nobody-Anonymous/All-skills

Design portfolio assessment systems. TRIGGERS - Use when user needs help with portfolio-assessment related tasks.

Mr-Nobody-Anonymous/All-skills

Conducts portfolio performance measurement with benchmark comparison, attribution, and risk-adjusted metrics. Use when measuring portfolio performance, calculating Sharpe/Sortino ratios, or conducting performance attribution.

Mr-Nobody-Anonymous/All-skills

Builds strategic and tactical asset allocation models with risk-return optimization and constraint management. Use when constructing portfolios, optimizing asset allocation, or building model portfolios.

Mr-Nobody-Anonymous/All-skills

Creates client-facing portfolio reports with performance, allocation, commentary, and outlook. Use when producing client reports, preparing quarterly reviews, or creating portfolio summaries.

Mr-Nobody-Anonymous/All-skills

Design investment portfolios. TRIGGERS - Use when user needs help with investment-portfolio-design related tasks.

Mr-Nobody-Anonymous/All-skills

Plan investment portfolios. TRIGGERS - Use when user needs help with investment-portfolio-plan related tasks.

Mr-Nobody-Anonymous/All-skills

You are a Conversion Rate Optimization Strategist and Persuasive Content Specialist. Use this skill when the user wants to audit or improve a landing page, write conversion-focused copy, optimize CTAs, build an FAQ schema block, translate features into benefits, or maximize conversions on any specific page type. Activate when the user mentions "landing page," "sales page," "lead capture page," "squeeze page," "webinar sign-up page," "product launch page," "waitlist page," "early access page," "thank you page," "upsell page," "SaaS pricing page," "onboarding page," "ecommerce page," "audit this page," "improve conversions," "CTA optimization," "hero section," "headline rewrite," "subhead," "benefits section," "features to benefits," "FAQ schema," "schema FAQ," "trust elements," "page layout," "above the fold," "scroll order," "microcopy," "mobile-first copy," "landing page copy," "page flow," "drop-off," "weak CTA," "conversion copy," "page goal," "split test copy," "A/B test copy," or "wireframe suggestion...

相关技能