import json

h4_bars = json.load(open('hybrid/data/ohlcv_H4.json'))['bars']
h1_bars = json.load(open('hybrid/data/ohlcv_H1.json'))['bars']
m15_bars = json.load(open('hybrid/data/ohlcv_M15.json'))['bars']

def get_bars(bars, start, end):
    return [b for b in bars if start <= b['time'] <= end]

print("--- candidate_2026-03-12T03-45-00Z_short_liquidity_sweep_reversal ---")
print("H4 context leading up (Mar 11 to Mar 12 03:45):")
for b in get_bars(h4_bars, "2026-03-11T00:00", "2026-03-12T03:45"):
    print(f"{b['time']} H:{b['high']:.2f} L:{b['low']:.2f} C:{b['close']:.2f}")
print("M15 context (02:00 to 06:00):")
for b in get_bars(m15_bars, "2026-03-12T02:00", "2026-03-12T06:00"):
    print(f"{b['time']} H:{b['high']:.2f} L:{b['low']:.2f} C:{b['close']:.2f}")

print("\n--- candidate_2026-03-12T07-00-00Z_long_liquidity_sweep_reversal ---")
print("H4 context leading up (Mar 11 to Mar 12 07:00):")
for b in get_bars(h4_bars, "2026-03-11T00:00", "2026-03-12T07:00"):
    print(f"{b['time']} H:{b['high']:.2f} L:{b['low']:.2f} C:{b['close']:.2f}")
print("M15 context (05:00 to 12:30):")
for b in get_bars(m15_bars, "2026-03-12T05:00", "2026-03-12T12:30"):
    print(f"{b['time']} H:{b['high']:.2f} L:{b['low']:.2f} C:{b['close']:.2f}")

print("\n--- candidate_2026-03-12T10-00-00Z_short_liquidity_sweep_reversal ---")
print("H4 context leading up (Mar 11 to Mar 12 10:00):")
for b in get_bars(h4_bars, "2026-03-11T00:00", "2026-03-12T10:00"):
    print(f"{b['time']} H:{b['high']:.2f} L:{b['low']:.2f} C:{b['close']:.2f}")
print("M15 context (08:00 to 14:00):")
for b in get_bars(m15_bars, "2026-03-12T08:00", "2026-03-12T14:00"):
    print(f"{b['time']} H:{b['high']:.2f} L:{b['low']:.2f} C:{b['close']:.2f}")

