﻿import pandas as pd
from pathlib import Path

proj = Path(r"C:\Users\paul_\OneDrive\fx_macro_intraday")
csv = proj / "data" / "raw" / "prices" / "USDJPY" / "USDJPY_15M_2003_2026.csv"
df = pd.read_csv(csv)
df.columns = [c.strip().lower() for c in df.columns]
df["datetime"] = pd.to_datetime(df["datetime"], format="%Y.%m.%d %H:%M:%S")

# Look at the very end — when does the last bar of week end?
# Friday week-close in UTC is 22:00. In flat-EET (UTC+2) that's 00:00 Saturday.
# In EEST (UTC+3) that's 01:00 Saturday.
print("=== Last 10 bars of last full week (May 2026) ===")
df_recent = df[df["datetime"] >= "2026-05-08"].copy()
print(df_recent.tail(15).to_string())
print()

# And the equivalent in the historical data
print("=== Last 10 bars of a week in Feb 2026 (historical, before seam) ===")
df_feb = df[(df["datetime"] >= "2026-02-13") & (df["datetime"] <= "2026-02-14")].copy()
print(df_feb.tail(15).to_string())
