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:
2026-06-13 13:20:14 +09:00
commit ee3e799de1
1474 changed files with 176087 additions and 0 deletions
@@ -0,0 +1,23 @@
{
"formula_id": "ALPHA_LEAD_THRESHOLD_OPTIMIZER_V3",
"gate": "PASS",
"prediction_match_rate_pct": 54.76,
"t5_direction_accuracy_pct": 54.76,
"late_chase_false_positive_rate": 20.0,
"buy_after_5d_runup_without_pullback_count": 0,
"threshold_ledger": [
{
"threshold": 75,
"pullback_quality": 60,
"distribution_score": 2.0,
"action": "PILOT_ALLOWED"
},
{
"threshold": 65,
"pullback_quality": 50,
"distribution_score": 1.5,
"action": "CANDIDATE_ONLY"
}
],
"generated_at": "2026-06-03T09:08:54.180836+00:00"
}
@@ -0,0 +1,33 @@
{
"formula_id": "ANTI_LATE_ENTRY_PULLBACK_GATE_V4",
"gate": "WATCH",
"late_chase_buy_violations": 0,
"late_chase_false_positive_rate": 33.65,
"buy_after_5d_runup_without_pullback_count": 0,
"pullback_quality_required_for_buy": 60,
"distribution_score_for_buy": 1.5,
"prediction_match_rate_pct": 54.76,
"t5_direction_accuracy_pct": 54.76,
"late_chase_operational_samples": 263,
"late_chase_gate_hit_miss_rate_published": true,
"threshold_ledger": [
{
"threshold": 75,
"pullback_quality": 60,
"distribution_score": 2.0,
"action": "PILOT_ALLOWED"
},
{
"threshold": 65,
"pullback_quality": 50,
"distribution_score": 1.5,
"action": "CANDIDATE_ONLY"
}
],
"supporting_artifacts": [
"Temp/alpha_lead_threshold_optimizer_v3.json",
"Temp/buy_anti_late_entry_lock_v1.json",
"Temp/late_chase_attribution_v1.json"
],
"generated_at": "2026-06-03T15:58:27.382232+00:00"
}
@@ -0,0 +1,24 @@
{
"formula_id": "CANONICAL_METRICS_V4",
"generated_at": "2026-05-31T23:23:43+09:00",
"builder_version": "v5.todo.batch",
"canonical_metrics": [
{
"metric_id": "global_execution_gate",
"canonical_json_path": "Temp/final_execution_decision_v3.json",
"value": "AUDIT_ONLY"
},
{
"metric_id": "schema_presence_score",
"canonical_json_path": "Temp/data_integrity_100_lock_v5.json",
"value": 95.5
},
{
"metric_id": "pass_100_gate",
"canonical_json_path": "Temp/pass_100_criteria_v1.json",
"value": "BLOCK_EXECUTION"
}
],
"authority_collision_count": 0,
"stale_artifact_count": 0
}
@@ -0,0 +1,8 @@
{
"formula_id": "DISTRIBUTION_RISK_SCORE_V4",
"generated_at": "2026-05-31T23:23:43+09:00",
"builder_version": "v5.todo.batch",
"distribution_risk_coverage_pct": 100.0,
"false_chase_entry_rate_max_pct": 20.0,
"high_risk_count": 0
}
@@ -0,0 +1,36 @@
{
"formula_id": "FINAL_EXECUTION_DECISION_V4",
"global_execution_gate": "AUDIT_ONLY",
"buy_allowed": false,
"sell_allowed": false,
"hts_order_count": 0,
"child_engine_internal_allowed": true,
"child_execution_state": "THEORETICAL_ONLY",
"precedence_note": "child_engine_internal_allowed=True는 현금회복 계산이 내부적으로 허용됨을 의미한다. HTS 주문 실행은 global_execution_gate==HTS_READY일 때만 허용된다.",
"reason_codes": [
"TRUTH_GATE=BLOCK_EXECUTION",
"TRUTH_SCORE=70.00",
"READINESS_GATE=WATCH_PENDING_SAMPLE",
"EXECUTION_READINESS_MATRIX=BLOCK_EXECUTION:0.00"
],
"llm_allowed_actions": [
"AUDIT_ONLY",
"RENDER_LEDGER_ONLY",
"SHADOW_LEDGER_ONLY"
],
"decision_basis": {
"truth_gate": "BLOCK_EXECUTION",
"truth_score_0_100": 70.0,
"final_judgment_gate": "PASS",
"final_judgment_coverage_pct": 100.0,
"smart_cash_recovery_status": "PASS",
"smart_cash_recovery_child_engine_internal_allowed": true,
"smart_cash_recovery_value_damage_pct": 0.0,
"readiness_gate": "WATCH_PENDING_SAMPLE",
"execution_readiness_matrix_gate": "BLOCK_EXECUTION",
"execution_readiness_min_axis_score": 0.0,
"hts_candidate_rows": 0
},
"generated_at": "2026-06-06T11:52:58.416423+00:00",
"input_hash": "8af12b88c7f8b3d3803cf447d309394aa83ddd3576f9427282992cb9e9e757d9"
}
@@ -0,0 +1,180 @@
{
"formula_id": "PASS_100_CRITERIA_V3",
"is_active": true,
"authority_note": "유일한 active PASS_100 기준. v1/v2는 legacy_reference_only.",
"legacy_files": [
"pass_100_criteria_v2.json"
],
"gate": "BLOCK_EXECUTION",
"pass_100_allowed": false,
"score_0_100": 46.15,
"passed_count": 6,
"failed_count": 7,
"failed_criteria": [
"RELEASE_GATE_TRUTH_V1",
"OPERATIONAL_TRUTH_SCORE_100",
"EXECUTION_TRUTH_SCORE_100",
"PERFORMANCE_READINESS_GE_90",
"FINAL_EXECUTION_HTS_READY",
"HTS_ORDER_COUNT_GT_0",
"EXECUTION_READINESS_MATRIX_PASS_100"
],
"criteria": [
{
"criterion_id": "RELEASE_GATE_TRUTH_V1",
"actual": {
"honest_proof_score": 56.57,
"honest_gate": "FAIL",
"cosmetic_gate": "FAIL",
"effective_release_gate": "FAIL"
},
"target": "honest_proof_score >= 70.0 AND honest_gate == PASS",
"passed": false,
"source_json": "algorithm_guidance_proof_v1.json",
"formula_id": "RELEASE_GATE_TRUTH_V1",
"remediation": "honest_proof_score < 70 → T+20 표본 30건 축적 후 자동 해소 (~2026-07)",
"remediation_type": "DATA_GATED",
"data_gated_until": "2026-07-15"
},
{
"criterion_id": "SCHEMA_PRESENCE_100",
"actual": 100.0,
"target": "== 100",
"passed": true,
"source_json": "data_quality_reconciliation_v1.json",
"formula_id": "DATA_QUALITY_RECONCILIATION_V1",
"remediation": "NONE",
"remediation_type": "NONE"
},
{
"criterion_id": "FORMULA_RUNTIME_COVERAGE_100",
"actual": 100.0,
"target": "== 100",
"passed": true,
"source_json": "strategy_hardening_harness_v2.json",
"formula_id": "STRATEGY_HARDENING_HARNESS_V2",
"remediation": "NONE",
"remediation_type": "NONE"
},
{
"criterion_id": "CONFIDENCE_CAP_BASIS_GE_90",
"actual": 100.0,
"target": ">= 90",
"passed": true,
"source_json": "data_quality_reconciliation_v1.json",
"formula_id": "DATA_QUALITY_RECONCILIATION_V1",
"remediation": "NONE",
"remediation_type": "NONE"
},
{
"criterion_id": "SINGLE_TRUTH_NO_CONFLICT",
"actual": 0,
"target": "== 0",
"passed": true,
"source_json": "single_truth_ledger_v2.json",
"formula_id": "SINGLE_TRUTH_LEDGER_V2",
"remediation": "NONE",
"remediation_type": "NONE"
},
{
"criterion_id": "OPERATIONAL_TRUTH_SCORE_100",
"actual": 70.0,
"target": "== 100 and gate PASS_100",
"passed": false,
"source_json": "operational_truth_score_v1.json",
"formula_id": "OPERATIONAL_TRUTH_SCORE_V1",
"remediation": "export_gate 해소(HTS 캡처) + performance_readiness 해소 필요",
"remediation_type": "DATA_GATED",
"data_gated_until": "2026-07-15"
},
{
"criterion_id": "EXECUTION_TRUTH_SCORE_100",
"actual": 0.0,
"target": "== 100",
"passed": false,
"source_json": "operational_truth_score_v1.json",
"formula_id": "OPERATIONAL_TRUTH_SCORE_V1",
"remediation": "HTS 캡처 → export_gate PASS → execution_truth 자동 해소",
"remediation_type": "OPERATIONAL_ACTION"
},
{
"criterion_id": "PERFORMANCE_READINESS_GE_90",
"actual": 50.0,
"target": ">= 90 and readiness_gate PERFORMANCE_READY",
"passed": false,
"source_json": "operational_truth_score_v1.json",
"formula_id": "OPERATIONAL_TRUTH_SCORE_V1",
"remediation": "T+20 운영 표본 30건 필요 — 매일 자동 축적 (~2026-07-05~07-15)",
"remediation_type": "DATA_GATED",
"data_gated_until": "2026-07-15"
},
{
"criterion_id": "SMART_CASH_VALUE_DAMAGE_LE_10",
"actual": {
"value_damage_adj": 0.0,
"value_damage_raw": 0.0,
"source": "smart_cash_recovery_v7.json"
},
"target": "<= 10 (adj and raw)",
"passed": true,
"source_json": "smart_cash_recovery_v7.json",
"formula_id": "SMART_CASH_RECOVERY_V7",
"remediation": "NONE",
"remediation_type": "NONE"
},
{
"criterion_id": "SMART_CASH_EXECUTION_ALLOWED",
"actual": true,
"target": "is true and status PASS",
"passed": true,
"source_json": "smart_cash_recovery_v7.json",
"formula_id": "SMART_CASH_RECOVERY_V7",
"remediation": "NONE",
"remediation_type": "NONE"
},
{
"criterion_id": "FINAL_EXECUTION_HTS_READY",
"actual": "AUDIT_ONLY",
"target": "HTS_READY",
"passed": false,
"source_json": "final_execution_decision_v2.json",
"formula_id": "FINAL_EXECUTION_DECISION_V2",
"remediation": "PERFORMANCE_READINESS_GE_90 해소 후 자동 연쇄 해소 (~2026-07-15)",
"remediation_type": "DATA_GATED",
"data_gated_until": "2026-07-15"
},
{
"criterion_id": "HTS_ORDER_COUNT_GT_0",
"actual": 0,
"target": "> 0",
"passed": false,
"source_json": "final_execution_decision_v2.json",
"formula_id": "FINAL_EXECUTION_DECISION_V2",
"remediation": "FINAL_EXECUTION_HTS_READY 해소 후 자동 연쇄 해소 (~2026-07-15)",
"remediation_type": "DATA_GATED",
"data_gated_until": "2026-07-15"
},
{
"criterion_id": "EXECUTION_READINESS_MATRIX_PASS_100",
"actual": {
"gate": "BLOCK_EXECUTION",
"min_axis_score": 0.0
},
"target": "gate PASS_100 and min_axis_score 100",
"passed": false,
"source_json": "execution_readiness_matrix_v1.json",
"formula_id": "EXECUTION_READINESS_MATRIX_V1",
"remediation": "HTS 캡처(OPERATIONAL_ACTION) + T+20 표본 축적(DATA_GATED) 후 자동 해소",
"remediation_type": "OPERATIONAL_ACTION"
}
],
"effective_release_gate": "FAIL",
"release_gate_note": "[RELEASE_BLOCKED_BY_TRUTH_GATE: honest=56.57 < 70]",
"hts_order_mode": "THEORETICAL_ONLY",
"targets": {
"completion_definition": "PASS_100 only when every criterion passed",
"hts_execution_definition": "HTS execution forbidden unless FINAL_EXECUTION_HTS_READY and HTS_ORDER_COUNT_GT_0 pass",
"llm_role": "copy criteria and render ledgers only; no ad-hoc numeric overrides",
"release_gate_truth_definition": "effective_release_gate = AND(cosmetic_gate, honest_gate); honest_proof_score < 70 → THEORETICAL_ONLY"
}
}
@@ -0,0 +1,20 @@
{
"formula_id": "PREDICTION_ACCURACY_HARNESS_V5",
"generated_at": "2026-06-03T00:00:00+09:00",
"builder_version": "v5.todo.batch.p0-3",
"t20_operational_sample": 0,
"t20_operational_accuracy_pct": null,
"performance_readiness_score": 50.0,
"prediction_match_rate_pct": 47.28,
"operational_t5_sample_count": 0,
"operational_t20_sample_count": 0,
"data_origin_audit": {
"operational_sample_count": 0,
"replay_sample_count": 804,
"untagged_row_count": 0,
"unrealized_outcome_row_count": 0,
"replay_in_live_stats": 0,
"operational_only_accuracy": true,
"untagged_label": "INSUFFICIENT_OP_SAMPLES(n=0)"
}
}
@@ -0,0 +1,37 @@
{
"formula_id": "VALUE_PRESERVING_CASH_RAISE_V9",
"generated_at": "2026-06-03T13:32:06.415328+00:00",
"cash_shortfall_min_krw": 36092555.0,
"raw_value_damage_pct_avg": 15.7,
"adjusted_value_damage_pct_avg": 0.0,
"value_damage_gate_input": 15.7,
"rebound_capture_probability": 0.0,
"selected_sell_combo": [
{
"ticker": "064350",
"source": "BREACH_FULL_LIQUIDATION",
"expected_immediate_krw": 57841575
}
],
"liquidation_policy_check": {
"breach_full_liquidation_count": 1,
"breach_violations": [
{
"ticker": "064350",
"issue": "LP002_BREACH_FULL_LIQUIDATION_BAN",
"note": "oversold 또는 brt_verdict!=BROKEN — K2 50/50 적용 필요"
}
],
"k2_split_applied": [],
"single_stock_max_concentration_pct": 100.0,
"value_damage_cap_pass": false,
"rebound_capture_probability": 0.0,
"lp004_blocked": true,
"lp002_blocked": true
},
"gate": "FAIL",
"gate_failures": [
"LP004_VALUE_DAMAGE_CAP_EXCEEDED",
"LP002_BREACH_FULL_LIQUIDATION_DETECTED"
]
}
@@ -0,0 +1,8 @@
{
"formula_id": "SMART_MONEY_LIQUIDITY_EVIDENCE_GATE_V5",
"generated_at": "2026-05-31T23:23:43+09:00",
"builder_version": "v5.todo.batch",
"gate": "OK",
"ticker_count": 11,
"freshness_sla_breaches": 0
}