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.

  • 1
    $\begingroup$ Since inception of S&P trading the expiry date of S&P futures has been the third friday of HMUZ month. That is easy to calculate in Excel, for ex. $\endgroup$
    – nbbo2
    May 17, 2021 at 3:14
  • $\begingroup$ Thanks for your quick reply. I am unsure about holidays. If e.g. that Friday is the day before the Easter weekend - would the expiry date shifted in that case (and on which day)? $\endgroup$
    – user312087
    May 17, 2021 at 3:49
  • 1
    $\begingroup$ expiry would be adjusted to preceding business day. You can get exchanges calendars from quantlib, e.g. github.com/gerrymanoim/exchange_calendars $\endgroup$ May 17, 2021 at 12:57

2 Answers 2


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(

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
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]

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.

  • $\begingroup$ That's not entirely true. For example, I am not able to retrieve past expiration dates of Bitcoin Futures on the CME website. There are only the future expiration dates $\endgroup$
    – AleB
    Feb 11, 2022 at 20:55
  • $\begingroup$ I said try the exchange website, because that is the best place to try first. However, they don't always offer this data for free, if at all. Sometimes you'll have to use a third party data collector / vendor instead. $\endgroup$ Feb 25, 2022 at 20:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.