Files
kjh2064 ee3e799de1 feat: 리밸런싱 엔진 V1 + GAS 버그 수정 (2026-06-13)
주요 변경:
- tools/build_rebalance_engine_v1.py: REBALANCE_ENGINE_V1 신규
  * account_snapshot 직접 합산(_build_snap_position_map) → 소수주 분리 행 병합
  * 레짐 소스 macro.REGIME_PRELIM 최우선 (GAS 와 동일)
- src/gas_adapter_parts/gdf_06_rebalance.gs: runRebalanceSheet_() 신규
  * Logger.log / getSpreadsheet_() 로 run_all 연동 수정
- src/gas_adapter_parts/gdc_01_fetch_fundamentals.gs
  * _mergePositionRecord_(): 소수주 중복 행 합산 신규
  * parseInt → parseFloat (qty, availQty)
- src/gas_adapter_parts/gdf_01_price_metrics.gs
  * 미보유 종목 SELL_READY → WATCH_EXIT_SIGNAL
- spec/41_release_dag.yaml: build_rebalance_sheet 노드 추가 (step_count 63)
- spec/51_formula_lifecycle_registry.yaml: REBALANCE_ENGINE_V1 등록

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-13 13:20:14 +09:00

93 lines
4.8 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
meta:
title: "은퇴자산포트폴리오 — 시장위험 현금룰"
parent_file: "spec/risk/risk_control.yaml"
version: "2026-05-15-F12_split"
language: "ko-KR"
timezone: "Asia/Seoul"
role: "canonical"
migration_status: "canonical_split_active"
risk_control:
VIX:
below_18: "정상 집행"
18_25: "집행액 85%"
25_35: "집행액 60%"
above_35: "신규 위험자산 50% 축소"
above_45: "신규 위험자산 매수 중단"
US10Y:
monthly_plus_50bp: "위험자산 수량 20% 축소 및 하락 위험 상향"
rate_cut_delay_shock: "금리 인하 지연 + 환율 1,400원 동시 돌파 시 신규 매수 전면 중단, cash_floor 15~20% 즉각 상향"
market_risk_score_based_cash:
purpose: "MRS(시장 위험 점수) 0~10점에 따라 현금 비중을 5~20%로 자동 조정. cash_floor.regime_numbers 고정값 대체."
formula: "target_cash_pct = 5 + (MRS / 10) × 15"
formula_examples:
MRS_0: "target_cash_pct = 5% (강한 상승장 최저현금)"
MRS_5: "target_cash_pct = 12.5%"
MRS_10: "target_cash_pct = 20% (극단 위기 최고현금)"
mrs_components:
VIX:
below_18: 0
18_25: 2
25_35: 3
above_35: 4
max_score: 4
KOSPI_vs_MA20:
above_MA20: 0
below_MA20: 2
max_score: 2
USD_KRW:
below_1400: 0
1400_1450: 1
above_1450: 2
max_score: 2
USD_JPY_direction:
stable: 0
rapid_drop_1pct_2d: 1
max_score: 1
credit_stress:
none: 0
caution: 1
max_score: 1
override_rule:
rule: "target_cash_pct = max(MRS_formula_result, cash_floor.regime_numbers 해당 구간 min_cash_ratio)"
note: "MRS 기반 결과와 기존 regime_numbers 중 더 높은 값 적용. MRS가 기존보다 낮을 경우 기존 하한 유지."
output_table:
columns: ["VIX점수", "KOSPI점수", "환율점수", "JPY점수", "신용점수", "MRS합계", "target_cash_pct(%)", "현재현금(%)", "조정방향"]
daily_calculation_sop: # [proposal_74 / 2026-05-15] MRS 일일 산출 실행 프로토콜
reference_time: "매일 15:30 종가 확정 직후"
collection_sequence:
step_1: "VIX 종가 수집 → score 산출 (VIX<18→0, 18~25→2, 25~35→3, >35→4)"
step_2: "KOSPI 종가 vs MA20 비교 → score (MA20 상회→0, 이탈→2)"
step_3: "USD/KRW 종가 → score (<1400→0, 1400~1450→1, >1450→2)"
step_4: "USD/JPY → score (급격 하락 2거래일 내 1%↓→1, 정상→0)"
step_5: "credit_stress → score (경계→1, 없음→0)"
aggregation: "MRS = step_1~step_5 합산 (최소 0, 최대 10)"
missing_data_rule:
rule: "각 컴포넌트 데이터 미확인 시 해당 컴포넌트 최고점 보수 처리"
VIX_missing: "→ 4점 처리"
KOSPI_MA20_missing: "→ 2점 처리"
USD_KRW_missing: "→ 2점 처리"
USD_JPY_missing: "→ 1점 처리"
credit_missing: "→ 1점 처리"
rationale: "데이터 누락 = 위험 인식 불가 = 최고 위험 가정이 생존 원칙에 부합"
output_requirement: "MRS 점수·각 컴포넌트 점수·target_cash_pct를 보고서 블록5 현금룰 섹션에 출력 필수"
update_frequency: "일별 갱신. VIX 5p 이상 장중 급변 시 장중 임시 갱신 허용."
fallback_logic: # [proposal_82 / 2026-05-15] MRS 미산출 시 조건부 보수적 기본값
purpose: "MRS 미산출 시 시장 국면에 따른 조건부 보수적 기본값으로 위험 방어"
conditional_default:
VIX_high: "VIX >= 25 확인 시 → target_cash_pct 기본값 15%"
KOSPI_below_MA20: "KOSPI 종가 < MA20 확인 시 → target_cash_pct 기본값 12%"
normal: "두 조건 모두 미충족 시 → target_cash_pct 기본값 10%"
all_unknown_rule: "VIX·KOSPI 모두 확인 불가 시 → target_cash_pct 15% 강제 적용 AND 신규 매수 보류(MRS 재산출 완료 후 재개)"
priority: "daily_calculation_sop 실행 실패 시에만 발동. SOP 성공 시 비활성."
output_requirement: "fallback 발동 시 블록5에 [MRS 미산출 — fallback 적용: X%] 표기 필수"
prohibition:
- "VIX >= 25 국면에서 MRS 미산출 상태로 10% 기본값 적용 금지"
- "all_unknown 상태에서 MRS 재산출 없이 신규 매수 집행 금지"
prohibition:
- "MRS 점수 미산출 시 target_cash_pct 기본값 10% 적용. 명시 표기."
- "MRS 결과가 기존 cash_floor.regime_numbers보다 낮아도 기존 하한 유지 (하향 조정 금지)"
- "→ master_prohibitions.P3 전역 적용"
# [proposal_56 / 2026-05-15] 섹터 급락 당일 대응 프로토콜 — sector_crash_intraday_protocol