Free XAUUSD Historical Data API
Query XAUUSD and XAUAUD gold bars from M1 to MN1 with a simple JSON or CSV request. Built for gold backtests, MT5 data validation, session research and machine-learning datasets.
Updated 2026-11-02 ? Data refreshed from the AlgoSpecial catalog.
XAUUSD coverage and timeframes
The API serves gold datasets for XAUUSD and XAUAUD. XAUUSD is the primary feed, with intraday and higher-timeframe history suitable for gold scalping tests, swing models and multi-timeframe filters.
| Timeframe | Typical use | API value |
|---|---|---|
| M1 | Execution research and tick-sensitive gold strategies | M1 |
| M5 / M15 / M30 | Intraday gold systems and session filters | M5, M15, M30 |
| H1 / H4 | Swing models and higher-timeframe bias | H1, H4 |
| D1 / W1 / MN1 | Long-horizon research and regime studies | D1, W1, MN1 |
The XAUUSD M15 dataset contains 225,077 bars from 2017-01-19 to 2026-10-30. Other timeframes have different start dates and row counts. Use the data builder to inspect exact coverage before downloading a large file.
Request XAUUSD OHLC data
The OHLC endpoint accepts a symbol, timeframe, date range and optional format. The date range is inclusive and limited to 366 days per request. JSON is the default; add format=csv for a spreadsheet-friendly response.
| Field | Meaning |
|---|---|
Timestamp | Broker server time in YYYY.MM.DD HH:MM:SS format |
Open, High, Low, Close | OHLC prices for the bar |
TickVolume | Tick count where the source feed provides it |
Spread | Spread in broker points where available |
XAUUSD is quoted with three decimals on the Exness-style source feed. The API returns the stored prices without rewriting them for another broker's digits.
Gold data quality
The XAUUSD M15 report scores 97.0 / 100 and receives an A grade. The audit checks duplicate timestamps, OHLC violations, non-positive prices, flat bars, zero volume, zero spread, extreme returns, gaps and weekend bars.
- No duplicate timestamps or OHLC violations in the M15 audit.
- Small numbers of flat bars and zero-spread bars are reported as warnings, not hidden.
- Expected market-closure gaps remain visible so you can decide how to handle weekends and holidays.
Open the full XAUUSD M15 quality report or query the Data Quality API before using a dataset in production.
Common XAUUSD API use cases
Gold EA backtesting
Feed M1 or M15 gold bars into an MT5 strategy tester or an external backtest engine.
Session analysis
Compare Asia, London and New York gold behaviour with broker-server timestamps.
Machine learning
Build returns, volatility and range features from a consistent OHLC history.
Limits, timezone and best practice
Anonymous access is limited to 60 requests per minute and 1,000 requests per day per IP. A single request can return up to 50,000 rows and cover at most 366 days. For a multi-year M1 study, split the date range into smaller windows and cache each response.
Timestamps are broker server time, not UTC. Convert them explicitly if your model uses New York or London session boundaries. When a request is too large, the API returns 413 with a clear error instead of silently truncating the dataset.
Request examples
cURL - XAUUSD M15 JSON
curl "https://www.algospecial.com/api/ohlc.php?symbol=XAUUSD&tf=M15&from=2026-01-01&to=2026-01-31&format=json"
Python - load gold bars into pandas
import pandas as pd
import requests
url = "https://www.algospecial.com/api/ohlc.php"
params = {
"symbol": "XAUUSD",
"tf": "M15",
"from": "2026-01-01",
"to": "2026-01-31",
}
response = requests.get(url, params=params, timeout=30)
response.raise_for_status()
df = pd.DataFrame(response.json()["data"])
df["Timestamp"] = pd.to_datetime(df["Timestamp"])
print(df.head())
cURL - XAUUSD CSV
curl "https://www.algospecial.com/api/ohlc.php?symbol=XAUUSD&tf=H1&from=2026-01-01&to=2026-03-31&format=csv" -o XAUUSD_H1.csv
All timestamps are broker server time. Some legacy forex exports return 0 for TickVolume and Spread because those fields were not present in the source feed.
XAUUSD API FAQ
Is the XAUUSD API free?
Yes. It is free with a per-IP limit of 60 requests per minute and 1,000 requests per day.
How far back does XAUUSD history go?
The XAUUSD M15 dataset starts on 2017-01-19 and runs to 2026-10-30. Other timeframes have different coverage, so check the dataset builder or quality report.
Can I download XAUUSD as CSV?
Yes. Add format=csv to the OHLC request. The CSV uses the same Timestamp, Open, High, Low, Close, TickVolume and Spread columns.
Does the API include XAUUSD volume?
TickVolume is returned where the source feed provides it. Some legacy feeds do not include volume or spread; those fields return 0.
What timezone are gold timestamps in?
Timestamps are broker server time. Convert to UTC or New York time if your strategy uses session boundaries.
Choose the next useful step
Most visitors arrive with one question: build, test, price, or trust. These shortcuts keep the path practical.
Go deeper before you build, download or automate
Hand-picked engineering articles, indicator breakdowns and trading-system tools so visitors keep exploring instead of leaving after one page.
Pine Script to MT4/MT5 Conversion Planner
Analyze Pine strategies, repainting risk, TradingView alert bridges, MTF synchronization and the correct MQL4/MQL5 build path before paying for conversion.
Open planner
3-in-1 MT5 Indicator Bundle
12H Bias Engine, Smart Money Institutional Flow Dashboard and D1/H1 pending-signal logic with MQ5 + EX5 source included via Etsy.
MT5 Bank Orders Institutional Flow Dashboard
Supply/demand zones, BOS/CHoCH, liquidity levels, FVG, equal highs/lows and confirmed trade-plan logic explained with EX5 download.
MT5 Asia London NY Liquidity Engine
Asia range, London raid and New York continuation/reversal planning with internal session backtest stats and entry/SL/TP dashboard.
Interactive Brokers RSI Pair Trader
Tkinter desktop trading workflow, TWS API connection handling, RSI pair logic, risk controls and custom IBKR development positioning.
XAUUSD M30 CSV Data For Backtesting
Use clean MT5 historical data for Python backtests, strategy validation, spread checks and realistic gold EA research workflows.