exchange_calendars
Calendars for securities exchanges
What it is and what it does
exchange_calendars is a Python library that bundles pre-configured trading calendars for security exchanges worldwide. It abstracts away the complexity of managing exchange-specific holidays, trading hours, and timezone conversions by providing a unified API to query whether a given date or minute is a trading session, retrieve trading schedules with open/close times and breaks, and generate time indices aligned to exchange sessions.
The library depends on pandas for data structures, numpy for numerical operations, tzdata for timezone handling, and specialized libraries for lunar calendar calculations (used by exchanges that observe lunar holidays). It exposes calendars through a simple interface: load a calendar by exchange code, then call methods like `is_session()`, `sessions_in_range()`, `session_minutes()`, or `trading_index()` to get the information you need. A command-line tool is also included for quick calendar visualization.
Use it for:
- Validate whether a timestamp falls within trading hours before executing a trade or backtest.
- Generate a list of all trading days in a date range for a specific exchange to align analysis windows.
- Build minute-level trading indices with custom period lengths (e.g., 90-minute bars) for intraday analysis.
- Determine the next or previous trading session from a given date for scheduling or reconciliation tasks.
- Query exchange schedules including breaks and early closes to understand market microstructure.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides trading calendars for more than 50 security exchanges worldwide, allowing you to query trading sessions, minutes, and schedules with timezone-aware timestamps and holiday handling.
Yes. The package is actively maintained, has no known vulnerabilities, uses a permissive license, and solves a real problem in quantitative finance and trading systems—managing exchange calendars is tedious and error-prone without it. Install it if you work with multiple exchanges or need reliable session/minute-level time alignment.
Install
exchange-calendars on PyPI
pip
pip install exchange-calendarsuv
uv add exchange-calendarspoetry
poetry add exchange-calendarsInstalling exchange_calendars
Before you install
Low install friction with six well-established runtime dependencies (pandas, numpy, toolz, tzdata, and two lunar calendar libraries). Active maintenance with a recent release and steady commit history.
License in practice
Apache-2.0 permissive license allows use in commercial and private projects with minimal restrictions.
Quickstart
pip install exchange_calendars
import exchange_calendars as xcals
xnys = xcals.get_calendar("XNYS")
xnys.sessions_in_range("2022-01-01", "2022-01-11")
Requires Python 3.10 or later.
Verify before relying
- Whether all 50+ exchange calendars are actively maintained and current with recent holiday/schedule changes.
- Performance characteristics when querying large date ranges or generating minute-level trading indices.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (<4,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — pandas, pyluach, toolz, tzdata, korean_lunar_calendar, numpy |
| Maintenance | actively maintained — 157 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 7,230,240/month — #1,765 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: exchange_calendars-4.13.2-py3-none-any.whl
Keywords: finance, security, calendar, exchange
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
pandas_market_calendarsProvides market and exchange trading calendars…
permissive · top 5,000 on PyPI
holidaysGenerates country- and subdivision-specific…
permissive · top 1,000 on PyPI
workalendarWorkalendar provides holiday calendars and…
permissive · top 5,000 on PyPI
exchangelibexchangelib is an ORM-style client library for…
permissive · top 5,000 on PyPI
tradingeconomicsProvides Python access to over 300,000 economic…
permissive · top 15,000 on PyPI
convertdateConverts dates between the Gregorian calendar…
permissive · top 5,000 on PyPI
lunar_pythonConverts between Gregorian (solar) and Chinese…
permissive · top 15,000 on PyPI
hdateProvides Hebrew date information and Jewish…
copyleft · top 15,000 on PyPI
metatrader5Connects Python to MetaTrader 5 Terminal to…
permissive · top 15,000 on PyPI
pyCalverterConverts between different calendar systems,…
copyleft · top 15,000 on PyPI