feat(spot): 2단계 인과 기법 분석 파이프라인 마무리

common/spot/futures 경로 정비, 캔들 데이터 모듈 복원, MTF 규칙 자동 저장 및 2단계 설계·최종 정리 문서를 반영해 3단계 착수 기반을 확정한다.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
xavis
2026-06-12 16:09:32 +09:00
parent 741c949470
commit 2d515dd669
18 changed files with 2073 additions and 335 deletions

View File

@@ -18,7 +18,10 @@ from deepcoin.config import load_settings
from deepcoin.data.candle_loader import load_candles
from deepcoin.data.intervals import interval_label
from deepcoin.evaluation.causal_sim import (
best_technique_chart_path,
build_causal_sim_report,
pick_best_technique_row,
render_best_technique_comparison_chart,
render_causal_sim_html,
render_technique_sim_chart,
run_technique_causal_sim,
@@ -145,6 +148,30 @@ def main() -> int:
json_path = save_causal_sim_report(report, settings.causal_sim_report_json)
html_path = render_causal_sim_html(report, settings.causal_sim_report_html)
best_row = pick_best_technique_row(report)
if best_row:
best_result = next(
(r for r in results if r.technique_id == best_row["technique_id"]),
None,
)
if best_result is not None:
best_chart = best_technique_chart_path(analysis_dir)
render_best_technique_comparison_chart(
db_path=settings.db_path,
symbol=settings.symbol,
gt_result=gt_result,
result=best_result,
sim_pnl=sim_pnls[best_result.technique_id],
output_path=best_chart,
chart_lookback_days=settings.download_days,
)
print(
f"1단계 v3 대조 차트: {best_chart} "
f"({best_result.technique_name}, "
f"{sim_pnls[best_result.technique_id].get('total_return_pct', 0):+.2f}%)",
flush=True,
)
elapsed = time.monotonic() - t0
print(f"\n=== 2단계 인과 sim 완료 ({elapsed/60:.1f}분) ===", flush=True)
if stage1_sim: