Guides /
A practical guide to MCX historical data: contracts, minis, sessions and rolls
How MCX commodity contracts are organised, why each has a mini, how evening-session bars fit into a trading day, and how to handle contract rolls.
MCX data looks like index data with different symbols, but the structure underneath is different enough to trip up a first backtest. Here is what to know before you load a year of commodity bars.
Contracts and minis
The archive covers eight futures symbols in four pairs: GOLD and GOLDM, SILVER and SILVERM, CRUDEOIL and CRUDEOILM, NATURALGAS and NATGASMINI. Each mini tracks the same commodity with a smaller lot. Prices of a big and a mini contract are close but not identical, because they can have different expiry months and different liquidity. Treat them as separate instruments and pick one per study.
Contract months
Commodity futures do not all roll monthly. Crude oil and natural gas list a contract for each month. MCX GOLD trades a set of contract months spread through the year, and silver likewise has its own cycle, so the "front month" can be two months away. Every file carries its expiry, so instead of hard-coding a schedule, let the data say which contracts existed on each day:
import re
from pathlib import Path
import pandas as pd
PAT = re.compile(r"(?P<sym>[A-Z]+)_FUT_1min_(?P<day>\d{4}-\d{2}-\d{2})_exp(?P<exp>\d{4}-\d{2}-\d{2})")
rows = [m.groupdict() for f in Path("mcx").rglob("*_FUT_1min_*.parquet") if (m := PAT.search(f.name))]
listing = pd.DataFrame(rows)
print(listing[listing.sym == "GOLD"].groupby("day")["exp"].apply(sorted).tail())
Sessions
MCX trades from 09:00 into the night, closing at 23:30 or 23:55 depending on the time of year, because energy and metals follow international markets. Two consequences:
- Daily bars. When you resample minutes to days, a "day" on MCX runs from morning to late evening of the same calendar date. Resample by calendar date, not by a fixed 09:15 to 15:30 window.
- Gaps. Overnight moves in global markets show up as the gap between the late-evening close and the next morning's open. Strategies that hold overnight need that gap in their risk numbers.
Rolls
Volume moves to the next contract well before expiry, often a week or more ahead for bullion. Use a volume rule (switch on the first day the next contract trades more) rather than a fixed date, and back-adjust the price joins as described in our continuous futures guide. The same code works on MCX files; only the symbol changes.
Options on commodities
The futures-and-options pack adds MCX options. Commodity options settle into the underlying futures contract, so when you compute implied volatility, use the matching futures price as the underlying, not a spot price.