Communitygithub.com

投资组合分析器 - 分配漂移与再平衡

计算当前资产配置百分比,识别与目标配置的漂移,分析保证金使用效率。

投资组合分析器 - 分配漂移与再平衡 是什么?

这是一个针对永久投资组合(Harry Browne的25/25/25/25模型)的专业分析技能,属于`portfolio_balancer`工作流的第二步。其核心功能是读取前一步生成的`portfolio_snapshot.yml`文件,计算每类资产(股票、长期债券、黄金、现金/国债)的当前占比,并与目标百分比(25%)进行对比,确定超配或低配的漂移幅度。如果任何资产的漂移绝对值超过用户设定的阈值(如5%),系统将建议触发再平衡。此外,该技能还支持卫星投资策略跟踪(股票部分中核心与卫星配置的比例检查)以及保证金使用效率分析(计算年化成本与实际费用对比)。最终输出一个结构化的`allocation_analysis.yml`文件,包含详细的分配数据、保证金分析、以及基于“四个季节”经济周期的上下文解读,帮助用户理解组合在特定经济环境下的风险暴露。该步骤完全只读,不会执行任何交易。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/majiayu000/claude-skill-registry/tree/HEAD/skills/analysis/portfolio-balancer-analyze-allocation-ncrmro-deepwork-permanent-

在你喜欢的 AI 中提问

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

文档

portfolio_balancer.analyze_allocation

第 2/4 步 在 portfolio_balancer 工作流中

每日永久投资组合分析,包含配置漂移与再平衡建议

前置条件(请先验证)

在继续之前,请确认以下步骤已完成:

  • /portfolio_balancer.collect_portfolio_data

操作指南

目标:计算当前配置百分比,识别与目标配置的漂移,分析保证金使用效率

分析配置

目标

计算当前配置百分比与 25/25/25/25 永久投资组合目标的对比,识别漂移,并分析保证金使用效率。

任务

分析投资组合快照,确定当前配置与 Harry Browne 永久投资组合目标的对比情况。识别哪些资产类别超配或低配,并评估保证金使用的成本效益。

流程

  1. 读取投资组合快照 从 collect_portfolio_data 步骤中加载 portfolio_balancer/data/portfolio_snapshot.yml。

  2. 计算当前配置百分比 对于每个资产类别,计算:

    current_percentage = (asset_class_value / total_portfolio_value) * 100
    
  3. 计算与目标配置的漂移 永久投资组合对每个资产类别的目标配置是 25%:

    drift = current_percentage - 25.0
    
    • 正值漂移 = 超配
    • 负值漂移 = 低配
  4. 判断是否需要再平衡 将每个资产类别的漂移与快照中的 drift_threshold 值进行比较:

    • 如果任何资产类别的 |drift| > drift_threshold,则建议再平衡
    • 记录哪些特定的资产类别超过了阈值
  5. 分析卫星配置(如果启用) 如果启用了卫星跟踪 (satellite_tracking):

    • 计算卫星投资占总股票配置的百分比
    • 与目标值(通常为 10-20%)进行比较
    • 判断是否需要调整卫星配置
  6. 分析保证金使用效率 如果启用了保证金 (margin):

    • 计算年度保证金成本:margin_balance * interest_rate
    • 评估成本/收益:预期回报是否大于保证金成本?
    • 如果保证金费用超过合理阈值则标记
  7. 应用“四个季节”背景分析 指出当前超配/低配头寸在经济周期中分别受哪些经济条件有利:

    • 春季(繁荣):股票受益
    • 夏季(通胀):黄金受益
    • 秋季(货币紧缩):现金受益
    • 冬季(通缩):长期债券受益

输出格式

portfolio_balancer/data/allocation_analysis.yml

一个包含完整分配分析的 YAML 文件。

结构:

analysis_date: "YYYY-MM-DD"
drift_threshold: 5  # 来自快照

total_portfolio_value: 100000.00

# 配置明细
allocations:
  stocks:
    target_percentage: 25.0
    current_percentage: 28.0
    current_value: 28000.00
    drift: 3.0  # 超配 3%
    exceeds_threshold: false
    status: "overweight"
    # 卫星配置明细(如果启用)
    satellite:
      enabled: true
      core_percentage: 89.3  # 核心指数占股票比例
      satellite_percentage: 10.7  # 卫星投资占股票比例
      target_satellite_percentage: 15.0
      satellite_drift: -4.3  # 卫星配置低配

  long_term_bonds:
    target_percentage: 25.0
    current_percentage: 24.0
    current_value: 24000.00
    drift: -1.0  # 低配 1%
    exceeds_threshold: false
    status: "underweight"

  gold:
    target_percentage: 25.0
    current_percentage: 23.0
    current_value: 23000.00
    drift: -2.0
    exceeds_threshold: false
    status: "underweight"

  cash_treasuries:
    target_percentage: 25.0
    current_percentage: 25.0
    current_value: 25000.00
    drift: 0.0
    exceeds_threshold: false
    status: "on_target"

# 整体再平衡评估
rebalancing:
  needed: false
  reason: "没有资产类别超过 5% 的漂移阈值"
  assets_exceeding_threshold: []

# 保证金分析
margin_analysis:
  enabled: true
  current_balance: 5000.00
  annual_cost: 300.00  # 余额 * 利率
  monthly_cost: 25.00
  monthly_fees_paid: 50.00
  efficiency_rating: "poor"  # 支付的费用高于计算成本
  recommendation: "请审查保证金费用 - 实际支付 $50/月,预期成本为 $25/月"

# 四个季节背景分析
economic_context:
  current_overweights:
    - asset: "stocks"
      favored_condition: "繁荣/增长(春季)"
      drift: 3.0
  current_underweights:
    - asset: "gold"
      favored_condition: "通胀(夏季)"
      drift: -2.0
    - asset: "long_term_bonds"
      favored_condition: "通缩/衰退(冬季)"
      drift: -1.0
  interpretation: "投资组合当前偏向繁荣环境;对通胀风险暴露不足"

质量标准

  • 所有四个资产类别均分析了当前百分比和漂移
  • 漂移计算在数学上正确
  • 再平衡阈值比较准确
  • 如果启用了保证金,包含保证金效率分析
  • 如果启用了卫星跟踪,包含卫星配置分析
  • 提供了“四个季节”经济背景分析
  • 所有百分比之和为 100%(在舍入容差范围内)
  • YAML 格式有效且可解析
  • 当满足所有标准时,在响应中包含 <promise>✓ 质量标准已满足</promise>

上下文

此分析是永久投资组合管理的核心。Harry Browne 设计了 25/25/25/25 的配置,以在所有经济条件下提供平衡——即经济周期的“四个季节”。漂移分析有助于确定何时需要再平衡以维持这种平衡。

保证金分析帮助用户了解其保证金使用是否具有成本效益,将实际支付的费用与计算成本和预期收益进行比较。

任务上下文

自动化的每日投资组合分析,实施 Harry Browne 的永久投资组合策略。

永久投资组合在四个资产类别中维持等额的 25% 配置,旨在适应不同的经济条件:

  • 股票(25%):繁荣/增长
  • 长期债券(25%):通缩/衰退
  • 黄金(25%):通胀
  • 现金/国债(25%):货币紧缩/衰退

该工作流:

  1. 通过 bin/robinhood positions --save CLI 收集投资组合数据
  2. 分析当前配置与 25/25/25/25 目标的对比
  3. 跟踪卫星股票挑选(可选,占股票配置的 10-20%)
  4. 评估保证金使用效率与支付的费用对比
  5. 当漂移超过用户定义的阈值时生成再平衡建议
  6. 生成一份可读的每日报告供人工审核

重要提示:此系统为只读。不会自动执行任何交易。 所有建议都需要人工审核和执行。

必需输入

来自先前步骤的文件 - 请先读取:

  • portfolio_balancer/data/portfolio_snapshot.yml(来自 collect_portfolio_data)

工作分支

使用分支格式:deepwork/portfolio_balancer-[实例]-YYYYMMDD

  • 如果当前在匹配的工作分支上:继续使用它
  • 如果在 main/master 上:使用 git checkout -b deepwork/portfolio_balancer-[实例]-$(date +%Y%m%d) 创建新分支

输出

必需输出:

  • portfolio_balancer/data/allocation_analysis.yml

护栏

  • 如果此步骤有依赖项,请勿跳过前置条件验证
  • 请勿生成部分输出;在完成所有必需输出后再结束
  • 没有必需的输入时请勿继续;如果缺少任何输入,请询问用户
  • 请勿修改此步骤定义输出范围之外的文件

完成时

  1. 验证输出文件已创建
  2. 通知用户:“第 2/4 步完成,输出:portfolio_balancer/data/allocation_analysis.yml”
  3. 继续工作流:使用 Skill 工具调用 /portfolio_balancer.generate_recommendations

参考文件:.deepwork/jobs/portfolio_balancer/job.yml,.deepwork/jobs/portfolio_balancer/steps/analyze_allocation.md

Individual skills in this repo

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

majiayu000/claude-skill-registry

Builds, edit or validate Agent Skill through conversational discovery. Use when the user requests to "Create an Agent", "Optimize an Agent" or "Edit an Agent".

majiayu000/claude-skill-registry

Edit existing BMAD agents while maintaining compliance

majiayu000/claude-skill-registry

Edit existing BMAD agents while maintaining compliance

majiayu000/claude-skill-registry

Edit existing BMAD modules while maintaining coherence

majiayu000/claude-skill-registry

Edit existing BMAD modules while maintaining coherence

majiayu000/claude-skill-registry

Analyzes current state and user query to answer BMad questions or recommend the next workflow or agent. Use when user says what should I do next, what do I do now, or asks a question about BMad

majiayu000/claude-skill-registry

Build AI agents with Google ADK Python (Agent Development Kit). Use for multi-agent systems, workflow agents (sequential/parallel/loop), Vertex AI deployment, tool integration, human-in-the-loop.

majiayu000/claude-skill-registry

Build AI agents with Google ADK Python (Agent Development Kit). Use for multi-agent systems, workflow agents (sequential/parallel/loop), Vertex AI deployment, tool integration, human-in-the-loop.

majiayu000/claude-skill-registry

Portfolio allocation and rebalancing optimizer. Manages asset allocation across stocks/cash/bonds, performs periodic rebalancing, and ensures diversification according to market regime and risk tolerance.

majiayu000/claude-skill-registry

Create a hilarious and ultra-realistic video of an anthropomorphic animal acting like a human vlogger in a real-world setting.

majiayu000/claude-skill-registry

Speech-to-text transcription and translation via OpenAI Audio API -- models, response formats, timestamps, prompting, streaming, chunking, and diarization

majiayu000/claude-skill-registry

BlockRun works with Claude Code and Google Antigravity.

majiayu000/claude-skill-registry

This skill should be used when the user asks about libraries, frameworks, API references, or needs code examples. Activates for setup questions, code generation involving libraries, or mentions of specific frameworks like React, Vue, Next.js, Prisma, Supabase, etc.

majiayu000/claude-skill-registry

小省导购员数字人带货版即梦视频提示词生成系统,基于四大智能体协同(提示词生成师、质量管控师、知识库运维师、跨环节适配师),按照"主体+运动+场景+(镜头语言+光影+氛围)"公式输出中英文双版提示词,适配5s短视频。确保人物一致性、视觉连贯性、情绪连贯性,支持知识库智能复用和跨工具适配(Suno音乐、AI绘画),为数字人带货视频提供高质量提示词生成服务。

majiayu000/claude-skill-registry

Upload and manage files using Google Gemini File API via scripts/. Use for uploading images, audio, video, PDFs, and other files for use with Gemini models. Supports file upload, status checking, and file management. Triggers on "upload file", "file API", "upload image", "upload PDF", "upload video", "file management".

majiayu000/claude-skill-registry

CRITICAL: Use for MolyKit AI chat toolkit. Triggers on: BotClient, OpenAI, SSE streaming, AI chat, molykit, PlatformSend, spawn(), ThreadToken, cross-platform async, Chat widget, Messages, PromptInput, Avatar, LLM

majiayu000/claude-skill-registry

AI and machine learning workflow covering LLM application development, RAG implementation, agent architecture, ML pipelines, and AI-powered features.

majiayu000/claude-skill-registry

Analyze images/audio/video with Gemini API (better vision than Claude). Generate images (Imagen 4), videos (Veo 3). Use for vision analysis, transcription, OCR, design extraction, multimodal AI.

majiayu000/claude-skill-registry

Analyze images/audio/video with Gemini API (better vision than Claude). Generate images (Imagen 4), videos (Veo 3). Use for vision analysis, transcription, OCR, design extraction, multimodal AI.

majiayu000/claude-skill-registry

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

相关技能