import json
import os

results_dir = "/home/aryy/.hermes/profiles/finance/backtests/xauusd_2026/hybrid/reviews/manual_replay_results"
os.makedirs(results_dir, exist_ok=True)

res = {
    "batch_id": "batch_005",
    "timestamp": "2026-07-17T11:45:00Z",
    "processed_count": 3,
    "results": [
        {
            "candidate_id": "candidate_2026-01-13T02-00-00Z_long_liquidity_sweep_reversal",
            "timestamp": "2026-01-13T02:00:00Z",
            "decision": "rejected",
            "reason": "M15/M5 lacks structure shift; aggressive selloff continues into 4576 rather than confirming a reversal. No valid OTE entry presented.",
            "htf_context": "H4/H1 bearish momentum overriding early sweep attempts.",
            "m30_structure": "Bearish continuation, breaking 4581.",
            "m15_m5_execution": "No MSS on M5 to support a long setup. Price swept 4576 but failed to displace strongly.",
            "entry": None,
            "stop": None,
            "target": None,
            "r": None,
            "promoted_to_journal": False
        },
        {
            "candidate_id": "candidate_2026-01-13T02-30-00Z_long_liquidity_sweep_reversal",
            "timestamp": "2026-01-13T02:30:00Z",
            "decision": "rejected",
            "reason": "Same context as 02:00 candidate; price continues bleeding lower to 4576 without confirming a reversal shift on M5.",
            "htf_context": "H4/H1 bearish momentum overriding early sweep attempts.",
            "m30_structure": "Bearish continuation.",
            "m15_m5_execution": "No MSS on M5 to support a long setup. Choppy action before further downside.",
            "entry": None,
            "stop": None,
            "target": None,
            "r": None,
            "promoted_to_journal": False
        },
        {
            "candidate_id": "candidate_2026-01-13T05-30-00Z_short_liquidity_sweep_reversal",
            "timestamp": "2026-01-13T05:30:00Z",
            "decision": "shadow",
            "reason": "M15/M5 sweeps local high (4602) and displaces down to 4584, creating FVG. Entry triggers around 08:00 (4592) but TP1 risk/reward not strictly modeled here. Shadow for now.",
            "htf_context": "H4/H1 rejection at 4602 resistance.",
            "m30_structure": "Sweep of 4600 and break down.",
            "m15_m5_execution": "M5 sweeps 4602 at 05:30, displaces down, retraces to 4592. TP1 would hit at 4576, but no explicit mechanical execution details provided to journal.",
            "entry": 4592.00,
            "stop": 4603.00,
            "target": 4576.00,
            "r": 1.45,
            "promoted_to_journal": False
        }
    ]
}

with open(f"{results_dir}/replay_result_00054_00057.json", "w") as f:
    json.dump(res, f, indent=2)

print("Results written.")
