Communitygithub.com

포트폴리오 매니저 에이전트

포트폴리오 배분 및 리밸런싱 최적화 도구입니다. 시장 국면과 위험 허용 범위에 따라 주식/현금/채권 간 자산 배분을 관리하고, 주기적으로 리밸런싱을 수행하며 다각화를 보장합니다.

포트폴리오 매니저 에이전트란 무엇인가요?

이 스킬은 포트폴리오 매니저 에이전트로, 시장 국면(RISK_ON, RISK_OFF, TRANSITION)을 감지하여 동적으로 자산 배분을 조정하고 재조정 트리거를 식별합니다. 주요 기능으로는 역동적 자산 배분 전략, 편차 기반 리밸런싱(5% 이상 시 권장, 10% 이상 시 긴급), 포트폴리오 베타, 샤프 비율, 최대 낙폭, 상관 행렬 등의 위험 지표 모니터링, 켈리 기준 기반 포지션 사이징(최대 15%) 등이 있습니다. 이 스킬은 MarketRegimeDetector와 통합되어 거시 경제 데이터(VIX, GDP 성장, 실업률, CPI)를 기반으로 현재 국면을 파악하고, 위험 허용 범위와 시장 상황에 맞춰 주식/채권/현금 비중을 조정합니다. 또한 헌법 제4조 준수 검증을 통해 제도적 제약을 만족시키며, War Room과 협력하여 포지션 불균형 시 부분 진입 또는 기존 포지션 매도를 권장합니다. 지원 플랫폼은 Claude Code, Cursor, Codex 등 AI 에이전트 도구이며, Python 코드 스니펫을 활용한 실제 구현 가이드를 제공합니다.

지원 대상✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/majiayu000/claude-skill-registry-data/tree/HEAD/agent/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
}

섹터 다각화

Tech: 최대 40%
Finance: 최대 30%
Healthcare: 최대 25%
기타 섹터: 각각 최대 20%

2. 리밸런싱 트리거

IF 편차 > 5%:
  → 리밸런싱 권장

예시:
목표: 주식 70%
현재: 주식 76%
편차: +6% → 리밸런싱

IF 편차 > 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 = |current - target|

5단계: 리밸런싱 결정
  IF 편차 > 임계값:
    → 리밸런싱 거래 생성
  ELSE:
    → 현재 배분 유지

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%
- 거래:
  * 주식 매수 $15,000
  * 채권 매도 $10,000
  * 현금 축소 $5,000

예시 2: RISK_OFF → 방어적 배분

입력:
- VIX: 28
- 경기 침체 신호
- 시장 국면: RISK_OFF
- 현재: 주식 70%, 채권 20%, 현금 10%

출력:
- 권장: 긴급 리밸런싱
- 목표: 주식 40%, 채권 40%, 현금 20%
- 거래:
  * 주식 매도 $30,000
  * 채권 매수 $20,000
  * 현금 증대 $10,000

예시 3: 편차 작음 → 유지

입력:
- 현재: 주식 68%, 채권 22%, 현금 10%
- 목표: 주식 70%, 채권 20%, 현금 10%
- 편차: 2%, 2%, 0%

출력:
- 권장: 유지
- 사유: "편차 < 5%, 거래 비용 고려 시 유지가 유리"

예시 4: 섹터 리밸런싱

입력:
- Tech: 45% (최대 40%)
- Finance: 15%
- Healthcare: 10%

출력:
- 권장: SECTOR_REBALANCE
- 거래:
  * Tech 주식 매도 $5,000 (45% → 40%)
  * Healthcare 주식 매수 $3,000
  * Finance 주식 매수 $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}  # 음수 없음
    ]
    
    # 경계 (주식당 최대 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 → 거래 신호
  ↓
포트폴리오 매니저 → 현재 배분 확인
  ↓
IF 새 포지션이 불균형 초래:
  → 부분 포지션 크기 제안
  OR
  → 먼저 다른 포지션 매도 권장

예시:
War Room: AAPL $15,000 매수
포트폴리오 매니저: "Tech 섹터 이미 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 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

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

Understand an existing codebase through systematic exploration

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

관련 스킬