import json

with open('/home/aryy/.hermes/profiles/finance/backtests/xauusd_2026/hybrid/data/ohlcv_H4.json', 'r') as f:
    h4_data = json.load(f)['bars']
    
h4_subset = []
start_h4 = -1
for i, c in enumerate(h4_data):
    if c['time'] >= "2026-07-08T00:00:00Z":
        start_h4 = i
        break

if start_h4 != -1:
    end_h4 = min(start_h4 + 15, len(h4_data))
    for i in range(start_h4, end_h4):
        h4_subset.append({
            'time': h4_data[i]['time'],
            'o': h4_data[i]['open'],
            'h': h4_data[i]['high'],
            'l': h4_data[i]['low'],
            'c': h4_data[i]['close']
        })

print(json.dumps(h4_subset, indent=2))
