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>
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
formula_id: HORIZON_ALLOCATION_LOCK_V1
|
||||
name: 투자 기간 할당 잠금 (Horizon Allocation Lock)
|
||||
description: 종목별 투자 목적(단기/중기/장기)을 명시적으로 고정하여 운영의 일관성을 확보합니다.
|
||||
rules:
|
||||
- id: HA001
|
||||
condition: "horizon_bucket IS NULL"
|
||||
action: "BLOCK_BUY"
|
||||
reason: "투자기간 버킷 미지정"
|
||||
- id: HA002
|
||||
condition: "horizon_bucket == 'SHORT_TERM' AND holding_days > 15"
|
||||
action: "FORCE_TRIM"
|
||||
reason: "단기 모멘텀 종목 보유 기간 초과"
|
||||
- id: HA003
|
||||
condition: "horizon_bucket == 'LONG_TERM' AND stop_loss_hit == TRUE"
|
||||
action: "DOWNGRADE_GRADE"
|
||||
reason: "장기 코어 종목의 구조적 훼손 의심"
|
||||
output:
|
||||
schema: horizon_allocation_json
|
||||
fields:
|
||||
- bucket: STRING (SHORT, MID, LONG)
|
||||
- weight_cap_pct: NUMBER
|
||||
- duration_violation: BOOLEAN
|
||||
|
||||
# ── 투자성향별 가중치 보정 (CAPITAL_STYLE_ALLOCATION_V2) ─────────────────────
|
||||
# [SCAFFOLDED_PENDING_LIVE_DATA: 모든 성향 sample_n=0, target>=30]
|
||||
weight_calibration:
|
||||
formula_id: CAPITAL_STYLE_ALLOCATION_V2
|
||||
status: SCAFFOLDED_PENDING_LIVE_DATA
|
||||
rationale: "4성향(SCALP/SWING/MOMENTUM/POSITION) conviction이 전부 미보정. 보유기간별 실측 승률로 가중치를 닫아야 한다."
|
||||
styles:
|
||||
SCALP:
|
||||
horizon_days: "1~3일"
|
||||
weight_tech: 0.50
|
||||
weight_smartmoney: 0.30
|
||||
weight_fundamental: 0.20
|
||||
weight_source: EXPERT_PRIOR
|
||||
sample_n: 0
|
||||
label: "[UNVALIDATED_WEIGHT: n=0 < 30]"
|
||||
t5_win_rate: null
|
||||
SWING:
|
||||
horizon_days: "1~4주"
|
||||
weight_tech: 0.30
|
||||
weight_smartmoney: 0.35
|
||||
weight_fundamental: 0.35
|
||||
weight_source: EXPERT_PRIOR
|
||||
sample_n: 0
|
||||
label: "[UNVALIDATED_WEIGHT: n=0 < 30]"
|
||||
t5_win_rate: null
|
||||
MOMENTUM:
|
||||
horizon_days: "1~3개월"
|
||||
weight_tech: 0.20
|
||||
weight_smartmoney: 0.40
|
||||
weight_fundamental: 0.40
|
||||
weight_source: EXPERT_PRIOR
|
||||
sample_n: 0
|
||||
label: "[UNVALIDATED_WEIGHT: n=0 < 30]"
|
||||
t20_win_rate: null
|
||||
POSITION:
|
||||
horizon_days: "3개월+"
|
||||
weight_tech: 0.10
|
||||
weight_smartmoney: 0.35
|
||||
weight_fundamental: 0.55
|
||||
weight_source: EXPERT_PRIOR
|
||||
sample_n: 0
|
||||
label: "[UNVALIDATED_WEIGHT: n=0 < 30]"
|
||||
t20_win_rate: null
|
||||
conviction_gates:
|
||||
lt_35: {recommended_pct: 0, action: BLOCK_ENTRY, note: "진입 금지"}
|
||||
"35_49": {recommended_pct: 1.5}
|
||||
"50_64": {recommended_pct: 3.0}
|
||||
"65_79": {recommended_pct: 5.0}
|
||||
"80_plus": {recommended_pct: 7.0}
|
||||
calibration_trigger: "표본 >= 30 성향부터 weight_source=DYNAMIC으로 자동 전환"
|
||||
output: Temp/capital_style_allocation_v2.json
|
||||
python_tool: "tools/build_capital_style_allocation_v1.py (v2 출력으로 확장 필요)"
|
||||
gs_coverage: "gas_apex_runtime_core.gs:calcCapitalStyleAllocationV2_()"
|
||||
validator: "tools/validate_capital_style_allocation_v1.py"
|
||||
Reference in New Issue
Block a user