import json

def analyze():
    def get_bars(filename):
        with open(f"/home/aryy/.hermes/profiles/finance/backtests/xauusd_2026/hybrid/data/{filename}.json") as f:
            data = json.load(f)
            return data["bars"] if "bars" in data else data

    m5 = get_bars("ohlcv_M5")
    
    # check structure of m5 to see why it has ints
    print(m5[0])

    print("\n=== M5 around Feb 13 17:15 (207) ===")
    for b in m5:
        # Some timestamp fields might be ints, check for string representation
        ts = str(b.get("time", b.get("timestamp", "")))
        if "2026-02-13" in ts and ts >= "2026-02-13T17:00" and ts <= "2026-02-13T17:45":
            print("M5:", b)

    print("\n=== M5 around Feb 13 18:00 (208) ===")
    for b in m5:
        ts = str(b.get("time", b.get("timestamp", "")))
        if "2026-02-13" in ts and ts >= "2026-02-13T17:50" and ts <= "2026-02-13T18:45":
            print("M5:", b)
            
    print("\n=== M5 around Feb 16 00:00 (209) ===")
    for b in m5:
        ts = str(b.get("time", b.get("timestamp", "")))
        if ("2026-02-15" in ts and ts >= "2026-02-15T23:30") or ("2026-02-16" in ts and ts <= "2026-02-16T01:00"):
            print("M5:", b)

if __name__ == "__main__":
    analyze()
