import json

def analyze():
    try:
        with open("/home/aryy/.hermes/profiles/finance/backtests/xauusd_2026/hybrid/data/ohlcv_M15.json") as f:
            data = json.load(f)
            if "data" in data and "M15" in data["data"]:
                data = data["data"]["M15"]
            elif isinstance(data, dict):
                # find the list
                for k, v in data.items():
                    if isinstance(v, list):
                        data = v
                        break
            
            res1 = [d for d in data if "2026-02-13" in d.get("timestamp", "")]
            print(f"Items on 2026-02-13: {len(res1)}")
            for d in res1[-15:]:
                print(f"{d.get('timestamp')} O:{d.get('open')} H:{d.get('high')} L:{d.get('low')} C:{d.get('close')}")

            res2 = [d for d in data if "2026-02-16" in d.get("timestamp", "")]
            print(f"\nItems on 2026-02-16: {len(res2)}")
            for d in res2[:15]:
                print(f"{d.get('timestamp')} O:{d.get('open')} H:{d.get('high')} L:{d.get('low')} C:{d.get('close')}")
                
    except Exception as e:
        print(f"Error: {e}")

if __name__ == "__main__":
    analyze()
