import json

def read_json(path):
    with open(path) as f:
        return json.load(f)

items = read_json('/home/aryy/.hermes/profiles/finance/backtests/xauusd_2026/hybrid/reviews/target_items_792_795.json')

results = []

# candidate_2026-07-13T04-45-00Z_long_liquidity_sweep_reversal
# H4 is bearish, recent close at 4058. H1 had a massive drop from 4120 to 4050.
# At 04:45, price sweeps 4050.465. It's a counter-trend long in a heavy bearish move.
# Control reason is likely "needs_more_context". We will reject it because the momentum is extremely bearish
# and there's no clear structural shift on M15/M30 yet to support a long here.

results.append({
    "candidate_id": "candidate_2026-07-13T04-45-00Z_long_liquidity_sweep_reversal",
    "timestamp": "2026-07-13T04:45:00Z",
    "decision": "rejected",
    "reason": "Counter-trend long attempt against strong bearish H1/H4 momentum; no structural shift on M15/M30.",
    "htf_context": "H4/H1 strongly bearish, dropping from 4120 to 4050.",
    "m30_structure": "Bearish, forming lower lows.",
    "m15_m5_execution": "M5 sweeps 4052 but fails to show strong displacement up; gets chopped around 4060 before dropping again later.",
    "entry": None,
    "stop": None,
    "target": None,
    "r": None,
    "promoted_to_journal": False
})

# candidate_2026-07-13T15-00-00Z_short_liquidity_sweep_reversal
# Short after a bounce to 4020. H1 had dropped to 4000, then bounced to 4020.
# At 15:00, price hits 4020.355. This could be a retracement short.
# However, the subsequent M5 action shows price immediately rejecting 4020 but chopping around 4016.
# It's an aggressive short right after a bounce. Without clear M5 setup and Fib confirmation, keeping in shadow.

results.append({
    "candidate_id": "candidate_2026-07-13T15-00-00Z_short_liquidity_sweep_reversal",
    "timestamp": "2026-07-13T15:00:00Z",
    "decision": "shadow",
    "reason": "Aggressive short on a bounce to 4020; lacks clear M5 entry pattern and confirmation.",
    "htf_context": "Bearish H1 trend, price bounced from 4000 to 4020.",
    "m30_structure": "Bearish, retracing up.",
    "m15_m5_execution": "M5 hits 4020 and chops; no clear displacement down to offer a safe entry.",
    "entry": None,
    "stop": None,
    "target": None,
    "r": None,
    "promoted_to_journal": False
})

# candidate_2026-07-13T16-00-00Z_short_liquidity_sweep_reversal
# At 16:00, price drops from 4018 to 3986 (H1 low).
# The short candidate at 16:00 occurs right as price starts breaking down hard on M5.
# M5 shows a break from 4016 down to 3993.
# Entering right at the breakdown might be late without a pull back. 
# Keep in shadow as the move happened too fast for a safe structured entry.

results.append({
    "candidate_id": "candidate_2026-07-13T16-00-00Z_short_liquidity_sweep_reversal",
    "timestamp": "2026-07-13T16:00:00Z",
    "decision": "shadow",
    "reason": "Short candidate at the moment of breakdown; move is too fast for a structured entry.",
    "htf_context": "Bearish trend continuation.",
    "m30_structure": "Bearish, breaking lows.",
    "m15_m5_execution": "M5 shows rapid drop from 4016 to 3993 without a clear pull-back entry.",
    "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_00792_00795.json', 'w') as f:
    json.dump(results, f, indent=2)

print("Results written.")
