A complete pipeline for contract specs, individual contracts, and continuous futures in Python

First published on Substack

This guide on building a futures database using Norgate Data was originally published on Substack before appearing on the site. It covers continuous futures construction, contract specifications, and a complete Python pipeline for research ready futures datasets.

Quantitative futures research depends heavily on how the underlying data is constructed. Small inconsistencies in contract handling, pricing, or roll logic can lead to materially different results.

A usable futures database in Python typically relies on three core datasets: contract specifications, individual contract histories, and a continuous series.

The challenge is not access, but structure. These datasets follow different conventions and are not aligned by default, which makes it easy to combine them incorrectly or use the wrong prices.

The data used here comes from Norgate Data, which provides long historical coverage across futures markets, with some contracts going back to the 1980s.

This article shows how to retrieve and organize them into a single, consistent pipeline.

What You Will Learn

You will be able to retrieve contract specifications, individual contract data, and continuous futures series, and combine them into a set of Parquet files ready for research.

This workflow shows how to structure a futures database in Python so the data can be used directly for research and backtesting.

Google Drive
Download Code
Download the full code from Google Drive and run it locally. Requires the Norgate Data client. It cannot be executed directly in the browser.
Download →

Disclaimer

This content is provided for research and educational purposes only. It does not constitute financial advice, investment recommendations, or an offer to trade futures or other financial instruments.

We are not affiliated with or sponsored by Norgate Data , nor are we compensated for this article. Norgate Data is referenced solely as a data source for historical futures market data.

Related article

For a related data construction problem, How to Construct a Survivorship Bias-Free Database in Norgate Using Python shows how to build a dataset that includes delisted stocks and avoids survivorship bias.

Futures Database Output Example

The notebook produces four files in the norgate_output/ folder:

FileWhat’s insideWhen to use it
01_contract_specs.parquetPoint value, tick size, margin, currency, exchange, groupLook up contract details for any futures market
02_individual_contracts_ohlcv.parquetOHLCV for every individual contract (including expired)Backtesting on actual contract-level data (rolls, expiry, etc.)
03_continuous_adjusted_and_unadjusted.parquetBack-adjusted OHLCV + unadjusted close & volume in the same rowStandard continuous series for research (adjusted for signals, unadjusted for actual prices)
04_continuous_with_volume_decomposition.parquetContinuous series enriched with first- and second-to-expire contract volumesVolume analysis, roll timing, and liquidity research

Output Columns

01_contract_specs.parquet

HeaderExplanation
SymbolNorgate continuous futures symbol (e.g. &ES_CCB for E-mini S&P 500 back-adjusted).
NameFull security name as provided by Norgate Data.
ExchangeExchange where the contract trades (e.g. CME, NYMEX, ICE).
GroupBroadest Norgate classification (e.g. Currency, Energy, Grains).
Contract SizeValue of a one-point move in the contract’s currency.
Tick SizeMinimum price increment for the contract.
Tick ValueValue of one tick in the contract’s currency. Calculated as Tick Size × Contract Size.
Point ValueSame as Contract Size.
CurrencyContract denomination (e.g. USD, GBP, EUR).
MarginExchange margin requirement in the contract’s currency.

02_individual_contracts_ohlcv.parquet

HeaderExplanation
DateTrading date.
Open, High, Low, ClosePrice data for the individual contract.
VolumeTraded volume for this individual contract.
Open InterestOpen interest for this individual contract.
SymbolIndividual contract symbol (e.g. ES-2024Z for Dec 2024 E-mini S&P).

03_continuous_adjusted_and_unadjusted.parquet

HeaderExplanation
DateTrading date.
Open, High, Low, CloseBack-adjusted prices (shifted to eliminate gaps at contract rolls).
VolumeTotal volume across all active contracts.
Delivery MonthDelivery month of the current front-month contract (encoded as YYYYMM).
Open InterestTotal open interest across all active contracts for this market.
SymbolContinuous symbol (e.g. &ES_CCB). The _CCB suffix denotes back-adjusted.
Close UnadjustedClosing price of the front-month contract

04_continuous_with_volume_decomposition.parquet

HeaderExplanation
(all columns from 03)Same back-adjusted series with unadjusted prices.
FirstVolumeVolume of the first-to-expire (front-month) contract.
FirstContractSymbol of the first-to-expire contract (e.g. ES-2025M).
SecondVolumeVolume of the second-to-expire contract.
SecondContractSymbol of the second-to-expire contract (e.g. ES-2025U).

Download & Run the Code

The full pipeline is provided as a single Jupyter notebook.

Futures database Python setup steps: start Norgate Data, enable databases, run notebook

Quick Setup

1. Start Norgate Data

Open the Norgate Data Updater and keep it running in the background. This application provides the connection required for the Python API, so the code will not run unless it is active.

Note: Currently, Norgate Data only supports Python on Windows, as stated in their documentation.

2. Enable Required Databases

Inside the Norgate Data Updater, navigate to the Database section and ensure that both the Futures and Continuous Futures databases are fully active.

The Futures database contains all individual contracts, including expired ones, while Continuous Futures provides the stitched front-month and back-adjusted series. If either is missing, select it, download it, and wait until it is fully available before proceeding.

3. Run the Notebook

After adjusting the configuration in the first cell (such as date range or output settings), run the entire notebook. In Jupyter, this can be done using the “Run All” option.

The notebook will download the data, process it, and generate the four Parquet files automatically in the output folder.

How the Workflow Operates

1. Contract Specifications

The workflow begins by retrieving contract metadata such as tick size, point value, margin, and currency for each market. This provides the foundation needed for sizing and risk calculations.

2. Individual Contracts

All individual futures contracts are then downloaded. Each contract is queried once to obtain the full OHLCV series with open interest. These are merged into a single dataset.

3. Continuous Futures

Continuous futures series are constructed by combining back-adjusted prices with the corresponding unadjusted front-month data. This produces a dataset where adjusted prices can be used for signal generation, while real prices are preserved for accurate sizing calculations.

The Continuous Futures database contains two types of symbols for each market:

Symbol typeExampleContains
Without _CCB&ESUnadjusted front-month prices – the actual traded price at each point in time.
With _CCB&ES_CCBBack-adjusted continuous series – prices shifted to eliminate gaps at contract rolls.

The merge strips the _CCB suffix to create a BaseSymbol, then joins on Date + BaseSymbol so each adjusted row picks up the unadjusted Close and Volume from its non-_CCB counterpart.

4. Volume Decomposition

The final step enriches the continuous series with volume data from individual contracts. For each date, the pipeline identifies the first-to-expire and second-to-expire contracts and records their volumes.

This is done by parsing individual contract symbols (e.g. `ES-2025M`) into base code and expiry date, building a map of all contracts per commodity sorted by expiry, and then matching each date in the continuous series to the two nearest active contracts.

Understanding the Row Counts

DatasetSymbolsWhat each symbol isTypical rows
Individual contracts~27,000One specific contract month (e.g. ES-2024Z)~11 million
Continuous back-adjusted~112One market, all rolls stitched (e.g. &ES_CCB)~880,000

The individual contracts dataset contains roughly 27,000 symbols, each representing a specific contract month such as ES-2024Z, and totals around 11 million rows. The continuous dataset contains roughly 112 symbols, each representing a full market, and totals around 880,000 rows.

This difference reflects the role of continuous series, which compress thousands of individual contracts into a single time series per market.

Conclusion

This workflow produces four datasets for futures research: contract specifications for sizing and margin, individual contract data for contract-level analysis, continuous series that combine adjusted and unadjusted prices, and a volume decomposition layer for roll timing and liquidity analysis.

The first three form the foundation, while the fourth links the continuous series back to its underlying contracts, making it straightforward to move between representations without rebuilding the data.

All outputs are stored as Parquet files for efficient access and can be used directly in a backtesting framework or research pipeline without further preprocessing.

Get research like this before it’s public.

Enter your email to receive our next data-driven analysis.

Live Experiment

Can You Beat a Systematic Strategy?

We’re running a research experiment to test whether day trading skill can improve the performance of a fully systematic intraday strategy.

No trade generation. No guessing.
Just managing exposure using price action — and we are measuring the result.

Join the Experiment →