import json

with open('/home/aryy/.hermes/profiles/finance/backtests/xauusd_2026/hybrid/data/ohlcv_H4.json') as f:
    h4 = json.load(f)['bars']

times = [
    "2026-04-24T09:15:00Z",
    "2026-04-24T09:30:00Z",
    "2026-04-24T10:15:00Z"
]

for ts in times:
    print(f"\n--- H4 Context for {ts} ---")
            
    found = -1
    for i, b in enumerate(h4):
        if b['time'] > ts:
            found = i - 1
            break
            
    if found != -1:
        for i in range(max(0, found - 5), min(len(h4), found + 3)):
            indicator = "-->" if i == found else "   "
            print(f"{indicator} {h4[i]['time']} | O:{h4[i]['open']:.2f} H:{h4[i]['high']:.2f} L:{h4[i]['low']:.2f} C:{h4[i]['close']:.2f}")
