Home · Guides · XAU/USD timeframes: resample 1-minute (M1) data to M5, H1, H4 and daily
GUIDE · XAU/USD · TIMEFRAMES · CATALOG VERIFIED 2026-10-08
XAU/USD timeframes: resample 1-minute (M1) data to M5, H1, H4 and daily
Any XAU/USD timeframe can be built from 1-minute bars with one pandas resample call; the only real choice is where a daily bar starts. AI Options Data Store sells XAU/USD spot M1 OHLC from 15 Mar 2009 to 2 Oct 2026 as Parquet in UTC, so M5, M15, H1, H4, daily and weekly bars are a few lines away.
Get the XAU/USD packXAU/USD historical dataM1 data and CSV Free sample (no email)
Download the sample → check the columns
Dates on this page are read from the live file catalog, not typed by hand. Full matrix: /coverage.
Timeframe to pandas rule
| Timeframe | pandas rule | Note |
|---|---|---|
| M5 / M15 / M30 | '5min' / '15min' / '30min' | Bars labelled by their start |
| H1 / H4 | '1h' / '4h' | H4 buckets start at 00:00 UTC |
| D1 (UTC day) | '1D' | Day = 00:00–24:00 UTC |
| D1 (17:00 New York close) | '1D' on a shifted index | Common for spot charts; see code |
| W1 | 'W-FRI' | Week ending Friday |
Intraday bars (M5 to H4)
Aggregate open as first, high as max, low as min and close as last. dropna() removes empty buckets (weekends, holidays); nothing is forward-filled.
import pandas as pd
df = pd.read_parquet('XAUUSD_SPOT_1min_2025-01-01_2025-12-31.parquet').set_index('datetime')
AGG = {'open': 'first', 'high': 'max', 'low': 'min', 'close': 'last'}
m15 = df.resample('15min').agg(AGG).dropna()
h1 = df.resample('1h').agg(AGG).dropna()
h4 = df.resample('4h').agg(AGG).dropna()
Daily bars with a 17:00 New York close
Shift New York local time by seven hours so 17:00 becomes midnight, then resample by day. Because the shift is applied in local time, daylight-saving changes are handled.
ny = df.copy()
ny.index = df.index.tz_convert('America/New_York') + pd.Timedelta(hours=7)
d1 = ny.resample('1D').agg(AGG).dropna() # each bar ends 17:00 New York
w1 = ny.resample('W-FRI').agg(AGG).dropna()
d1.to_csv('xauusd_d1.csv') # CSV if needed
Same thing in DuckDB
DuckDB reads the yearly Parquet files with a glob and aggregates without loading everything into pandas.
import duckdb
duckdb.sql("SET TimeZone = 'UTC'")
h1 = duckdb.sql("""
SELECT time_bucket(INTERVAL '1 hour', datetime) AS ts,
arg_min(open, datetime) AS open, max(high) AS high,
min(low) AS low, arg_max(close, datetime) AS close
FROM 'XAUUSD_SPOT_1min_*.parquet'
GROUP BY ts ORDER BY ts
""").df()
Exactly which fields are in the files
XAU/USD 1-minute files
| Column | Type | Meaning |
|---|---|---|
| datetime | timestamp (UTC) | Minute start, timezone-aware UTC |
| open / high / low / close | float | Bid-side XAU/USD quote OHLC, US dollars per troy ounce |
Not included: ask-side prices, futures, options, implied volatility or Greeks. 1-minute bars, not tick data.
Format: Parquet (XAUUSD_SPOT_1min_….parquet), UTC. The free September 2026 sample is enough to test every snippet.
FAQ
Can I get XAU/USD hourly or daily data from 1-minute data?
Yes. Resample the 1-minute bars (first/max/min/last). AI Options Data Store sells XAU/USD M1 OHLC from 15 Mar 2009 to 2 Oct 2026 as Parquet in UTC, so every higher timeframe can be rebuilt exactly.
Which daily close should I use?
Either the UTC day or a 17:00 New York close, which many spot charts use. The guide shows both; pick one and keep it consistent across tests.
Why do my H4 bars not match my charting platform?
Platforms differ in where the day and the 4-hour buckets start. Apply the same offset (for example the New York shift) before resampling.
Are empty weekend bars created?
pandas creates empty buckets for the closed hours; dropna() removes them. No prices are forward-filled.
Can I export the result to CSV?
Yes, df.to_csv() on any resampled frame.
Get the data
Free sample · Schema · Ask the AI for your data
Get the XAU/USD packXAU/USD historical dataM1 data and CSV Free sample
Related guides
- XAU/USD 1-minute (M1) data: files, columns and how to get CSV
- XAU/USD session analysis: Asia, London and New York hours with 1-minute data
- Backtest an XAU/USD intraday strategy in Python with 1-minute data
- Bitcoin 1-minute historical data: what is in the files and how to load them
- Crypto funding rate history and 1-minute perpetual futures data
- Backtest crypto perpetual futures in Python, with funding included
- Ethereum 1-minute historical data: ETH perpetual futures, funding and files
- XAU/USD historical data
- All Crypto & XAU/USD packs
- Datasets index
XAU/USD is the international spot rate in US dollars per troy ounce, not an MCX contract.