exchange_calendars

Sessions, minutes and holidays for 69 exchanges, keyed by ISO-10383 code.

by Gerry Manoim

Last updated

From
Free
Licence
Apache-2.0
Self-hosted
Yes
Platforms
Library, CLI

What it is

xcals.get_calendar("XNYS") returns a calendar object, and everything follows from that. The schedule property is a DataFrame indexed by session with open, break_start, break_end and close columns in UTC, so a Hong Kong lunch break or a US half-day before Independence Day is data rather than a special case you code around. On top of it sit session helpers (is_session, sessions_in_range, sessions_window, previous_session, date_to_session), minute helpers (session_minutes, is_trading_minute, is_break_minute, previous_minute) and trading_index, which builds a period index that skips everything the exchange was closed for.

Calendars are named by their ISO-10383 market identifier code — XNYS, XLON, XTKS, CMES — and the README table lists 69 of them, from the New York Stock Exchange in version 1.0 to Dubai Financial Market on master today. There is also a command-line entry point — ecal XNYS 2020 prints a unix-cal style year with the holidays in brackets.

Pricing

Free, Apache-2.0, nothing to buy. pip install exchange_calendars, with pandas, numpy, toolz, tzdata, pyluach and korean_lunar_calendar behind it — the last two because Israeli and Korean holidays are not solvable with a Gregorian rule.

Data & coverage

69 exchange calendars covering the Americas, Europe, Asia, the Middle East, Africa and Australasia, mostly equity venues plus a handful of derivative and energy ones — CME, CBOE Futures, ICE US, Eurex and the European Energy Exchange. Sessions, lunch breaks, early closes and one-off interruptions are all modelled; an exchange counts as open only during regular trading, so pre-market, post-market and auction periods read as closed.

The calendars are package code, not a feed. Nothing is requested from a server at runtime, which means a corrected holiday reaches you by upgrading the package — and, when the release cadence slows down, by installing from git.

Integrations

Zipline-reloaded takes these codes directly through its --trading-calendar flag. pandas_market_calendars mirrors the whole set and depends on this package; market_prices, by the same maintainer who does most of the work here, is built on it.

Limitations

  • Every calendar is contributed by users. The README says so plainly — if a holiday is wrong, the fix is a pull request you write. How accurate a given exchange is depends on who last cared about it.
  • Releases lag the fixes. The last PyPI release is 4.13.2 from 10 March 2026, while master has carried the Dubai calendar since 14 August 2026 and Hong Kong weather closures since 15 September 2026. Six months of calendar corrections currently exist only in git.
  • The default schedule window is twenty years back and one year forward, and future sessions are rule-generated rather than confirmed against an exchange notice.
  • Versions 4.0 and 4.3 renamed or removed several dozen methods, and the README carries a long deprecation table. Code written against trading_calendars or early exchange_calendars will need edits.
  • PyPI classifies it Development Status :: 4 - Beta.
  • No intraday auction, settlement or holiday-reason metadata — you get open and closed, not why.

Alternatives

pandas_market_calendars mirrors these calendars behind a schedule() and date_range() API and adds futures, options and bond calendars of its own, at the cost of a second layer to keep current — and its native NYSE calendar is separate code from the mirrored XNYS. If all you need is US equity sessions, a market data API that already returns bars on an exchange calendar — see market data APIs — removes the question. A trading calendar as data sets this library beside the holiday endpoints of Massive and EODHD, and covers why a trading calendar is the wrong one for counting settlement days.

Specs

Interfaces
Python, Python
Export
None
Asset classes
Stocks, Futures
Markets
Global
Platforms
Library, CLI
AI features
None
Pricing verified
Capabilities verified
Coverage verified

Also worth comparing

  • pandas_market_calendars — Exchange schedules as pandas DataFrames, with CME, CBOE options and bond-market calendars.
  • pandas-ta — The DataFrame indicator library whose repo is gone and whose last release is a year old.
  • QuantLib — The open-source derivatives pricing library banks actually use, reachable from Python.
  • TA-Lib — The C indicator library everything else wraps — and pip now ships the C part with it.
  • arch — GARCH and the rest of the volatility-model family, plus the tests you need around them.
  • empyrical-reloaded — The maintained fork of Quantopian's empyrical — risk statistics, no plots.

FAQ

Is exchange_calendars maintained?

The code is, the releases less so. Commits land most weeks — the newest on master is 15 September 2026 — but the last PyPI release, 4.13.2, went out on 10 March 2026. Gerry Manoim owns the repository and Marcus Read does most of the current work; 21 issues and 7 pull requests are open and nothing is archived.

Where did it come from?

Quantopian's trading_calendars, which stopped at version 2.1.1 on 5 January 2021 and saw its last commit on 20 January 2021. exchange_calendars is the continuation and kept the Apache-2.0 licence; the calendar codes are the same, which is why Zipline-reloaded's --trading-calendar flag still takes them.

How far into the future do the calendars go?

One year by default, and twenty years back — GLOBAL_DEFAULT_START and GLOBAL_DEFAULT_END in the source. You can ask for a wider range, but only within the bounds each individual calendar declares, and future holidays are generated from rules rather than from an exchange's published notice.

Is pandas_market_calendars the same thing?

No, it is a separate package by a different author — Ryan Sheftel, MIT-licensed — with its own schedule() and date_range() API. Since its version 2.0 it mirrors these calendars and lists exchange-calendars as a dependency, so choosing it does not mean leaving this project behind; it means adding a layer on top of it.

Report an error on this page

Quote the line and say what it should be.

The vendor’s page, filing or documentation that says otherwise.

Only if you want to hear back. Never published.

Read by a person. It fixes a fact and moves nothing else.

Anything else — a question this page leaves open, a tool it should be compared with? Write to feedback@stockmarketstack.com.

Is this your product? Claim this listing.