Data Trends for Investment Professionals


API for Futures Data

Tags: ,

Using the Quandl API for Futures Data

This document is a comprehensive guide to using the Quandl API to access our free futures data. If you haven’t already done so, we recommend reading Quandl’s general API documentation; the functionality will be a lot clearer if you do so.

Free Unlimited API for Futures Data

Quandl offers free historical futures data for 600 futures contracts from over 15 exchanges. Quandl also provides a single, uniform data API that provides full access to daily futures data and prices from these futures markets. With Quandl’s various software libraries, including Python and R, it is easy to find and download historical futures prices.

Quandl also provides free historical data for continuous futures contracts and for commitment of traders reports published by the CFTC, accessible via the same API and libraries.

This page is a tutorial on usage of the API to access futures data. Accessing futures data via the API is no different than the mechanism for all data on Quandl. The purpose of this help page is simply to explain the specific nomenclature we’re using for futures data. For general help, see API. To learn how to access Quandl futures data directly from various third-party tools and apps, start on the tools page.

Basic Futures API Usage

Code Formats

Futures contracts all use the Quandl code format {EXCHANGE}/{CODE}{MONTH}{YEAR}, where:

  • {EXCHANGE} is the acronym for the futures exchange
  • {CODE} is the futures ticker code, as listed given in the CSV files provided below
  • {MONTH} is the single-letter month code
  • {YEAR} is a 4-digit year

Thus for example the March (H) 2012 contract for Hard Red Spring Wheat (MW) from the Minneapolis Grain Exchange (MGEX) is MGEX/MWH2012.

Sample Call

Here is a simple call that gets the entire history for the MGEX/MWH2012 contract, in CSV format:

As described in detail in the main API documentation, you can modify the above basic call to get data in JSON or XML formats; to change the reporting frequency from daily to weekly to monthly to annual; to set the start date, end date and sort order; to pull specific data columns; to transform the data (changes, percentage changes); to combine multiple datasets in one call; and much much more.

Futures Contracts and Exchanges

Here are CSV files showing the futures contracts available from each exchange. The file format is:

Futures Ticker Symbol, Exchange Acronym, Contract Name, Contract Months, Quandl Code (excluding month and year)

Exchange Contracts
Minneapolis Grain Exchange MGEX
Montreal Exchange MX
Multi Commodities Exchange of India MCX
Osaka Dojima Commodity Exchange ODE
Osaka Securities Exchange OSE
Singapore Exchange SGX
Shanghai Futures Exchange SHFE
Tokyo Futures Exchange TFX

Continuous Contracts

Quandl provides continuous (aka concatenated or chained) futures contracts from two sources: a free in-house source CHRIS and a paid premium source SCF. The quality of SCF is substantially higher than that of CHRIS; the latter has spikes, nulls, missing rows, jumps in the data, and inconsistent OHLC values; the former is audited to be accurate, consistent and error-free.

The format for continuous contracts from source CHRIS is CHRIS/{EXCHANGE}_{CODE}{NUMBER}, where {NUMBER} is the “depth” associated with the chained contract. For instance, the front month contract has depth 1, the second month contract has depth 2, and so on.

The format for continuous contracts from source SCF can be found here.

Commitment of Traders

Quandl provides weekly Commitment of Traders (CoT) data from the US CFTC. We provide both current-format and legacy-format data.

The format for CFTC dataset codes is CFTC/{CODE}_{INDICATOR}, where {CODE} refers to the specific futures contract (e.g. W, CL, ED) and {INDICATOR} refers to the type of measurement done by the CFTC.

This database is fully documented on our CFTC database page.

Premium Futures Data

For professionals, we recommend the Stevens Continuous Futures premium database. This specialist database includes comprehensive, accurate, quality-audited, well-documented and reliable long-term histories for 50 of the most actively traded North American futures contracts. Learn more»

Fix This
Created with Sketch.