import json

results = [
    {
        "candidate_id": "candidate_2026-06-16T11-15-00Z_long_liquidity_sweep_reversal",
        "timestamp": "2026-06-16T11:15:00Z",
        "decision": "rejected",
        "reason": "H1/H4 structure is strongly bearish since June 11th high at 4369, current M15 push down is continuing downtrend without confirmed HTF sweep",
        "htf_context": "H4 heavily bearish, rejected off 4369 high, consistent lower lows down to 4331 area.",
        "m30_structure": "M15 making lower highs (4354 to 4349) and lower lows (4342 to 4338) into the candidate time. This is a continuation short environment, not a long environment.",
        "m15_m5_execution": "M5 prints a lower low at 4338 at 11:15, but given HTF bearish momentum, attempting to catch a falling knife here without clear M15 CHoCH is dangerous.",
        "entry": None,
        "stop": None,
        "target": None,
        "r": None,
        "promoted_to_journal": False
    },
    {
        "candidate_id": "candidate_2026-06-16T11-30-00Z_long_liquidity_sweep_reversal",
        "timestamp": "2026-06-16T11:30:00Z",
        "decision": "rejected",
        "reason": "M5 bounce from 4338 low is weak, no M15 CHoCH, trend remains bearish.",
        "htf_context": "H4 heavily bearish, trending down from 4369.",
        "m30_structure": "M15 making consistent lower lows, bearish structure intact.",
        "m15_m5_execution": "M5 printed a slight bounce to 4343, but quickly stalled. 11:30 candle is an inside bar, no momentum shift.",
        "entry": None,
        "stop": None,
        "target": None,
        "r": None,
        "promoted_to_journal": False
    },
    {
        "candidate_id": "candidate_2026-06-16T15-45-00Z_long_liquidity_sweep_reversal",
        "timestamp": "2026-06-16T15:45:00Z",
        "decision": "needs_more_context",
        "reason": "Significant liquidity sweep of 4313 low down to 4321, followed by strong M5 explosive move to 4343, indicating potential CHoCH. Needs precise entry confirmation on LTF (M1).",
        "htf_context": "H4 bearish trend, but price has probed deeply into potential HTF support (around 4313 previous low) and rebounded sharply.",
        "m30_structure": "M15 swept lows at 14:30 (4313), chopped around, then exploded at 15:50.",
        "m15_m5_execution": "M5 prints a massive engulfing candle from 4325 to 4338 at 15:50, then continues to 4343. This is a clear structural shift, but entry is missed on M5. Need to see if M1 offered an entry in the discount of the displacement leg.",
        "entry": None,
        "stop": None,
        "target": None,
        "r": None,
        "promoted_to_journal": False
    }
]

with open('/home/aryy/.hermes/profiles/finance/backtests/xauusd_2026/hybrid/reviews/manual_replay_results/replay_result_00660_00663.json', 'w') as f:
    json.dump(results, f, indent=2)

with open('/home/aryy/.hermes/profiles/finance/backtests/xauusd_2026/hybrid/reviews/manual_replay_progress.json', 'r') as f:
    progress = json.load(f)

progress['cursor']['next_index'] = 663
progress['cursor']['processed_count'] = 663
progress['cursor']['rejected_count'] += 2
progress['cursor']['needs_more_context_count'] += 1
progress['cursor']['last_candidate_id'] = results[-1]['candidate_id']
progress['runs'][0]['result_files'].append("hybrid/reviews/manual_replay_results/replay_result_00660_00663.json")
progress['runs'][0]['decision_counts']['rejected'] += 2
progress['runs'][0]['decision_counts']['needs_more_context'] += 1

with open('/home/aryy/.hermes/profiles/finance/backtests/xauusd_2026/hybrid/reviews/manual_replay_progress.json', 'w') as f:
    json.dump(progress, f, indent=2)

print("Done writing results and updating progress.")
