import json
import datetime

with open('data_693_696.json', 'r') as f:
    data = json.load(f)

def check_time(b, t1, t2):
    t_val = b['time']
    if isinstance(t_val, str):
        return t1 <= t_val <= t2
    else:
        # data_693_696.json should have string times if parsed correctly in the previous script... wait, my earlier script did output string times? No, the earlier script just output what was there. The earlier script parsed to float? No, the earlier script kept b['time'] as is. Let's see what data_693_696.json has for M5.
        pass

print("\n--- Candidate 1: 2026-06-23T22:15:00Z (Short) ---")
for b in data['m5']:
    t = b['time']
    if isinstance(t, int) or isinstance(t, float):
       if t > 20000000000: t = t/1000
       t = datetime.datetime.utcfromtimestamp(t).strftime('%Y-%m-%dT%H:%M:%SZ')
    if "2026-06-23T21:45:00Z" <= t <= "2026-06-23T22:45:00Z":
        print(f"M5: {t} O:{b['o']} H:{b['h']} L:{b['l']} C:{b['c']}")

print("\n--- Candidate 2: 2026-06-24T01:30:00Z (Short) ---")
for b in data['m5']:
    t = b['time']
    if isinstance(t, int) or isinstance(t, float):
       if t > 20000000000: t = t/1000
       t = datetime.datetime.utcfromtimestamp(t).strftime('%Y-%m-%dT%H:%M:%SZ')
    if "2026-06-24T01:15:00Z" <= t <= "2026-06-24T02:00:00Z":
        print(f"M5: {t} O:{b['o']} H:{b['h']} L:{b['l']} C:{b['c']}")

print("\n--- Candidate 3: 2026-06-24T02:00:00Z (Short) ---")
for b in data['m5']:
    t = b['time']
    if isinstance(t, int) or isinstance(t, float):
       if t > 20000000000: t = t/1000
       t = datetime.datetime.utcfromtimestamp(t).strftime('%Y-%m-%dT%H:%M:%SZ')
    if "2026-06-24T01:45:00Z" <= t <= "2026-06-24T02:45:00Z":
        print(f"M5: {t} O:{b['o']} H:{b['h']} L:{b['l']} C:{b['c']}")
