
If you’ve worked with gold historical data long enough, you’ve probably hit this weird situation where everything looks fine at first glance… but something feels off.
Charts suddenly “jump”, flat segments appear out of nowhere, and nothing in your strategy explains it.
Most of the time, this is caused by what people casually call holiday candles.
Non-trading hours are where the problem starts
Gold is not a 24/7 asset like crypto.
It follows exchange calendars, meaning there are clear non-trading hours such as:
- weekends
- public holidays
- market closure windows
During these periods, data providers usually do one of three things:
- skip the data entirely
- forward-fill the last price
- return sparse or irregular timestamps
And this is exactly where historical data gaps begin to appear.
A simple data retrieval example
Before thinking about charts or strategy logic, the real foundation is getting clean data.
Here’s a simple example using a precious metals API like AllTick to fetch gold (XAUUSD) historical K-line data:
import requests
API_KEY = "YOUR_API_KEY"
symbol = "XAUUSD"
interval = "1h"
url = "https://api.alltick.co/market/kline"
params = {
"symbol": symbol,
"interval": interval,
"start": "2026-01-01",
"end": "2026-05-28",
"apikey": API_KEY
}
response = requests.get(url, params=params).json()
for item in response["data"]:
timestamp = item["time"]
open_price = item["open"]
close_price = item["close"]
is_holiday = item.get("isHoliday", False)
print(timestamp, open_price, close_price, "holiday candle" if is_holiday else "")
What matters here is not just price retrieval, but the ability to identify whether a candle belongs to a trading or non-trading period.
That small detail changes everything in downstream analysis.
How holiday candles affect analysis
Holiday candles are not “wrong data”.
They are just misunderstood data representations.
But they can quietly distort:
- moving averages
- volatility calculations
- backtesting curves
- trend continuity assumptions
The longer the timeframe, the more these distortions accumulate.
Practical ways to handle them
There are usually three approaches:
1. Keep gaps as-is (best for analysis)
This preserves market reality.
2. Forward fill missing values (best for visualization)
Useful for smooth charts, but should be used carefully.
3. Explicitly mark non-trading periods
This is often the most balanced approach.
A detail many people overlook
The real issue is not missing data.
It is the confusion between:
“no trading happened” vs “data is missing”
A structured precious metals API like AllTick helps here by providing properly organized historical K-line data instead of raw, ambiguous price streams.
That makes downstream processing significantly cleaner, especially when you are dealing with long-range gold datasets.


