import json

# Review Item 15: 2026-01-06T18:15:00Z Short
# M15 high at 18:00 was 4491.74, M5 high at 18:10 was 4491.74, then 18:15 spiked to 4494.16 and closed at 4490.88.
# This looks like a classic liquidity sweep. But the previous swing low to reclaim for confirmation would be around 4486.28 (18:00 M15 low).
# In M5, the low of 18:00 is 4486.28, the next low is 4484.20 at 18:25 which breaks the 18:00 low (CHoCH).

# Review Item 16: 2026-01-06T20:30:00Z Long
# Candidate time 20:30Z. Low at 20:30 M5 is 4483.88.
# Prior M15 low is 19:15 at 4477.49, 19:30 at 4477.60.
# The low at 20:30 is 4483.88, which is a higher low, not a sweep of the 4477 lows.
# Wait, M15 low at 19:00 was 4481.97, then 19:15 was 4477.49.
# Let's check M15 for 20:30:
# 20:15 M15 low is 4484.85, high 4487.89. 
# 20:30 M15 low is 4483.88 (sweeps 20:15 low), then rallies to 4490.19.

# Review Item 17: 2026-01-06T21:45:00Z Long
# Candidate time 21:45Z.
# 21:30 M15 low is 4493.95, high 4497.01.
# 21:45 M15 low is 4493.91 (sweeps 21:30 low by a tiny margin: 4493.95 -> 4493.91).
# 21:45 M5 low is 4495.89, wait, no. M15 is 21:45 open to 23:00 open (45min gap for market close?).
# 21:45 M5 low is 4495.89. 21:50 M5 low is 4494.24. 21:55 M5 low is 4493.91. 
# So the 21:55 candle sweeps the 21:50 low (4494.24) and prior lows.

results = {
    "decisions": [
        {
            "candidate_id": "candidate_2026-01-06T18-15-00Z_short_liquidity_sweep_reversal",
            "timestamp": "2026-01-06T18:15:00Z",
            "decision": "needs_more_context",
            "reason": "M5 shows sweep of 4491 to 4494 and CHoCH below 4486, but need TradingView replay to verify exact HTF context and Fib zones before promoting to journal.",
            "htf_context": "Requires TradingView Bar Replay.",
            "m30_structure": "Sweep of 4491.65 high from 17:30.",
            "m15_m5_execution": "M15 18:15 wick to 4494.16, M5 CHoCH below 4486 at 18:25.",
            "entry": None,
            "stop": None,
            "target": None,
            "r": None,
            "promoted_to_journal": False
        },
        {
            "candidate_id": "candidate_2026-01-06T20-30-00Z_long_liquidity_sweep_reversal",
            "timestamp": "2026-01-06T20:30:00Z",
            "decision": "needs_more_context",
            "reason": "M15 shows internal sweep of 20:15 low (4484.85 to 4483.88), not a major structural sweep. Need TV replay to confirm if this aligns with a HTF Fib/PD array.",
            "htf_context": "Requires TradingView Bar Replay.",
            "m30_structure": "Internal M15 sweep, rallied to 4496.",
            "m15_m5_execution": "M5 20:30 sweep 4484, MSS above 4487.46 at 20:40.",
            "entry": None,
            "stop": None,
            "target": None,
            "r": None,
            "promoted_to_journal": False
        },
        {
            "candidate_id": "candidate_2026-01-06T21-45-00Z_long_liquidity_sweep_reversal",
            "timestamp": "2026-01-06T21:45:00Z",
            "decision": "needs_more_context",
            "reason": "Sweep occurs right before the 22:00-23:00 daily close/gap. Low liquidity conditions, needs TV replay to visualize spreads and validity.",
            "htf_context": "Requires TradingView Bar Replay.",
            "m30_structure": "Pre-close sweep of 4493.95 to 4493.91.",
            "m15_m5_execution": "M5 21:55 sweep, gap at 22:00, reclaim at 23:00.",
            "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_00015_00018.json', 'w') as f:
    json.dump(results, f, indent=2)

print("Results written to replay_result_00015_00018.json")
