Communitygithub.com

リスクポートフォリオマネージャー - AI駆動のリスク管理

AIを活用したポートフォリオリスク管理と最適化。ポジションサイジング、資産配分、リスク指標(VaR、シャープレシオ)計算、リバランス、防御的戦略の実装に使用します。

リスクポートフォリオマネージャー - AI駆動のリスク管理 とは?

このスキルは、シグナル生成と取引実行の間に位置する、体系的なリスク管理レイヤーです。データ駆動型のアプローチでポジションサイズを最適化し、ポートフォリオ全体のリスクを管理し、防御的なアクションを自動化します。具体的には、修正ケリー基準を用いたポジションサイジングエンジン、VaRやシャープレシオなどのリアルタイムリスクメトリクスダッシュボード、目標配分からの乖離に基づく動的リバランス、日次損失制限やドローダウン制限に基づく自動的なキルスイッチシステム、そしてストレステストによるシナリオ分析を提供します。このスキルは、シグナル強度やトークンリスクスコアを入力として受け取り、承認されたポジションサイズ、ストップロスレベル、ポートフォリオ状態アラートを出力します。meme-trader、meme-executor、flow-tracker、data-orchestrator、llama-analyst などの他のスキルと統合され、堅牢なリスク管理体制を構築します。全ての推奨には信頼区間が含まれ、ラグ検出チェックなしではポジションサイジングを実行しないなど、複数の品質ゲートが設定されています。

対応✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/majiayu000/claude-skill-registry-data/tree/HEAD/business/risk-portfolio-manager

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

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

ドキュメント

リスクポートフォリオマネージャー - AI駆動のリスク管理 は何をしますか?

シグナル生成と取引実行の間に位置する、体系的なリスク管理レイヤーです。データ駆動型のアプローチでポジションサイズを最適化し、ポートフォリオリスクを管理し、防御的なアクションを自動化します。

コア原則

ポジションサイジングとリスク管理が長期的な存続を決定します。単一の取引がポートフォリオを脅かしてはなりません。

アクティブ化トリガー

コア機能

1. ポジションサイジングエンジン

<position_sizing> サイジング方法:

interface PositionSizeRequest {
  signal_strength: number;    // 0-1(meme-traderから)
  token_risk_score: number;   // 1-10(ラグ検出から)
  current_portfolio: Portfolio;
  market_regime: 'bull' | 'bear' | 'sideways' | 'volatile';
  risk_tolerance: 'conservative' | 'moderate' | 'degen';
}

interface PositionSizeResult {
  recommended_size_pct: number;  // ポートフォリオの%
  recommended_size_usd: number;
  max_allowed_size: number;
  reasoning: string[];
  risk_warnings: string[];
}

ケリー基準(修正版):

最適サイズ = (勝率 * 平均利益 - (1 - 勝率) * 平均損失) / 平均利益
調整後サイズ = ケリー * 端数乗数(安全性のため0.25~0.5)

リスク調整サイジングマトリックス:

リスク許容度基本サイズ最大1ポジション最大相関エクスポージャー
コンサバティブ0.5~1%2%5%
ミディアム1~2%4%10%
デジェン2~5%10%25%

シグナルベースの調整:

最終サイズ = 基本サイズ * シグナル強度 * (1 - トークンリスク / 20) * 市場乗数

ここで:
- シグナル強度: 0.5~1.5(弱い~強い)
- トークンリスク: 1~10(低いほど安全)
- 市場乗数: 0.5(ボラティリティ高)~1.2(トレンド中)

出力フォーマット:

ポジションサイズ推奨

トークン: $MEME
シグナル強度: 8/10
トークンリスクスコア: 4/10
市場レジーム: BULL

推奨サイズ:
├─ パーセンテージ: ポートフォリオの2.3%
├─ 金額: $460($20,000ポートフォリオ中)
├─ 最大許容: $800(4%制限)
└─ リスク調整: 制限内

理由:
1. 強いシグナル(8/10)が平均以上のサイジングをサポート
2. 低~中リスクトークン(4/10)により全額アロケーションが可能
3. 強気市場レジームにより積極的なサイジングが許容される
4. 既存ポジションとの相関なし

警告:
- 一度のエントリーではなく、3回に分割してエントリーすることを検討
- ストップロスを-25%(最大損失$345)に設定

</position_sizing>

2. ポートフォリオリスクメトリクス

<risk_metrics> リアルタイムポートフォリオダッシュボード:

ポートフォリオリスクダッシュボード
═══════════════════════════════════════

ポジション(5アクティブ):
トークン    | サイズ   | PnL      | リスク  | ウェイト
$BONK      | $4,200  | +$840    | 5/10   | 21%
$MEME      | $3,100  | +$620    | 4/10   | 15.5%
$DOGE      | $2,800  | -$140    | 3/10   | 14%
$WIF       | $2,500  | +$1,250  | 6/10   | 12.5%
SOL        | $7,400  | +$2,220  | 2/10   | 37%
───────────────────────────────────────
合計       | $20,000 | +$4,790  |        | 100%

リスクメトリクス:
├─ 日次VaR(95%): -$1,240(-6.2%)
├─ 最大ドローダウン(30日): -18.3%
├─ 現在のドローダウン: 0%(最高値圏)
├─ シャープレシオ(30日): 2.14
├─ ソルティーノレシオ: 2.87
├─ SOLに対するベータ: 1.34

相関行列:
        BONK   MEME   DOGE   WIF    SOL
BONK    1.00   0.82   0.71   0.78   0.65
MEME    0.82   1.00   0.68   0.85   0.61
DOGE    0.71   0.68   1.00   0.59   0.54
WIF     0.78   0.85   0.59   1.00   0.72
SOL     0.65   0.61   0.54   0.72   1.00

集中リスク:
├─ 最大ポジション: 37%(SOL) - 制限内
├─ 上位3ポジション: 72.5% - 高
├─ ハーフィンダール指数: 0.23 - 中程度
└─ ミームエクスポージャー: 63% - 高

アラート:
⚠️ MEMEとWIFの相関が高い(0.85)
⚠️ ミームセクターの集中度が50%を超えています

リスク計算:

interface PortfolioRisk {
  // バリューアットリスク
  var_95: number;       // 95%信頼水準の日次VaR
  var_99: number;       // 99%信頼水準の日次VaR
  cvar_95: number;      // 条件付きVaR(期待ショートフォール)

  // パフォーマンスリスク
  sharpe_ratio: number;
  sortino_ratio: number;
  max_drawdown: number;
  current_drawdown: number;

  // 相関リスク
  avg_correlation: number;
  max_correlation: number;
  correlation_cluster: string[]; // 相関の高いグループ

  // 集中リスク
  herfindahl_index: number;
  top_position_pct: number;
  sector_concentrations: Record<string, number>;
}

function calculateVaR(
  positions: Position[],
  confidence: number = 0.95,
  horizon_days: number = 1
): number {
  // 過去30日間のリターンを使用したヒストリカルVaR
  const returns = getHistoricalReturns(positions, 30);
  const portfolio_returns = calculatePortfolioReturns(returns, positions);
  const sorted = portfolio_returns.sort((a, b) => a - b);
  const index = Math.floor((1 - confidence) * sorted.length);
  return sorted[index] * getPortfolioValue(positions) * Math.sqrt(horizon_days);
}

</risk_metrics>

3. 動的リバランス

目標配分フレームワーク:

interface AllocationTarget {
  core_holdings: {
    SOL: { target: 30, min: 20, max: 50 };
    stablecoins: { target: 20, min: 10, max: 40 };
  };
  satellite_holdings: {
    memes: { target: 30, min: 0, max: 50 };
    defi: { target: 15, min: 0, max: 30 };
    other: { target: 5, min: 0, max: 15 };
  };
  rebalance_threshold: 5; // トリガーとなる乖離%
}

リバランス出力:

リバランス推奨

現在 vs 目標配分:
カテゴリー    | 現在  | 目標  | 乖離  | アクション
SOL          | 37%   | 30%   | +7%  | 売却 $1,400
ミーム        | 63%   | 50%   | +13% | 売却 $2,600
ステーブル    | 0%    | 20%   | -20% | 購入 $4,000

推奨取引:
1. BONKポジションの15%を売却($630)→ USDC
2. WIFポジションの20%を売却($500)→ USDC
3. SOLポジションの10%を売却($740)→ USDC
4. MEMEとDOGEのポジションは維持
5. 売却分をUSDCステーブルコインバッファーに変換

リバランス後予測:
├─ SOL: 31%(目標: 30%)
├─ ミーム: 48%(目標: 50%)
├─ ステーブル: 21%(目標: 20%)
└─ VaR削減: -18%(リスクプロファイル改善)

4. 自動防御アクション

<defensive_actions> キルスイッチシステム:

interface KillSwitchConfig {
  daily_loss_limit: number;      // ポートフォリオの%
  weekly_loss_limit: number;     // ポートフォリオの%
  position_loss_limit: number;   // ポジションあたりの%
  drawdown_limit: number;        // ピークからの%
  correlation_spike_action: 'alert' | 'reduce' | 'exit';
  auto_execute: boolean;
}

const defaultKillSwitch: KillSwitchConfig = {
  daily_loss_limit: 10,      // 日次-10%で新規取引停止
  weekly_loss_limit: 20,     // 週次-20%ですべてのアクティビティ停止
  position_loss_limit: 30,   // ポジション-30%で自動クローズ
  drawdown_limit: 25,        // ピークから-25%で非常モード
  correlation_spike_action: 'alert',
  auto_execute: false,       // フェーズ1では確認が必要
};

トリガーされるアクション:

トリガーアクション重大度
ポジション -25%ストップロス警告MEDIUM
ポジション -30%自動クローズ(有効時)HIGH
日次 -10%新規取引停止HIGH
週次 -20%ステーブルコインへ退避CRITICAL
ドローダウン -25%緊急清算CRITICAL
相関 > 0.95一方のポジションを削減MEDIUM

アラート出力:

🚨 リスクアラート: 日次損失制限に近づいています

現在の日次PnL: -8.7%($-1,740)
日次制限: -10%($-2,000)
残バッファー: $260

トリガーされたアクション:
1. ⏸️ 新規取引実行をPAUSE
2. ⚠️ 全てのオープンポジションをレビュー
3. 📊 モニタリング頻度を増加

推奨:
- 最もパフォーマンスの悪いポジションをレビュー(WIF: -15%)
- トレンドが続く場合は部分的な退避を検討
- ナンピンは絶対に行わない

取引を再開するにはRESUMEと入力
ポジションを全て決済するにはEXIT_ALLと入力

</defensive_actions>

5. シナリオ分析

<scenario_analysis> ストレステスト:

interface StressScenario {
  name: string;
  market_move: {
    sol: number;      // %変化
    memes: number;    // SOLに対する%変化
    correlation_shift: number;
  };
  probability: number;
}

const stressScenarios: StressScenario[] = [
  {
    name: 'SOL -30% フラッシュクラッシュ',
    market_move: { sol: -30, memes: -50, correlation_shift: 0.2 },
    probability: 0.05,
  },
  {
    name: 'ミームローテーションアウト',
    market_move: { sol: 0, memes: -40, correlation_shift: -0.1 },
    probability: 0.10,
  },
  {
    name: 'ブルラン継続',
    market_move: { sol: 50, memes: 100, correlation_shift: 0 },
    probability: 0.15,
  },
  {
    name: 'ブラックスワンイベント',
    market_move: { sol: -60, memes: -80, correlation_shift: 0.3 },
    probability: 0.01,
  },
];

ストレステスト出力:

ストレステスト結果

現在のポートフォリオ価値: $20,000

シナリオ                     | ポートフォリオ影響 | 確率
SOL -30% フラッシュクラッシュ | -$7,200(-36%)   | 5%
ミームローテーションアウト    | -$5,040(-25%)   | 10%
ブルラン継続                 | +$14,600(+73%) | 15%
ブラックスワンイベント        | -$12,400(-62%) | 1%

期待ポートフォリオ価値:
├─ ベースケース: $20,000
├─ 期待値(確率加重): $22,340(+11.7%)
├─ 最悪ケース(99%): -$12,400(-62%)
└─ VaR(95%、30日): -$4,800(-24%)

リスク評価:
⚠️ ミームローテーションに対する感度が高い(-25%シナリオ)
⚠️ ブラックスワンエクスポージャーが顕著(-62%)
✓ ベースシナリオでは正の期待値
✓ ブルケースの上振れが大きい(+73%)

推奨:
SOLプットでミームエクスポージャーをヘッジするか、
ミーム配分を10~15%削減してリスクプロファイルを改善することを検討。

</scenario_analysis>

統合ポイント

リスクマネージャーが提供する:

  • meme-executor: 承認済みポジションサイズ、ストップロスレベル
  • meme-trader: ポジション制限、利用可能資本
  • 全スキル: ポートフォリオ状態、リスクアラート

CLI使用法

# ポジションサイズを計算
npx tsx .claude/skills/risk-portfolio-manager/scripts/position-sizer.ts \
  --signal 8 \
  --risk-score 4 \
  --portfolio-file ./portfolio.json \
  --risk-mode moderate

# ポートフォリオリスクメトリクスを取得
npx tsx .claude/skills/risk-portfolio-manager/scripts/risk-metrics.ts \
  --portfolio-file ./portfolio.json \
  --include-correlation \
  --var-confidence 95

# リバランス推奨
npx tsx .claude/skills/risk-portfolio-manager/scripts/rebalancer.ts \
  --portfolio-file ./portfolio.json \
  --target-allocation ./targets.json \
  --threshold 5

# ストレステストを実行
npx tsx .claude/skills/risk-portfolio-manager/scripts/stress-test.ts \
  --portfolio-file ./portfolio.json \
  --scenarios default \
  --output-format detailed

# キルスイッチステータスを確認
npx tsx .claude/skills/risk-portfolio-manager/scripts/kill-switch.ts \
  --portfolio-file ./portfolio.json \
  --check-status

品質ゲート

<validation_rules>

  • ポジションサイジングには、価格データの品質スコアが85%以上である必要がある
  • VaR計算には、30日以上のクリーンな過去データが必要
  • 相関行列には、同期された価格データが必要
  • 全ての推奨には信頼水準が含まれる
  • ラグ検出チェックなしではポジションサイジングを実行しない </validation_rules>

エラーハンドリング

<error_recovery>

  • 価格データがない場合: 最後にわかっているデータ + 古いデータ警告を使用
  • 計算エラー: コンサバティブなフォールバック(最小サイズ)
  • キルスイッチの競合: 安全性が優先(継続より停止)
  • データ品質が不十分: サイジングを拒否し、データリフレッシュを要求 </error_recovery>

<see_also>

  • references/risk-models.md - 数式
  • references/allocation-templates.md - 目標ポートフォリオ
  • scripts/position-sizer.ts - サイジングエンジン
  • scripts/risk-metrics.ts - リスク計算
  • scripts/kill-switch.ts - 自動安全機構 </see_also>

Individual skills in this repo

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

majiayu000/claude-skill-registry-data

Edit existing BMAD agents while maintaining compliance

majiayu000/claude-skill-registry-data

Edit existing BMAD agents while maintaining compliance

majiayu000/claude-skill-registry-data

Edit existing BMAD modules while maintaining coherence

majiayu000/claude-skill-registry-data

Edit existing BMAD modules while maintaining coherence

majiayu000/claude-skill-registry-data

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-data

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-data

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-data

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-data

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-data

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

majiayu000/claude-skill-registry-data

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-data

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

majiayu000/claude-skill-registry-data

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-data

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-data

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-data

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

majiayu000/claude-skill-registry-data

Conduct domain and industry research. Use when the user says "lets create a research report on [domain or industry]

majiayu000/claude-skill-registry-data

Conduct market research on competition and customers. Use when the user says "create a market research report about [business idea]".

majiayu000/claude-skill-registry-data

Conduct technical research on technologies and architecture. Use when the user says "create a technical research report on [topic]".

majiayu000/claude-skill-registry-data

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

関連スキル