feat: 성과 귀속 자동화 — 실행 격차/구성 격차 분해#432
Merged
Merged
Conversation
한 달 운영 리뷰(docs/PAPER_MONTH1_REVIEW_AND_PLAN.md P1-4·§2)에서 손으로 했던 분석을 평가 도구가 매 실행 자동 산출한다. 벤치마크 대비 격차가 통제 가능한 실행 실수 때문인지, 균등가중 설계의 성격 때문인지 구분해준다. - 실행 격차 = 실제 NAV - 설계 NAV (미체결 슬롯·진입 타이밍·비용) - 구성 격차 = 설계 NAV - KS11 (균등가중 vs 시총지수) - 항등식: 실행 + 구성 = 총 격차 core/basket_evaluation.py: - decompose_return_gap(순수): 세 격차 산출 - compute_design_portfolio_return(fetch 주입 가능): 종목별 구간수익 가중평균 × 주식비중(현금 슬리브 0%), 조회 실패 종목은 재정규화 - collect_basket_paper_evaluation(include_attribution=False): True일 때만 분해 계산해 metrics 주입 — 기본 off라 일일 사이클은 종목별 조회 부담 없음 - format_evaluation_report가 분해 출력 tools/basket_paper_evaluation.py: 기본 ON(--no-attribution로 생략) 적대적 리뷰 반영(medium): NAV(마지막 스냅샷 시점)와 벤치마크·설계 조회 종료일을 일치시켜 하루치 시장 변동이 실행 격차로 오귀속되지 않게 창 정합. 실CLI 스모크로 항등식 일치 확인. 전체 스위트 1583 통과.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
무엇
한 달 운영 리뷰(docs/PAPER_MONTH1_REVIEW_AND_PLAN.md P1-4·§2)의 성과 귀속 분해를 자동화합니다. 리뷰에서 손으로 계산했던 "실행 격차 vs 구성 격차"를 평가 도구가 매 실행 자동 산출합니다.
왜
-5.47%라는 벤치마크 대비 격차가 내 실행 실수(통제 가능) 때문인지, 균등가중 설계의 성격(수용된 변동) 때문인지 구분되지 않으면 "프로그램이 못 번다"로 오독됩니다. 이 분해가 그 질문에 매 실행 답합니다:무엇을 했나
core/basket_evaluation.pydecompose_return_gap(nav, design, benchmark)— 세 격차 산출(None 전파).compute_design_portfolio_return(holdings, stock_fraction, start, end, fetch=None)— 종목별 구간 수익 가중평균 × 주식비중(현금 슬리브 0%), 조회 실패 종목은 재정규화.fetch주입 가능(테스트).collect_basket_paper_evaluation(..., include_attribution=False)— True일 때만 설계 수익·분해를 계산해 metrics에 주입. 기본 off → 일일 사이클은 종목별 조회(네트워크) 부담 없음.format_evaluation_report가 분해를 출력.tools/basket_paper_evaluation.py— 기본 ON(--no-attribution로 생략).실CLI 스모크 + 적대적 리뷰
설계 NAV -3.55% / 실행 -1.92%p + 구성 -5.62%p(합 = 총 격차, 항등식 일치).테스트
tests/test_return_attribution.py— 분해 항등식·가중평균·현금 슬리브·조회실패 재정규화·None 전파(월1 실측 숫자 포함).