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,80 @@
|
||||
formula_id: PRE_DISTRIBUTION_EARLY_WARNING_V3
|
||||
version: "2026-06-03_P0-009"
|
||||
purpose: >
|
||||
5개 분산 feature의 가중합으로 DISTRIBUTION_CONFIRMED(≥4) 또는 WARNING(2~3)을 판정한다.
|
||||
CONFIRMED 종목 신규 BUY를 즉시 차단하고 TRIM_REVIEW를 권고한다. 손절 이탈 전에 설거지 구간을 포착한다.
|
||||
|
||||
features:
|
||||
F1:
|
||||
name: DISTRIBUTION_DETECTOR_SIGNALS_GE2
|
||||
condition: "distribution_sell_detector.signals_count >= 2"
|
||||
weight: 1
|
||||
F2:
|
||||
name: RUNUP_WITH_WEAK_SMART_MONEY
|
||||
condition: "velocity_1d >= 3.0% AND smart_money_score < 50"
|
||||
weight: 1
|
||||
F3:
|
||||
name: RSI_OVERBOUGHT_GE75
|
||||
condition: "rsi14 >= 75"
|
||||
weight: 1
|
||||
F4:
|
||||
name: PRICE_REVERSAL_AFTER_SURGE
|
||||
condition: "ret5d < 0 AND velocity_5d > 5%"
|
||||
weight: 1
|
||||
F5:
|
||||
name: DISTRIBUTION_VERDICT_ACTIVE
|
||||
condition: "distribution_sell_detector.distribution_verdict contains DISTRIBUTION"
|
||||
weight: 1
|
||||
|
||||
verdicts:
|
||||
DISTRIBUTION_CONFIRMED:
|
||||
threshold: "weighted_sum >= 4"
|
||||
action: TRIM_REVIEW
|
||||
buy_blocked: true
|
||||
WARNING:
|
||||
threshold: "2 <= weighted_sum < 4"
|
||||
action: WATCH_TRIM_CANDIDATE
|
||||
buy_blocked: false
|
||||
CLEAR:
|
||||
threshold: "weighted_sum < 2"
|
||||
action: HOLD_MONITOR
|
||||
buy_blocked: false
|
||||
|
||||
acceptance_criteria:
|
||||
distribution_confirmed_buy_count: "== 0"
|
||||
warning_to_trim_lag_days: "<= 1"
|
||||
distribution_t5_down_capture_rate_pct: ">= 60 (표본 축적 후)"
|
||||
false_distribution_rate_pct: "<= 35"
|
||||
|
||||
effectiveness_tracking:
|
||||
formula_id: DISTRIBUTION_BLOCK_EFFECTIVENESS_V1
|
||||
rationale: "weighted_sum>=4 차단이 실제로 손실을 회피했는지(차단 종목의 T+5 수익률)를 측정해야 임계값을 데이터로 보정 가능"
|
||||
implementation:
|
||||
- step: 1
|
||||
desc: "weighted_sum>=4로 BUY 차단된 종목 리스트와 차단일 기록"
|
||||
- step: 2
|
||||
desc: "차단 후 T+5 가상 수익률(차단 안 했다면) 계산. 음(-)이면 차단 정당(avoided_loss)"
|
||||
- step: 3
|
||||
desc: "avoided_loss_rate = 음수 비율. 목표 >= 60%(차단의 60% 이상이 실제 손실 회피)"
|
||||
- step: 4
|
||||
desc: "60% 미만이면 임계값(4.0) 조정 후보 제시(자동 적용 금지, 권고만)"
|
||||
metrics:
|
||||
avoided_loss_rate:
|
||||
current: null
|
||||
target: ">= 0.60"
|
||||
label: "[UNVALIDATED_LOW_N: 표본 미달]"
|
||||
source: Temp/distribution_block_effectiveness_v1.json.avoided_loss_rate
|
||||
blocked_sample_count:
|
||||
current: 0
|
||||
target: ">= 30"
|
||||
output:
|
||||
- Temp/distribution_block_effectiveness_v1.json.avoided_loss_rate
|
||||
python_tool: tools/build_distribution_exit_presignal_v2.py
|
||||
gs_coverage: "gas_apex_alpha_watch.gs:trackDistributionBlockEffectiveness_()"
|
||||
validator: "tools/validate_distribution_exit_presignal_v2.py"
|
||||
acceptance: "avoided_loss_rate >= 0.60 OR [UNVALIDATED_LOW_N] 라벨 부착"
|
||||
|
||||
llm_prohibition:
|
||||
- "LLM이 distribution_verdict를 재판단하거나 번복하는 것을 금지"
|
||||
- "CONFIRMED BUY 권고 금지"
|
||||
- "avoided_loss_rate 미산출 상태에서 임계값(4.0) 자동 조정 금지"
|
||||
Reference in New Issue
Block a user