Skip to content
All library documents

Finding Historical Futures Expiration Dates from Definitions and Exchanges

Article Quant Q&A · Author: user312087

Summary

The document asks how to find past expiration dates for futures, especially stock index contracts, and contrasts calculating dates with retrieving recorded contract data. One answer describes querying historical instrument definitions from a market data service for a chosen date, then reading each symbol’s expiration field. The example shows that a historical snapshot can return expiration timestamps for many instruments active on that date.

A second answer recommends checking exchange records for the last trading date of each expiry, since exchanges publish authoritative contract specifications and calendars. The discussion offers two routes: historical instrument metadata from a data provider or exchange-published dates. It does not establish which exchanges retain records beyond a decade, whether the cited provider’s history covers the user’s full period, or how to identify the relevant index futures among the returned symbols. Users should verify what the expiration field represents for their purpose, since expiration and last trading date may differ.

Key ideas

  • Historical instrument definitions can provide expiration fields for contracts active on a selected date.
  • Exchange websites may publish authoritative last trading dates for futures expiries.
  • A historical metadata query can return many symbols, so relevant contracts must be identified.
  • The document does not confirm the historical coverage available for every exchange or provider.

Tags

Full text
# Algorithm / source to calculate historical expiry dates of futures


# Algorithm / source to calculate historical expiry dates of futures












I can find several source on this site where to find expiry dates of coming futures contracts.

I am looking for a (e.g. Python) algorithm or a data source where I can find historical dates when a certain futures contract expired in the past.

I am specially interested in stock index futures and - if possible - back to more than 10 years.

## Answer by madilyn (score 4)

https://quant.stackexchange.com/a/75618

I think the simplest way to do this in Python is with Databento's API.

```
import databento as db

client = db.Historical()

data = client.timeseries.get_range(
    dataset='GLBX.MDP3',
    schema='definition',
    start='2022-10-10',
    end='2022-10-10',
)

df = data.to_df()

print(df[['symbol', 'expiration']])
```

This gets you the expirations for all symbols (617,090 in total) that were active on a specific historical date (2022-10-10).

```
                                                   symbol                expiration
ts_recv
2022-10-10 00:00:00+00:00                     OSXG3 P9850 2022-12-22 19:30:00+00:00
2022-10-10 00:00:00+00:00                     AAOJ4 C5950 2024-04-30 18:30:00+00:00
2022-10-10 00:00:00+00:00                       7FV3-7FG4 2023-10-11 15:30:00+00:00
2022-10-10 00:00:00+00:00                     WAYZ2 P-150 2022-11-18 19:30:00+00:00
2022-10-10 00:00:00+00:00                           AHMG4 2024-02-01 04:59:00+00:00
...                                                   ...                       ...
2022-10-10 23:58:50.142534786+00:00  UD:1V: BX 1011861394 2022-10-11 20:00:00+00:00
2022-10-10 23:59:03.453690873+00:00  UD:1V: VT 1011861395 2022-10-14 21:59:00+00:00
2022-10-10 23:59:05.521727212+00:00  UD:EN: GN 1011861396 2022-10-14 20:00:00+00:00
2022-10-10 23:59:18.036952193+00:00  UD:1V: BX 1011861397 2022-10-11 20:00:00+00:00
2022-10-10 23:59:51.703175001+00:00  UD:1V: BX 1011861398 2022-10-11 20:00:00+00:00

[617090 rows x 2 columns]
```

## Answer by ThatDataGuy (score 1)

https://quant.stackexchange.com/a/64205

There's no need to calculate these dates, as there are many data sources that record exactly when the last trading date was for each expiry. It's standard stuff. Try the exchange website, it's probably free, and the exchange is authoritative.

Same holds for prospective dates/expiries out to a rolling horizon. IIRC it's usually a few years for equity index futures.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.