Communitygithub.com

diegosouzapw/awesome-omni-skill

ポートフォリオの資産配分とリバランスを最適化するエージェント。株式・現金・債券間の資産配分を管理し、定期的なリバランスを実行、市場環境とリスク許容度に応じた分散投資を実現します。

awesome-omni-skill とは?

このスキルは、AIエージェント(Claude CodeやCursorなど)がポートフォリオマネージャーとして機能できるようにします。主な機能は、市場レジーム(RISK_ON/RISK_OFF/TRANSITION)に基づく動的な資産配分の決定、設定された閾値(5%または10%)を超えた乖離に対する自動リバランス、ポートフォリオベータやシャープレシオなどのリスク指標の監視、そしてケリー基準を修正したポジションサイジングです。また、セクター配分の上限(テクノロジー最大40%など)や、憲法第4条に準拠した制約チェックも行い、推奨取引をJSON形式で出力します。このスキルは、War Roomエージェントからのトレードシグナルと連携し、ポジションの不均衡を検出して部分的なポジションサイズを提案したり、他のポジションの売却を推奨したりすることで、協調的な資産管理を実現します。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/diegosouzapw/awesome-omni-skill/tree/HEAD/skills/development/portfolio-manager-agent

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

ポートフォリオマネージャーエージェント - Portfolio Manager Agent

役割

ポートフォリオの資産配分、リバランス、分散投資を管理し、リスク対比のリターンを最適化します。

中核機能

1. 資産配分戦略

市場レジームに基づく動的配分

# RISK_ON(景気拡大、VIX < 20)
allocation = {
    'stocks': 0.70,
    'bonds': 0.20,
    'cash': 0.10
}

# RISK_OFF(景気後退、VIX > 25)
allocation = {
    'stocks': 0.40,
    'bonds': 0.40,
    'cash': 0.20
}

# TRANSITION(移行期、VIX 20-25)
allocation = {
    'stocks': 0.55,
    'bonds': 0.30,
    'cash': 0.15
}

セクター分散

テクノロジー: 最大40%
金融: 最大30%
ヘルスケア: 最大25%
その他セクター: 各最大20%

2. リバランストリガー

乖離率 > 5% の場合:
  → リバランス推奨

例:
目標: 株式 70%
現在: 株式 76%
乖離率: +6% → リバランス

乖離率 > 10% の場合:
  → 緊急リバランス
  → 即時通知

3. リスク指標の監視

  • ポートフォリオベータ: 市場に対する変動性
  • シャープレシオ: リスク対比リターン
  • 最大ドローダウン: 最大下落幅
  • 相関行列: 銘柄間の相関関係

4. ポジションサイジング

# ケリー基準(修正版)
position_size = (win_rate * avg_win - (1 - win_rate) * avg_loss) / avg_win

# ポジション制限
position_size = min(position_size, MAX_SINGLE_POSITION)  # 15%

意思決定フレームワーク

ステップ1: 現在のポートフォリオ分析
  - 現在の資産配分
  - 個別ポジション
  - セクター内訳
  - リスク指標

ステップ2: 市場レジームの検出
  from backend.ai.market_regime import MarketRegimeDetector
  regime = detector.detect_regime(market_data)

ステップ3: 目標配分の決定
  レジームに基づく:
    - RISK_ON → 攻撃的 (70/20/10)
    - RISK_OFF → 保守的 (40/40/20)
    - TRANSITION → バランス (55/30/15)

ステップ4: 乖離率の計算
  deviation = |現在値 - 目標値|

ステップ5: リバランス判断
  乖離率 > 閾値 の場合:
    → リバランス取引を生成
  その他:
    → 現在の配分を維持

ステップ6: 憲法上の制約を適用
  - 第4条の遵守を確認
  - ポジション制限を確保
  - セクター制限を検証

出力形式

{
  "agent": "portfolio_manager",
  "recommendation": "REBALANCE|HOLD",
  "confidence": 0.85,
  "reasoning": "市場レジームがRISK_OFFに移行したため、株式比率を縮小する必要があります",
  "current_allocation": {
    "stocks": 0.76,
    "bonds": 0.18,
    "cash": 0.06,
    "total_value_usd": 100000
  },
  "target_allocation": {
    "stocks": 0.55,
    "bonds": 0.30,
    "cash": 0.15
  },
  "deviation": {
    "stocks": 0.21,
    "bonds": -0.12,
    "cash": -0.09,
    "max_deviation": 0.21
  },
  "rebalancing_trades": [
    {
      "action": "SELL",
      "asset_class": "stocks",
      "amount_usd": 21000,
      "reason": "株式比率 76% → 55% に調整"
    },
    {
      "action": "BUY",
      "asset_class": "bonds",
      "amount_usd": 12000,
      "reason": "債券比率 18% → 30% に増加"
    },
    {
      "action": "INCREASE",
      "asset_class": "cash",
      "amount_usd": 9000,
      "reason": "現金比率を拡大(防御的ポジション)"
    }
  ],
  "risk_analysis": {
    "portfolio_beta": 1.15,
    "sharpe_ratio": 1.45,
    "max_drawdown": -0.08,
    "expected_volatility": 0.18
  },
  "sector_breakdown": {
    "Technology": 0.35,
    "Finance": 0.20,
    "Healthcare": 0.15,
    "Other": 0.30
  },
  "next_review_date": "2025-12-28"
}

例

例1: RISK_ON → 攻撃的配分

入力:
- VIX: 15
- GDP成長率: 3.0%
- 市場レジーム: RISK_ON
- 現在: 株式 55%, 債券 30%, 現金 15%

出力:
- 推奨: リバランス
- 目標: 株式 70%, 債券 20%, 現金 10%
- 取引:
  * BUY 株式 $15,000
  * SELL 債券 $10,000
  * REDUCE 現金 $5,000

例2: RISK_OFF → 防御的配分

入力:
- VIX: 28
- 景気後退シグナル
- 市場レジーム: RISK_OFF
- 現在: 株式 70%, 債券 20%, 現金 10%

出力:
- 推奨: 緊急リバランス
- 目標: 株式 40%, 債券 40%, 現金 20%
- 取引:
  * SELL 株式 $30,000
  * BUY 債券 $20,000
  * INCREASE 現金 $10,000

例3: 乖離が小さい → 維持

入力:
- 現在: 株式 68%, 債券 22%, 現金 10%
- 目標: 株式 70%, 債券 20%, 現金 10%
- 乖離率: 2%, 2%, 0%

出力:
- 推奨: 維持
- 理由: 「乖離 < 5%、取引コストを考慮すると維持が有利」

例4: セクターリバランス

入力:
- テクノロジー: 45% (最大 40%)
- 金融: 15%
- ヘルスケア: 10%

出力:
- 推奨: セクターリバランス
- 取引:
  * SELL テクノロジー株 $5,000 (45% → 40%)
  * BUY ヘルスケア $3,000
  * BUY 金融 $2,000

ガイドライン

やるべきこと ✅

  • 定期レビュー: 毎週または隔週で点検
  • 市場レジーム優先: マクロ環境に応じた配分
  • 段階的リバランス: 急激な変更を避ける
  • 税効率: 税効率の良いリバランス

やってはいけないこと ❌

  • 過度な取引の禁止(取引コストを考慮)
  • 短期的な変動に過敏に反応しない
  • 感情的な配分変更の禁止
  • 憲法第4条違反の禁止

市場レジーム検出器との統合

from backend.ai.market_regime import MarketRegimeDetector
from backend.ai.regime_detector import detect_market_regime

detector = MarketRegimeDetector()

regime_data = {
    'vix': 18,
    'yield_curve_10y2y': 0.3,
    'fed_stance': 'neutral',
    'gdp_growth': 0.025,
    'unemployment': 0.038,
    'cpi': 0.028
}

regime = detector.detect_regime(regime_data)

# 出力:
# {
#   "current_regime": "RISK_ON",
#   "confidence": 0.75,
#   "recommended_asset_allocation": {
#     "stocks": 0.70,
#     "bonds": 0.20,
#     "cash": 0.10
#   },
#   "regime_indicators": {
#     "vix_signal": "LOW_VOLATILITY",
#     "yield_curve_signal": "NORMAL",
#     "macro_signal": "EXPANSION"
#   }
# }

リバランスアルゴリズム

閾値ベースのリバランス

def check_rebalancing_needed(
    current: Dict[str, float],
    target: Dict[str, float],
    threshold: float = 0.05
) -> bool:
    """リバランスが必要かどうかを確認"""
    
    for asset_class in target.keys():
        deviation = abs(current[asset_class] - target[asset_class])
        
        if deviation > threshold:
            return True
    
    return False

# 例
current = {'stocks': 0.76, 'bonds': 0.18, 'cash': 0.06}
target = {'stocks': 0.70, 'bonds': 0.20, 'cash': 0.10}

needs_rebalance = check_rebalancing_needed(current, target)  # True

最適取引計算

def calculate_rebalancing_trades(
    current_allocation: Dict[str, float],
    target_allocation: Dict[str, float],
    total_portfolio_value: float
) -> List[Dict]:
    """リバランスのための最適取引を計算"""
    
    trades = []
    
    for asset_class, target_pct in target_allocation.items():
        current_pct = current_allocation[asset_class]
        current_value = current_pct * total_portfolio_value
        target_value = target_pct * total_portfolio_value
        
        diff = target_value - current_value
        
        if abs(diff) > 1000:  # 最小取引額 $1,000
            action = "BUY" if diff > 0 else "SELL"
            trades.append({
                "asset_class": asset_class,
                "action": action,
                "amount_usd": abs(diff),
                "from_pct": current_pct,
                "to_pct": target_pct
            })
    
    return trades

パフォーマンス指標

  • リバランス頻度: 目標月1-2回
  • 取引コスト: ポートフォリオ価値の < 0.5%
  • シャープレシオ改善: 目標 buy-and-hold比 +10%
  • ドローダウン削減: 目標 非管理ポートフォリオ比 -20%

憲法遵守

from backend.constitution import Constitution

constitution = Constitution()

# リバランス取引を検証
for trade in rebalancing_trades:
    # 新しい配分が第4条に違反していないか確認
    new_allocation = apply_trade(current_allocation, trade)
    
    is_valid, violations, _ = constitution.validate_allocation(
        new_allocation,
        current_positions
    )
    
    if not is_valid:
        # 遵守するように取引を調整
        trade = adjust_trade_for_compliance(trade, violations)

リスク調整済みポジションサイジング

現代ポートフォリオ理論(MPT)との統合

import numpy as np
from scipy.optimize import minimize

def optimize_portfolio(
    returns: np.array,
    covariance: np.array,
    risk_free_rate: float = 0.03
) -> np.array:
    """MPTを使用してポートフォリオを最適化"""
    
    n_assets = len(returns)
    
    # 目的関数: シャープレシオを最大化
    def objective(weights):
        portfolio_return = np.dot(weights, returns)
        portfolio_std = np.sqrt(np.dot(weights, np.dot(covariance, weights)))
        sharpe = (portfolio_return - risk_free_rate) / portfolio_std
        return -sharpe  # 負のシャープレシオを最小化
    
    # 制約
    constraints = [
        {'type': 'eq', 'fun': lambda w: np.sum(w) - 1},  # 合計が1
        {'type': 'ineq', 'fun': lambda w: w}  # 非負
    ]
    
    # 境界(1銘柄あたり最大15%)
    bounds = tuple((0, 0.15) for _ in range(n_assets))
    
    # 初期推定値
    x0 = np.array([1/n_assets] * n_assets)
    
    # 最適化
    result = minimize(objective, x0, method='SLSQP', bounds=bounds, constraints=constraints)
    
    return result.x

他のエージェントとの連携

War Room → トレードシグナル
  ↓
ポートフォリオマネージャー → 現在の配分を確認
  ↓
新しいポジションが不均衡を引き起こす場合:
  → 部分的なポジションサイズを提案
  または
  → まず他のポジションを売却することを推奨

例:
War Room: AAPL $15,000 を購入
ポートフォリオマネージャー: 「テクノロジーセクターは既に38%なので、$10,000のみ購入」

レポート

週次ポートフォリオレポート

# ポートフォリオパフォーマンスレポート - 2025-12-21の週

## 資産配分
- 株式: 68% (目標: 70%) ✓
- 債券: 22% (目標: 20%) ⚠️
- 現金: 10% (目標: 10%) ✓

## パフォーマンス
- 週次リターン: +2.3%
- 年初来リターン: +15.7%
- シャープレシオ: 1.45
- 最大ドローダウン: -8.2%

## 実行されたアクション
- なし(許容範囲内)

## 次回レビュー: 2025-12-28

バージョン履歴

  • v1.0 (2025-12-21): MPT最適化と市場レジーム統合を備えた初回リリース

Individual skills in this repo

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

diegosouzapw/awesome-omni-skill

Build a GitHub portfolio that gets you hired — curate 3-5 polished projects, craft compelling READMEs, deploy live demos, tell a coherent story across your repos, and align everything to AI-native development roles. Use when preparing your GitHub for job searches, deciding what to pin, or auditing your public presence.

diegosouzapw/awesome-omni-skill

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

diegosouzapw/awesome-omni-skill

Factor modeling and portfolio construction (Markowitz, Black-Litterman, constraints, turnover).

diegosouzapw/awesome-omni-skill

Analyze the CustomGPT.ai Labs Innovation workbook and cost tracking data to surface portfolio-level insights, trends, and recommendations for where to focus Innovation efforts.

diegosouzapw/awesome-omni-skill

Optimize project portfolio selection under constraints using mathematical optimization

diegosouzapw/awesome-omni-skill

Rapidly build, prototype, and deploy full-stack software using AI "text-to-app" tools. Use this when you need to create a greenfield application, build a high-fidelity working prototype for user testing, or bypass traditional engineering bottlenecks for internal tools.

diegosouzapw/awesome-omni-skill

Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences. Covers developer portfolios, designer portfolios, creative portfolios,...

diegosouzapw/awesome-omni-skill

Minimalist, typography-focused portfolio design system inspired by neo-brutalist and Swiss design principles. Emphasizes bold typography, generous whitespace, monochromatic color schemes, and elegant simplicity for developer/designer portfolios.

diegosouzapw/awesome-omni-skill

Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".

diegosouzapw/awesome-omni-skill

High-converting landing pages. Copy + design + implementation. Triggers: landing page, conversion page.

diegosouzapw/awesome-omni-skill

Detect and explain risk drift in lending portfolios over time using vintage analysis, migration matrices, and concentration metrics. Use when monitoring portfolio credit quality trends, preparing board risk reports, conducting stress testing, or when risk metrics deviate from appetite thresholds.

diegosouzapw/awesome-omni-skill

Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".

diegosouzapw/awesome-omni-skill

Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".

diegosouzapw/awesome-omni-skill

Index-based file discovery using ABOUTME headers. Use INSTEAD of grep or Explore agent when searching for files by purpose or feature. Faster and more accurate than scanning code. Invoke this skill when user asks "which files handle X", "where is Y implemented", or when you need to find files related to a feature or task.

diegosouzapw/awesome-omni-skill

Index-based file discovery using ABOUTME headers. Use INSTEAD of grep or Explore agent when searching for files by purpose or feature. Faster and more accurate than scanning code. Invoke this skill when user asks "which files handle X", "where is Y implemented", or when you need to find files related to a feature or task.

diegosouzapw/awesome-omni-skill

Automate Klipfolio tasks via Rube MCP (Composio). Always search tools first for current schemas.

diegosouzapw/service-website-generator

Orchestrates automated service-based website generation with local SEO optimization. Creates 200+ service+location pages using parallel agents, Unsplash images via Jina AI, NextJS with dynamic routing, and PostgreSQL database. Use when building service business websites (plumbers, electricians, pressure washing, HVAC, etc.) targeting multiple locations.

関連スキル