pandas_market_calendars
Exchange schedules as pandas DataFrames, with CME, CBOE options and bond-market calendars.
by Ryan Sheftel
Last updated
What it is
A pandas-shaped answer to "when was this market open". mcal.get_calendar("NYSE") returns a
calendar, and schedule(start_date, end_date) returns a DataFrame with one row per session and
market_open and market_close columns in UTC — plus break_start and break_end where a
market pauses, and pre and post when you pass start="pre", end="post".
mcal.date_range(schedule, frequency="1h") turns that into a DatetimeIndex of bar timestamps that
skips closed hours and cuts the last bar at an early close. merge_schedules intersects or unions
several schedules, open_at_time tests a timestamp, and valid_days, early_closes and
interruptions_df answer the narrower questions.
Ryan Sheftel started it in December 2016 as a fork of the calendar code in Quantopian's Zipline. Since version 2.0 it also mirrors every calendar in exchange_calendars and depends on that package, so the choice between the two is mostly a choice of API.
Pricing
Free under the MIT licence; nothing to buy. pip install pandas_market_calendars, Python 3.10 or
later, with pandas and exchange_calendars as its only declared dependencies. An Arch Linux AUR
package also exists.
Data & coverage
What this package adds over the mirror is futures, options and fixed income. Version 5.4.0 lists
211 calendar names including aliases, 106 distinct calendars: 70 mirrored from
exchange_calendars and 36 of its own. The 36 cover fourteen equity exchanges written natively
(NYSE, LSE, TSX, B3, JPX, OSE, HKEX, SSE, NSE, BSE, ASX, SIX, TASE, IEX), CME product calendars by Globex
group — equity, FX, fixed income, energy and metals, grains, livestock, crypto — plus a
CME_TradeDate calendar for settlement-date users, ICE and the CBOE Futures Exchange, separate
CBOE equity-options and index-options calendars (index options close at 18:15 UTC on the day
after Thanksgiving 2026, equity options at 18:00), Eurex with a pre- and post-session variant,
SIFMA bond-market calendars for the US, UK and Japan, and a forex calendar.
CME calendars use Globex session dates: the 23 December 2026 CME_Equity session opens at 23:00
UTC on the 22nd. Since 5.3.0 a calendar can carry sources — the NYSE class cites the
exchange's hours page, last verified 24 January 2025.
The calendars are package code, not a feed. Nothing is fetched at runtime, and a correction reaches you only by upgrading.
Integrations
Built for pandas: schedules are DataFrames, ranges are DatetimeIndexes, and time zones use the standard library's zoneinfo since version 5.0. exchange_calendars sits underneath, so a reader already using XNYS-style codes keeps them.
Limitations
- Fixes reach
devbefore PyPI. Issue #464 reported five wrong 2026 early closes on CME Globex energy and metals; the fix was merged todevon 12 July 2026 and is in no release.masterlast moved on 27 May 2026. - Two layers to keep current. The mirrored calendars are whatever exchange_calendars version is installed, and that project has its own release lag.
- Two calendars for one exchange. NYSE and XNYS are separate code paths; agreeing over two decades today is no promise both receive tomorrow's fix at once.
- Contributed calendars. The docs credit individual creators per calendar, and several have no unit tests on the status page — TASE, ASX and BMF among them.
- Regular sessions only by default; pre- and post-market need explicit arguments and exist only where a calendar defines them.
Alternatives
exchange_calendars on its own, if equity sessions under ISO codes are all you need — one dependency fewer. A trading calendar as data sets both libraries beside the market-holiday endpoints of data APIs, and covers when a trading calendar is the wrong tool for counting settlement days.
Specs
- Interfaces
- Python, Python
- Export
- None
- Asset classes
- Stocks, Futures, Options, Forex, Bonds
- Markets
- Global
- Platforms
- Library
- AI features
- None
- Pricing verified
- Capabilities verified
- Coverage verified
Also worth comparing
- exchange_calendars — Sessions, minutes and holidays for 69 exchanges, keyed by ISO-10383 code.
- arch — GARCH and the rest of the volatility-model family, plus the tests you need around them.
- pandas-ta — The DataFrame indicator library whose repo is gone and whose last release is a year old.
- PyPortfolioOpt — Prices in, weights out — efficient frontier, Black-Litterman and HRP.
- QuantLib — The open-source derivatives pricing library banks actually use, reachable from Python.
- Riskfolio-Lib — Twenty-six convex risk measures, four objectives, one cvxpy-backed optimiser.
FAQ
Do I need exchange_calendars as well?
You get it either way. pandas_market_calendars 5.4.0 declares exchange-calendars>=3.3 as a dependency, so pip installs it alongside — on 4 October 2026 that resolved to exchange_calendars 4.13.2. Its calendars are exposed through get_calendar() under their ISO codes next to this package's own.
Is pandas_market_calendars maintained?
Yes, by its author Ryan Sheftel with outside contributors. Version 5.4.0 reached PyPI on 27 May 2026, the seventh release of 2026, and the dev branch took a CME energy-and-metals fix on 12 July 2026 that is not yet released. The repository is not archived; 12 issues and 12 pull requests were open on 4 October 2026.
Why do NYSE and XNYS both exist?
NYSE is this package's own calendar class and XNYS is the copy mirrored from exchange_calendars — two implementations of one exchange. On 4 October 2026 they returned the same 5,281 sessions and closing times from 4 October 2006 to 4 October 2027 inclusive; the native NYSE also goes back as far as 1900.
What licence is it under?
MIT, per the LICENSE file in the repository and the PyPI classifier. A NOTICE file credits Quantopian's Zipline, from which the core was forked, and reproduces its Apache 2.0 licence.