import json

def get_bars(file_path, start_time, count=24):
    with open(file_path) as f:
        data = json.load(f)
    
    if isinstance(data, dict) and 'bars' in data:
        data = data['bars']
        
    bars = []
    for bar in data:
        if bar['time'] <= start_time:
            bars.append(bar)
    
    return bars[-count:]

print("--- candidate_2026-07-13T04-45-00Z_long_liquidity_sweep_reversal ---")
m15 = get_bars('/home/aryy/.hermes/profiles/finance/backtests/xauusd_2026/hybrid/data/ohlcv_M15.json', "2026-07-13T04:45:00Z", count=8)
print("M15:")
for b in m15: print(f"  {b['time']}: O={b['open']} H={b['high']} L={b['low']} C={b['close']}")
m5 = get_bars('/home/aryy/.hermes/profiles/finance/backtests/xauusd_2026/hybrid/data/ohlcv_M5.json', "2026-07-13T05:30:00Z", count=18)
print("M5 (up to 45m after):")
for b in m5: print(f"  {b['time']}: O={b['open']} H={b['high']} L={b['low']} C={b['close']}")

print("\n--- candidate_2026-07-13T15-00-00Z_short_liquidity_sweep_reversal ---")
m15 = get_bars('/home/aryy/.hermes/profiles/finance/backtests/xauusd_2026/hybrid/data/ohlcv_M15.json', "2026-07-13T15:00:00Z", count=8)
print("M15:")
for b in m15: print(f"  {b['time']}: O={b['open']} H={b['high']} L={b['low']} C={b['close']}")
m5 = get_bars('/home/aryy/.hermes/profiles/finance/backtests/xauusd_2026/hybrid/data/ohlcv_M5.json', "2026-07-13T15:45:00Z", count=18)
print("M5 (up to 45m after):")
for b in m5: print(f"  {b['time']}: O={b['open']} H={b['high']} L={b['low']} C={b['close']}")

print("\n--- candidate_2026-07-13T16-00-00Z_short_liquidity_sweep_reversal ---")
m15 = get_bars('/home/aryy/.hermes/profiles/finance/backtests/xauusd_2026/hybrid/data/ohlcv_M15.json', "2026-07-13T16:00:00Z", count=8)
print("M15:")
for b in m15: print(f"  {b['time']}: O={b['open']} H={b['high']} L={b['low']} C={b['close']}")
m5 = get_bars('/home/aryy/.hermes/profiles/finance/backtests/xauusd_2026/hybrid/data/ohlcv_M5.json', "2026-07-13T16:45:00Z", count=18)
print("M5 (up to 45m after):")
for b in m5: print(f"  {b['time']}: O={b['open']} H={b['high']} L={b['low']} C={b['close']}")
