Files
QuantEngineByItz/spec/25_canonical_metrics_registry.yaml
T
kjh2064 366a6da825 WBS-8.7: spec-코드 동기화 100% 완료
모든 spec 파일에 has_code_implementation 메타데이터 추가:
- 140개 spec 파일 중 100% 태깅 완료
- 코드 참조 자동 판정 (formula_registry, decision_flow, routing 등)
- tag_spec_code_implementation.py: 자동화 도구 추가

진행률: 66.4% → 100%

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-06-23 00:22:28 +09:00

337 lines
12 KiB
YAML

code_path: tools/build_canonical_metrics_v1.py
consistency_rules:
enforcement_mode_until: '2026-06-15'
fail_threshold_conflict_count: 1
forbidden_uniform_labels:
- 데이터 누락
- DATA_MISSING
- 중립
- NEUTRAL
- LOSING
- 정상
forbidden_uniform_labels_whitelist_columns:
- 비고
- 해제조건
warn_threshold_conflict_count: 1
evaluation_window_metrics:
prediction_match_rate:
canonical_source: prediction_accuracy_harness_v5.json.prediction_match_rate_pct
consumers:
- release_gate_prediction_quality
current_state:
gap: -10.72
label: '[UNVALIDATED_LIVE: n=0 live samples]'
target: 58.0
value: 47.28
description: 예측 방향 일치율(%) — T+5 기준
fallback_sources:
- algorithm_guidance_proof_v1.json.honest_components.prediction_match_rate
unit: percent
t20_pass_rate:
canonical_source: outcome_quality_score_v1.json.metrics.t20_effective_rate
consumers:
- release_gate_t20_alpha
- operational_report.summary.t20_is_proxy
current_state:
label: T+20(추정,프록시)
proxy_note: '[T20_PROXY: 실측 T+20 표본 0건 — t5_operational_proxy 사용 중]'
t20_effective_rate: 40.92
t20_is_proxy: true
t20_source: t5_operational_proxy
description: T+20 벤치마크 초과수익률 달성 비율(%)
enforcement:
- t20_source != operational_t20 이면 지표명을 'T+20(추정,프록시)'로 강제 라벨링
- T20_PROXY=true 인 동안 t20_pass_rate를 release_gate t20_alpha 합격 근거로 사용 금지
formula_id: EVALUATION_WINDOW_HONESTY_V1
notes: 't20_source=t5_operational_proxy이므로 보고서에서 T+20으로 인용 금지. 실측 T+20 표본 30건
누적 후 t20_source=operational_t20으로 전환. 전환 전까지 release_gate t20_alpha(55%) 판단에
이 값 사용 불가.
'
proxy_detection:
proxy_flag_field: t20_is_proxy
proxy_value: t5_operational_proxy
source_field: outcome_quality_score_v1.json.metrics.t20_source
tolerance_abs: 0.1
unit: percent
formula_id: CANONICAL_METRICS_REGISTRY_V1
has_code_implementation: true
meta:
has_code_implementation: false
metrics:
cash_min_required_krw:
canonical_source: cash_recovery_display_json.min_required_krw
consumers:
- exec_safety_declaration
- cash_recovery_plan_crdl
- single_conclusion
- QEH_AUDIT_BLOCK
description: 현금 최소 필요액(원) — cash_floor 확보를 위한 최소 매도 필요 금액
fallback_sources:
- cash_shortfall_min_krw
- trim_plan_to_min_cash_json.cash_shortfall_min_krw
notes: 'cash_shortfall_json 객체가 None이므로 cash_shortfall_json.cash_shortfall_min_krw
읽기 불가. harness_context 최상위 cash_shortfall_min_krw=39797073이 대안이나, canonical
= cash_recovery_display_json.min_required_krw(39797073).
'
tolerance_abs: 0
unit: krw
cash_reference_total_krw:
canonical_source: trim_plan_to_min_cash_json.total_plan_krw
consumers:
- cash_recovery_plan_crdl
description: 현금확보 전체 후보 누적 금액(원) — 주문 아님, 참고용
fallback_sources:
- cash_recovery_display_json.reference_total_krw
notes: 'cash_recovery_display_json.reference_total_krw=0(미산출). 올바른 원천 = trim_plan_to_min_cash_json.total_plan_krw(227,868,540).
'
tolerance_abs: 0
unit: krw
cluster_pct:
canonical_source: semiconductor_cluster_json.combined_pct
consumers:
- cluster_sync_audit
- portfolio_structure_risks
- mandatory_reduction_plan
description: 반도체 클러스터(삼성전자+SK하이닉스+KODEX반도체) 합산 비중(%)
fallback_sources:
- mandatory_reduction_json.cluster_pct
- cluster_sync_result_json.cluster_pct
notes: 'cluster_sync_result_json.cluster_pct=0 버그가 있음. mandatory_reduction_json.cluster_pct=62.79는
소수점 반올림 차이이므로 tolerance 허용. canonical = semiconductor_cluster_json.combined_pct(62.93).
'
tolerance_abs: 0.05
unit: percent
per_ticker_metrics:
scrs_immediate_qty:
alias_in_data: immediate_qty
canonical_source: scrs_v2_json.selected_combo[ticker].immediate_qty
consumers:
- scrs_v2_sell_table
description: SCRS-V2 즉시 매도 수량(주)
notes: '렌더러가 immediate_sell_qty를 찾지만 데이터에는 immediate_qty가 있음. AGENTS.md 5b: "immediate_sell_qty는
''-'' 출력 금지 (키 불일치)" 명시 위반.
'
wrong_alias_in_renderer: immediate_sell_qty
scrs_rebound_qty:
alias_in_data: rebound_wait_qty
canonical_source: scrs_v2_json.selected_combo[ticker].rebound_wait_qty
consumers:
- scrs_v2_sell_table
description: SCRS-V2 반등 대기 수량(주)
ticker_base_qty:
canonical_source: sell_quantities_json[ticker].sell_qty
consumers:
- shadow_ledger_table
description: 종목별 기준 매도 수량(주)
fallback_sources:
- comprehensive_proposal_json[ticker].quantity
notes: 'shadow_ledger_json의 base_qty_calc=None. sell_quantities_json[].sell_qty
또는 comprehensive_proposal_json[].quantity 사용.
'
ticker_limit_price:
canonical_source: proposal_reference_json[ticker].proposed_limit_price_krw
consumers:
- shadow_ledger_table
description: 종목별 산출 지정가(원) — 차단 종목 포함 전체 표시(H10)
fallback_sources:
- prices_json[ticker].stop_price
notes: 'AGENTS.md H10: 차단 종목도 산출 지표 은폐 금지. proposal_reference_json에 proposed_limit_price_krw가
있으면 사용, 없으면 prices_json.stop_price를 참고방어가로 표시.
'
ticker_profit_pct:
alias_in_renderer_correct: profit_pct
alias_in_renderer_wrong: unrealized_pnl_pct
canonical_source: prices_json[ticker].profit_pct
consumers:
- profit_preservation_table
description: 종목별 미실현 손익률(%)
notes: 'profit_preservation_json[].unrealized_pnl_pct=None. 올바른 원천 = prices_json[].profit_pct.
'
ticker_stop_price:
canonical_source: prices_json[ticker].stop_price
consumers:
- shadow_ledger_table
- profit_preservation_table
description: 종목별 손절가(원)
notes: shadow_ledger_json의 stop_loss_calc=None이므로 prices_json 직접 사용.
ticker_tp1_price:
canonical_source: prices_json[ticker].tp1_price
consumers:
- shadow_ledger_table
description: 종목별 1차 익절가(원)
v11_contradiction_metrics:
cash_immediately_raisable_krw:
canonical_source: cash_recovery_optimizer_v4.json.cash_shortfall_min_krw
contradiction_sites:
- section: cash_recovery_plan_crdl
value: 57841575
- section: engine_audit_sell_classification
value: 59399085
description: 즉시 조달 가능 현금(원)
fallback_sources:
- smart_cash_recovery_v8.json.cash_recovered_krw
tolerance_abs: 0
unit: krw
cash_shortfall_target_krw:
canonical_source: cash_recovery_optimizer_v4.json.cash_shortfall_min_krw
contradiction_sites:
- section: executive_brief
value: 38671178
- section: single_conclusion
value: 47769737
description: 현금 목표 부족액(원)
fallback_sources:
- operational_truth_score_v1.json.cash_shortfall_min_krw
tolerance_abs: 0
unit: krw
confidence_cap:
canonical_source: imputed_data_exposure_gate_v2.json.effective_confidence_honest
contradiction_sites:
- note: schema_presence 기반 — 거짓
section: investment_quality_headline
value: 93.0
- note: honest 기반 — canonical
section: engine_audit_imputed_exposure_honest
value: 88.4
description: 신뢰도 캡(0~100) — honest 기준
notes: 88.4가 canonical. 93.0은 schema_presence 기반 거짓 캡이므로 폐기.
tolerance_abs: 0.1
unit: score
final_score:
canonical_source: scores_harness_v1.json.final_score.value
contradiction_sites:
- section: engine_audit_scores
value: 40.5
- note: 재계산값 — canonical 40.5 사용
section: performance_monitoring_dashboard
value: 45.3
description: 종합 전략 점수(0~100)
tolerance_abs: 0.5
unit: score
horizon_cap_mid_pct:
canonical_source: horizon_allocation_guard_v2.json.mid_cap
contradiction_sites:
- section: horizon_allocation_lock_v1
value: 45
- section: engine_audit_routing
value: 50
description: 중기 호라이즌 비중 상한(%)
tolerance_abs: 1.0
unit: percent
horizon_cap_short_pct:
canonical_source: horizon_allocation_guard_v2.json.short_cap
description: 단기 호라이즌 비중 상한(%)
fallback_sources:
- spec/strategy/horizon_allocation_v1.yaml.rules.HA002.condition
notes: 엔진 감사 short_cap=40%, horizon_routing_lock short_threshold=40%
tolerance_abs: 1.0
unit: percent
mid_horizon_pct:
canonical_source: horizon_classification_v1.json.allocation_pct.MID
description: 중기 호라이즌 비중(%)
tolerance_abs: 0.1
unit: percent
operational_truth_score:
canonical_source: operational_truth_score_v1.json.score_0_100
contradiction_sites:
- section: operational_truth_score_section
value: 80.86
- note: 재계산값 — canonical 80.86 사용
section: performance_monitoring_dashboard
value: 89.12
description: 운영 진실 점수(0~100)
tolerance_abs: 0.1
unit: score
performance_readiness_score:
canonical_source: operational_truth_score_v1.json.performance_readiness_score
contradiction_sites:
- section: operational_truth_score_section
value: 37.2
- note: 50은 비활성 기본값 — canonical 37.2 사용
section: performance_monitoring_dashboard
value: 50.0
description: 성과 준비도 점수(0~100)
tolerance_abs: 0.1
unit: score
position_weight_pct:
canonical_source: portfolio_exposure_v1.json[ticker].weight_pct
contradiction_sites:
- samsung: 44.5
section: portfolio_risk_panel
- samsung: 44.35
section: ejce
- samsung: 45.5
section: executive
description: 종목별 포트폴리오 비중(%)
fallback_sources:
- prices_json[ticker].position_weight_pct
per_ticker: true
tolerance_abs: 0.1
unit: percent
short_horizon_pct:
canonical_source: horizon_classification_v1.json.allocation_pct.SHORT
contradiction_sites:
- section: horizon_allocation_lock_v1
value: 14.3
- note: 보유종목 SHORT비중과 전략노출 혼동
section: performance_monitoring_dashboard
value: 71.4
description: 단기 호라이즌 비중(%)
tolerance_abs: 0.1
unit: percent
t5_match_rate_pct:
canonical_source: prediction_accuracy_harness_v5.json.prediction_match_rate_pct
contradiction_sites:
- note: 전체 이력 기준
section: outcome_eval_window_monitor
value: 35.69
- note: decisive 케이스만 — 혼용 금지
section: performance_monitoring_dashboard
value: 73.24
description: T+5 예측 방향 일치율(%)
fallback_sources:
- outcome_quality_score_v1.json.metrics.t5_operational_pass_rate
notes: canonical = prediction_accuracy_harness_v5.prediction_match_rate_pct(47.28).
표본 정의 혼용 금지.
tolerance_abs: 0.5
unit: percent
unrealized_return_pct:
canonical_source: prices_json[ticker].profit_pct
contradiction_sites:
- samsung: 98.0
section: position_dashboard
- samsung: 96.44
section: profit_preservation_table
- samsung: 96.4
section: decision_trace
description: 종목별 미실현 수익률(%)
per_ticker: true
tolerance_abs: 0.1
unit: percent
value_damage_pct:
canonical_source: smart_cash_recovery_v8.json.raw_value_damage_pct_avg
contradiction_sites:
- correct_value: 15.7
section: final_execution_decision
wrong_value: 0.0
- correct_value: 15.7
section: cash_recovery_plan_crdl
wrong_value: 0.0
description: 현금확보 매도의 가치훼손율(%) — raw 기준
fallback_sources:
- smart_cash_recovery_v7.json.raw_value_damage_pct_avg
- smart_cash_recovery_v9.json.raw_value_damage_pct_avg
notes: raw=15.7%가 canonical. adjusted=0.0 단독 표기는 RAW_VS_ADJUSTED_DISCLOSURE_V1
위반.
tolerance_abs: 0.1
unit: percent
version: '2026-05-29'