Files
QuantEngineByItz/runtime/gas_migration_wave1.yaml
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

282 lines
8.9 KiB
YAML

schema_version: gas_migration_wave1.v1
generated_at: '2026-06-10'
playbook_ref: suggest/quant_engine_refactor_playbook_v1.yaml#P5-T01
total_findings: 103
wave: 1
wave_size: 25
remaining_waves: 4
wave1_status: IN_PROGRESS
classification_guide:
ADAPTER_OK: GAS reads Python-computed value and passes to sheet/next step. No business logic.
MIGRATE_TO_PYTHON: GAS computes a score/decision that should live in Python.
DELETE_DUPLICATE: Logic already exists in Python; GAS version is redundant.
COMMENT_FALSE_POSITIVE: Comment or doc line flagged by keyword match, not actual logic.
wave1_items:
- idx: 0
file: gas_apex_alpha_watch.gs
line: 174
text: "macro_risk_score: score,"
classification: ADAPTER_OK
rationale: Assembling output object from Python-provided score, not computing it.
python_path: null
formula_id: null
- idx: 1
file: gas_apex_alpha_watch.gs
line: 223
text: "var totalScore = mesResult.macro_risk_score || 0;"
classification: ADAPTER_OK
rationale: Reading macro_risk_score from Python MES result JSON.
python_path: null
formula_id: null
- idx: 2
file: gas_apex_runtime_core.gs
line: 34
text: "hApex.macro_risk_score = mesResult.macro_risk_score;"
classification: ADAPTER_OK
rationale: Passing Python result field through to apex harness struct.
python_path: null
formula_id: null
- idx: 3
file: gas_apex_runtime_core.gs
line: 103
text: "// macro_risk_score (max 100)"
classification: COMMENT_FALSE_POSITIVE
rationale: Comment line describing the field; contains keyword but no logic.
python_path: null
formula_id: null
- idx: 4
file: gas_apex_runtime_core.gs
line: 153
text: "macro_risk_score: macroRiskScore,"
classification: ADAPTER_OK
rationale: Assembling output packet with Python-derived score.
python_path: null
formula_id: null
- idx: 5
file: gas_apex_runtime_core.gs
line: 185
text: "var macroRiskScore = toNumber_(mes.macro_risk_score) || 0;"
classification: ADAPTER_OK
rationale: Reads Python result; toNumber_ is a type coercion helper, not business logic.
python_path: null
formula_id: null
- idx: 6
file: gas_apex_runtime_core.gs
line: 237
text: "micro_risk_score: l1,"
classification: ADAPTER_OK
rationale: Assembling risk level packet from Python-provided values.
python_path: null
formula_id: null
- idx: 7
file: gas_apex_runtime_core.gs
line: 238
text: "macro_risk_score_normalized: l2,"
classification: ADAPTER_OK
rationale: Assembling risk level packet; normalized value from Python.
python_path: null
formula_id: null
- idx: 8
file: gas_apex_runtime_core.gs
line: 239
text: "global_risk_score: l3,"
classification: ADAPTER_OK
rationale: Assembling risk level packet from Python-provided values.
python_path: null
formula_id: null
- idx: 9
file: gas_apex_runtime_core.gs
line: 240
text: "event_risk_score: l4,"
classification: ADAPTER_OK
rationale: Assembling risk level packet from Python-provided values.
python_path: null
formula_id: null
- idx: 10
file: gas_data_collect.gs
line: 1038
text: "Number.isFinite(alpha[\"late_chase_risk_score\"]) ? alpha[\"late_chase_risk_score\"]"
classification: ADAPTER_OK
rationale: Reading late_chase_risk_score from Python alpha JSON; conditional is null-guard.
python_path: null
formula_id: null
- idx: 11
file: gas_data_collect.gs
line: 1068
text: '"Volume_Ratio_5D","Flow_Credit","RSI14_At_Entry","Late_Chase_Risk_Score"'
classification: ADAPTER_OK
rationale: Column name list for sheet header; no computation.
python_path: null
formula_id: null
- idx: 12
file: gas_data_collect.gs
line: 1069
text: '"Breakout_Score","Rebound_Preservation_Score","Setup_Decision","Exit_Reason"'
classification: ADAPTER_OK
rationale: Column name list for sheet header; no computation.
python_path: null
formula_id: null
- idx: 13
file: gas_data_collect.gs
line: 2016
text: "// TAKE_PROFIT_LADDER_V1"
classification: COMMENT_FALSE_POSITIVE
rationale: Comment referencing a spec item; no code logic.
python_path: null
formula_id: null
- idx: 14
file: gas_data_collect.gs
line: 2036
text: '"Final_Action","Action_Priority","Priority_Score","Final_Rank","Decision_Source"'
classification: ADAPTER_OK
rationale: Column name list for sheet header; no computation.
python_path: null
formula_id: null
- idx: 15
file: gas_data_collect.gs
line: 2704
text: "// entry sizing, breakout/anti-climax/leader/RW gates,"
classification: COMMENT_FALSE_POSITIVE
rationale: Documentation comment describing Python-computed fields to be collected.
python_path: null
formula_id: null
- idx: 16
file: gas_data_collect.gs
line: 2894
text: "// TAKE_PROFIT_LADDER_V1"
classification: COMMENT_FALSE_POSITIVE
rationale: Section comment; no logic.
python_path: null
formula_id: null
- idx: 17
file: gas_data_collect.gs
line: 2986
text: "// Decision: F1-F3 timing, sell decision, allowed/final action"
classification: COMMENT_FALSE_POSITIVE
rationale: Section comment; no logic.
python_path: null
formula_id: null
- idx: 18
file: gas_data_collect.gs
line: 3178
text: '"TAKE_PROFIT_TIER1":"TP1 description"'
classification: ADAPTER_OK
rationale: Label map for sheet display; references a Python decision value, not computing it.
python_path: null
formula_id: null
- idx: 19
file: gas_data_collect.gs
line: 3502
text: '"Candidate_Quality_Grade","T1_Forced_Sell_Risk_Score"'
classification: ADAPTER_OK
rationale: Column name list; no computation.
python_path: null
formula_id: null
- idx: 20
file: gas_data_collect.gs
line: 3602
text: "lateChaseRiskScore: sellRow_ ? sellRow_[\"Late_Chase_Risk_Score\"] : \"\","
classification: ADAPTER_OK
rationale: Reading Python-computed Late_Chase_Risk_Score from sheet row; null-safe read.
python_path: null
formula_id: null
- idx: 21
file: gas_data_collect.gs
line: 3603
text: "distributionRiskScore: sellRow_ ? sellRow_[\"Distribution_Risk_Score\"] : \"\","
classification: ADAPTER_OK
rationale: Reading Python-computed Distribution_Risk_Score from sheet row; null-safe read.
python_path: null
formula_id: null
- idx: 22
file: gas_data_collect.gs
line: 3746
text: '"Candidate_Quality_Grade","T1_Forced_Sell_Risk_Score"'
classification: ADAPTER_OK
rationale: Column name list; no computation.
python_path: null
formula_id: null
- idx: 23
file: gas_data_feed.gs
line: 186
text: "SP_TAKE_PROFIT: 10, // Profit_Pct >= 10%"
classification: MIGRATE_TO_PYTHON
rationale: Threshold constant defined in GAS; should be in spec/calibration_registry.yaml.
python_path: spec/calibration_registry.yaml
formula_id: TAKE_PROFIT_LADDER_V2
migration_action: Add to calibration_registry.yaml as threshold id=SP_TAKE_PROFIT value=10 source=SPEC_DERIVED.
- idx: 24
file: gas_data_feed.gs
line: 559
text: "// sell_signal_priority level 2: REGIME_RISK_OFF (spec/exit/stop_loss.yaml)"
classification: COMMENT_FALSE_POSITIVE
rationale: Comment citing spec file; no business logic.
python_path: null
formula_id: null
wave2_preview:
- idx: 25
file: gas_data_feed.gs
line: 656
tentative_classification: MIGRATE_TO_PYTHON
text: "priceBasis = TAKE_PROFIT_TIER2_PRICE fallback"
- idx: 55
file: gas_data_feed.gs
line: 6688
tentative_classification: DELETE_DUPLICATE
text: "distribution_risk_score = Math.min(100, Math.max(0, score))"
- idx: 57
file: gas_data_feed.gs
line: 6774
tentative_classification: DELETE_DUPLICATE
text: "late_chase_risk_score = Math.min(100, Math.max(0, Math.round(lateChaseRisk)))"
wave1_summary:
ADAPTER_OK: 17
COMMENT_FALSE_POSITIVE: 7
MIGRATE_TO_PYTHON: 1
DELETE_DUPLICATE: 0
total_wave1: 25
wave1_action_items:
- id: SP_TAKE_PROFIT_SPEC_MIGRATION
type: SPEC_REGISTRATION
file: spec/calibration_registry.yaml
action: Register SP_TAKE_PROFIT=10 as threshold_id with source=SPEC_DERIVED, owner_formula=TAKE_PROFIT_LADDER_V2
status: TODO
remaining_findings_classification:
note: Wave 2-4 will address the remaining 78 findings
high_priority:
- gas_data_feed L6688 distribution_risk_score computation (DELETE_DUPLICATE - Python has DISTRIBUTION_RISK_SCORE_V1)
- gas_data_feed L6774 late_chase_risk_score computation (DELETE_DUPLICATE - Python has late_chase_risk_score formula)
- gas_data_feed L1577 score += THRESHOLDS["SP_TAKE_PROFIT"] (MIGRATE_TO_PYTHON - threshold scoring)
- gas_data_feed L656-683 priceBasis fallback logic (MIGRATE_TO_PYTHON - price determination)
- gas_data_feed L5920 STOP_LOSS decision (DELETE_DUPLICATE - Python has stop_loss logic)