refactor: GT·시뮬·운영 3축 정리 및 hybrid 실거래 정합

Phase C/dry-run·미사용 모듈·재생성 HTML을 제거하고, 운영 체결을
sim_causal_hybrid와 동일한 hybrid 로직으로 통합한다.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
xavis
2026-06-03 23:50:28 +09:00
parent a16c942be4
commit d7848df6f7
85 changed files with 177180 additions and 196131 deletions

View File

@@ -1,6 +0,0 @@
# analysis — 03·03b 기술적 분석
- **03 enrich**: `general_analysis_enrich_runner.py` — 봉 전구간 지표·패턴 → `docs/03_analysis/latest/`
- **03b GT 스냅샷**: `general_analysis_runner.py` — 정답 매수·매도 시점 MTF 상태 → `general_analysis_trades.csv`
실행은 `scripts/03_analyze_enrich.py`, `scripts/03_analyze_trades.py`만 사용합니다.

View File

@@ -140,7 +140,7 @@ def main() -> None:
flat_vote.update(general_analysis_mtf_scores(prefixed))
write_capability_html(summaries, flat_vote, ANALYSIS_CAPABILITY_HTML)
print(f"점검 리포트: {cap_path}")
print(f"점검 리포트: {ANALYSIS_CAPABILITY_HTML}")
print("완료.")

View File

@@ -45,7 +45,9 @@ def build_trade_mtf_snapshots(
n_trades = len(trades)
enriched: dict[int, pd.DataFrame] = {}
t0 = time.time()
print(f"[03b] Phase A: 8TF enrich (1분봉 제외, 전 기법) — {len(GENERAL_ANALYSIS_INTERVALS)}개 간격")
print(
f"[03b] MTF enrich (주·월봉 포함) — {len(GENERAL_ANALYSIS_INTERVALS)}개 간격"
)
sys.stdout.flush()
for step, iv in enumerate(GENERAL_ANALYSIS_INTERVALS, start=1):
raw = frames.get(iv)
@@ -104,46 +106,6 @@ def build_trade_mtf_snapshots(
return pd.DataFrame(rows)
def append_missing_gt_snapshots(
frames: dict[int, pd.DataFrame],
trades_path: Path | str = DEFAULT_TRADES_FILE,
output_csv: Path | str = DEFAULT_OUTPUT_CSV,
) -> int:
"""
CSV에 없는 GT 타점만 MTF 스냅샷 추가.
Args:
frames: interval → OHLCV.
trades_path: ground_truth JSON.
output_csv: 03b CSV.
Returns:
추가된 행 수.
"""
out = Path(output_csv)
if not out.is_file():
return 0
data = load_ground_truth(Path(trades_path))
if not data:
return 0
trades = data.get("trades") or []
existing = pd.read_csv(out)
have = set(zip(existing["dt"].astype(str), existing["action"].astype(str)))
missing = [
t
for t in trades
if (str(t["dt"]), str(t["action"])) not in have
]
if not missing:
return 0
print(f"[03b] 누락 GT 타점 {len(missing)}건 스냅샷 추가")
add_df = build_trade_mtf_snapshots(frames, missing)
merged = pd.concat([existing, add_df], ignore_index=True)
merged.to_csv(out, index=False, encoding="utf-8-sig")
print(f"[03b] CSV 갱신: {out} ({len(merged)}행)")
return len(missing)
def export_trade_snapshots(
frames: dict[int, pd.DataFrame],
trades_path: Path | str = DEFAULT_TRADES_FILE,