﻿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")

# Find a Friday week-close in HISTORICAL data (Mar 6 2026 - last Friday before any DST)
print("=== Friday Mar 6 2026 — week close — HISTORICAL ===")
fri = df[(df["datetime"] >= "2026-03-06 21:00:00") & (df["datetime"] <= "2026-03-07 02:00:00")]
print(fri.to_string())
print()

# And the equivalent in the new MT5 data
print("=== Friday May 8 2026 — week close — NEW MT5 ===")
fri_new = df[(df["datetime"] >= "2026-05-08 21:00:00") & (df["datetime"] <= "2026-05-09 02:00:00")]
print(fri_new.to_string())
print()

# Friday week-close in real terms: 17:00 NY time = 22:00 UTC = 00:00 (or 01:00 EEST) Saturday EET
# If historical CSV's last Friday bar is 23:45, that means CSV is on UTC+2 flat
# If new CSV's last Friday bar is 00:45 Saturday (or 23:45 with 1 extra hour) that means UTC+3 (EEST)
