diff --git a/tools/render_operational_report.py b/tools/render_operational_report.py index 2ce6315..0d90de7 100644 --- a/tools/render_operational_report.py +++ b/tools/render_operational_report.py @@ -31,6 +31,8 @@ SECTION_ORDER = [ "watch_release_checklist", "alpha_feedback_loop_report", "backdata_feature_bank_table", "alpha_lead_table", "anti_distribution_table", "profit_preservation_table", "smart_cash_raise_table", "execution_quality_table", + "sell_priority_decision_table", "strategy_performance_scoreboard", + "outcome_eval_window_monitor", "decision_trace_table", "anti_whipsaw_reentry_gate", "proposal_reference_sheet", "satellite_buy_proposal_sheet", "core_satellite_timing_gate_table", "engine_feedback_loop_report", "prediction_evaluation_improvement_report", @@ -75,6 +77,9 @@ SECTION_TITLES = { "profit_preservation_table": "수익 보존 테이블", "smart_cash_raise_table": "현금 확보 테이블", "execution_quality_table": "체결 품질 테이블", + "sell_priority_decision_table": "매도 우선순위 결정 테이블", + "strategy_performance_scoreboard": "전략 성과 스코어보드", + "outcome_eval_window_monitor": "성과 평가 윈도우 모니터", "decision_trace_table": "판단 추적 테이블", "anti_whipsaw_reentry_gate": "반등 재진입 감시 게이트", "proposal_reference_sheet": "제안 참조 시트", @@ -400,6 +405,61 @@ def _qeh_audit_block(hctx: dict, se: list) -> str: return _kv(rows) +def _sell_priority_decision_table(hctx: dict, se: list) -> str: + items = _sj(hctx.get("regime_adjusted_sell_priority_json", [])) + if not isinstance(items, list) or not items: + return _err(se, "sell_priority_decision_table", "regime_adjusted_sell_priority_json 없음") + return (f"_총 {len(items)}종목 | 매도 우선순위 결정 (레짐 조정)_\n\n" + + _tbl(items, ["rank", "ticker", "name", "tier", "original_score", + "trim_style", "regime_priority_adjustment", "adjustment_reason"], max_rows=15)) + + +def _strategy_performance_scoreboard(hctx: dict, se: list) -> str: + rows = [ + ("성과 레이블", hctx.get("performance_label", "")), + ("성과 배수", hctx.get("performance_multiplier", "")), + ("연속 손실 여부", hctx.get("performance_consecutive_losses", "")), + ("30일 승률", hctx.get("performance_win_rate_30") or "DATA_GATED"), + ("30일 순기대값", hctx.get("performance_net_expectancy_30") or "DATA_GATED"), + ("성과 기반 거래", hctx.get("performance_trades_used", "")), + ] + sel = _sj(hctx.get("strategy_execution_locks_v1_json", {})) + if isinstance(sel, dict) and sel: + rows += [ + ("데이터 무결성 점수", sel.get("data_integrity_score", "")), + ("파생 유효성 점수", sel.get("derivation_validity_score", "")), + ("의사결정 증거 게이트", sel.get("decision_evidence_gate", "")), + ("결과 품질 점수", sel.get("outcome_quality_score", "")), + ] + return _kv(rows) + + +def _outcome_eval_window_monitor(hctx: dict, se: list) -> str: + oqs = _sj(hctx.get("outcome_quality_score_v1_json", {})) + shom = _sj(hctx.get("short_horizon_outcome_monitor_v1_json", {})) + aew = _sj(hctx.get("alpha_evaluation_window_json", [])) + rows = [] + if isinstance(oqs, dict) and oqs: + rows += [ + ("결과 품질 점수", oqs.get("score", "")), + ("결과 게이트", oqs.get("gate", "")), + ("평가 근거 플래그", ", ".join(oqs.get("root_cause_flags", []))), + ] + if isinstance(shom, dict) and shom: + m = shom.get("metrics", {}) + rows += [ + ("T+1 평가 건수", m.get("t1_evaluated_count", 0)), + ("T+1 일치율(%)", m.get("t1_match_rate_pct", 0)), + ("T+5 평가 건수", m.get("t5_evaluated_count", 0)), + ("T+5 일치율(%)", m.get("t5_match_rate_pct", 0)), + ] + if isinstance(aew, list) and aew: + rows.append(("평가 윈도우 종목 수", len(aew))) + if not rows: + return _err(se, "outcome_eval_window_monitor", "평가 윈도우 데이터 없음") + return _kv(rows) + + # ── APPENDIX 렌더러 ──────────────────────────────────────────────────────────── def _backdata_feature_bank_table(hctx: dict, se: list) -> str: @@ -803,6 +863,9 @@ def main() -> int: "profit_preservation_table": lambda: _profit_preservation_table(hctx, se), "smart_cash_raise_table": lambda: _smart_cash_raise_table(hctx, se), "execution_quality_table": lambda: _execution_quality_table(hctx, se), + "sell_priority_decision_table": lambda: _sell_priority_decision_table(hctx, se), + "strategy_performance_scoreboard": lambda: _strategy_performance_scoreboard(hctx, se), + "outcome_eval_window_monitor": lambda: _outcome_eval_window_monitor(hctx, se), "decision_trace_table": lambda: _decision_trace_table(hctx, se), "anti_whipsaw_reentry_gate": lambda: _anti_whipsaw_reentry_gate(hctx, se), "proposal_reference_sheet": lambda: _proposal_reference_sheet(hctx, se), @@ -836,6 +899,9 @@ def main() -> int: "markdown": "\n".join(err_rows), }) + _section_names = {s.get("name", "") for s in sections} + _eg = _sj(hctx.get("export_gate_json", {})) + _json_vs = _eg.get("json_validation_status", "PENDING_EXPORT") if isinstance(_eg, dict) else "PENDING_EXPORT" report = { "schema_version": "2026-05-24-operational-report-v1", "generated_at": datetime.now(timezone.utc).isoformat(), @@ -843,6 +909,12 @@ def main() -> int: "section_count": len(sections), "section_error_count": len(se), "section_errors": se, + "summary": { + "found_routing": "routing_serving_trace_v2" in _section_names, + "found_qeh": "QEH_AUDIT_BLOCK" in _section_names, + "found_outcome_eval_window": "outcome_eval_window_monitor" in _section_names, + "json_validation_status": _json_vs, + }, "sections": sections, }