import json
from datetime import datetime, timezone

def load_json(path):
    with open(path, 'r') as f:
        return json.load(f)['bars']

m5_data = load_json('/home/aryy/.hermes/profiles/finance/backtests/xauusd_2026/hybrid/data/ohlcv_M5.json')

def dt_str(ts):
    if isinstance(ts, str): return ts
    return datetime.fromtimestamp(ts, tz=timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ')

def print_m5_range(start_time, end_time):
    print(f"\nM5 from {start_time} to {end_time}:")
    for b in m5_data:
        t = dt_str(b['time'])
        if start_time <= t <= end_time:
            print(f"  {t}: O={b['open']} H={b['high']} L={b['low']} C={b['close']}")

print_m5_range("2026-01-13T02:00:00Z", "2026-01-13T03:30:00Z")
print_m5_range("2026-01-13T05:30:00Z", "2026-01-13T08:30:00Z")
