본문으로 건너뛰기
Skillpedia
분석 및 스프레드시트37k · #7541

performance-attribution

하는 일

이 스킬은 포트폴리오 수익을 업종 선택이나 종목 선택 같은 명확한 이유로 나눕니다. 펀드 매니저와 분석가가 결과를 설명해야 할 때 쓰는 스킬입니다.

사용하는 경우

  • ✓포트폴리오가 벤치마크를 이긴 이유가 업종 선택 때문인지 종목 선택 때문인지 알고 싶을 때.
  • ✓전략 수익에서 실력과 운을 구분해야 할 때.
  • ✓일정 기간의 결과 뒤 팩터 노출과 타이밍 결정을 검토하는 경우.

스킬 링크

https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/performance-attribution/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/performance-attribution/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“지난 분기에 제 포트폴리오가 벤치마크를 이긴 이유는 무엇인가요? 업종별로 나눠 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 포트폴리오 비중과 수익을 업종별로 벤치마크와 비교합니다. 그다음 차이를 배분 효과, 선택 효과, 상호작용 효과로 나누며, 이 세 효과의 합은 정확히 전체 차이와 같아집니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Performance Attribution Analysis

Overview

Decompose portfolio excess returns into explainable sources: sector allocation, stock selection, factor exposure, timing contribution, and more. This helps explain why a strategy made or lost money, rather than only how much it made or lost.

Brinson Attribution Model

Do not retype these formulas into throwaway Python. They are implemented and tested in src/quantlib/attribution.py; import them.

Single-Period Brinson-Fachler Model

Let w_p,i = portfolio weight of sector i
    w_b,i = benchmark weight of sector i
    r_p,i = portfolio return of sector i
    r_b,i = benchmark return of sector i
    R_b   = total benchmark return

Allocation_i  = (w_p,i - w_b,i) × (r_b,i - R_b)
Selection_i   =  w_b,i          × (r_p,i - r_b,i)
Interaction_i = (w_p,i - w_b,i) × (r_p,i - r_b,i)

Total active return = Σ(Allocation_i) + Σ(Selection_i) + Σ(Interaction_i)

The decomposition itself has no residual term. The three effects sum to R_p - R_b identically, for any sector returns whatsoever, provided the portfolio and benchmark weights carry the same total. brinson_fachler enforces the weight-sum precondition and raises rather than returning a decomposition that does not tie out.

A residual is therefore never a property of the algebra — but it is a real and expected property of a reported attribution, because the inputs are a snapshot. Intra-period trading, cash drag, corporate actions and FX translation all move the actual portfolio return away from the one these weights and sector returns imply. So:

  • residual inside the decomposition, given the inputs → impossible; if you see one, the arithmetic or the weight convention is wrong;
  • residual between the decomposition and the reported fund return → normal; quantify it and attribute it to its source rather than absorbing it silently into selection. This is what the /attrib reconciliation gate asks for.
from src.quantlib.attribution import brinson_fachler

result = brinson_fachler(
    portfolio_weights={"Tech": 0.40, "Financials": 0.10, "Energy": 0.30, "Health": 0.20},
    benchmark_weights={"Tech": 0.25, "Financials": 0.30, "Energy": 0.25, "Health": 0.20},
    portfolio_returns={"Tech": 0.12, "Financials": 0.04, "Energy": -0.02, "Health": 0.07},
    benchmark_returns={"Tech": 0.10, "Financials": 0.05, "Energy": -0.01, "Health": 0.06},
)

result.portfolio_return   # 0.0600
result.benchmark_return   # 0.0495
result.active_return      # 0.0105
result.allocation         # 0.0045
result.selection          # 0.0015
result.interaction        # 0.0045
# 0.0045 + 0.0015 + 0.0045 == 0.0105 exactly (residual ~3e-18, machine epsilon)

for effect in result.sectors:
    print(effect.sector, effect.allocation, effect.selection, effect.interaction, effect.total)

A sector return may be omitted only where the matching weight is zero. A benchmark sector you did not own therefore shows zero selection and zero interaction, and the whole effect lands in allocation — you cannot demonstrate stock-picking skill in something you never held.

Example Brinson Attribution

Rendered from the call above, so every figure below is reproducible:

### Brinson Sector Attribution

| Sector | Portfolio Weight | Benchmark Weight | Portfolio Return | Benchmark Return | Allocation | Selection | Interaction |
|------|---------|---------|---------|---------|---------|---------|---------|
| Tech | 40% | 25% | 12% | 10% | +0.7575% | +0.50% | +0.30% |
| Financials | 10% | 30% | 4% | 5% | -0.0100% | -0.30% | +0.20% |
| Energy | 30% | 25% | -2% | -1% | -0.2975% | -0.25% | -0.05% |
| Health | 20% | 20% | 7% | 6% | +0.0000% | +0.20% | +0.00% |
| **Total** | 100% | 100% | 6.00% | 4.95% | **+0.45%** | **+0.15%** | **+0.45%** |

Active return 1.05% = allocation 0.45% + selection 0.15% + interaction 0.45%. No residual.

Multi-Period Attribution (Linked Brinson)

Single-period effects add, but returns compound, so simply summing each period's effects does not reproduce the compounded active return. Take the four-sector period above and two more like it (the exact three are the _three_periods fixture in tests/quantlib/test_attribution.py, so you can run them): summing the three active returns gives 2.8500%, while the compounded active return is 3.0318% — an 18.2bp error that grows with the horizon and the return level.

Use Carino logarithmic linking, implemented as carino_link.

자주 묻는 질문

Brinson 모델이란 무엇인가요?

초과 수익을 배분, 선택, 상호작용 효과로 나누는 표준 방법입니다.

분해 결과의 합이 항상 맞나요?

네. 포트폴리오와 벤치마크의 비중이 맞는 한, 세 효과의 합은 전체 차이와 정확히 같습니다.

시장 타이밍도 점검할 수 있나요?

네. 스킬은 팩터 및 벤치마크 비교와 함께 시장 타이밍 평가도 포함합니다.

상세 정보

작성자의 원본 설명

Performance attribution analysis — Brinson sector/stock-selection attribution, factor alpha/beta decomposition, market-timing evaluation, and benchmark comparison framework.

repo: HKUDS/Vibe-Trading

인기도

GitHub 스타
37k
순위
#7541
라이선스
MIT
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬