exchange_calendars
Python library with trading calendars for more than 50 exchanges, so your code knows which days are sessions, when markets open, close and take breaks.
Stop guessing market holidays: ask the calendar if a day is a session and when it opens and closes before your bot or backtest runs.
Who it is for
Python users who schedule bots, backtests or data downloads and need to skip non-trading days and respect opening hours.
Strengths
- Over 50 exchanges, identified by ISO 10383 market codes such as XNYS.
- Check whether a date is a session, list sessions in a range and find the previous or nearest one.
- Schedule table with open, break start, break end and close for each session.
- Trading minutes and custom intervals, for example splitting a session into 90-minute blocks.
- Installs with pip, plus an ecal command to print a calendar for an exchange and year.
Good to know
- Calendars are maintained through user contributions: missing holidays or wrong times are fixed by contributing updates, so double-check important dates.
- Trading minutes exclude pre-trading, post-trading, auction periods and lunch breaks.
- Several methods were renamed, deprecated or removed (for example sessions_opens and sessions_closes in 4.3), so check your version against the docs.
- It is a calendar only; it has no price data, indicators or backtesting engine.
Custom bots are coming soon
We are preparing a service to build bots on tools like this one. Follow our Telegram channel to know when it opens.
Real-life uses
Skip market holidays in your bot and backtest schedule
Ask an exchange calendar whether today is a trading session and when it opens and closes, so your script skips holidays and early shutdowns instead of failing or fetching empty data. Illustrative only, never a promise of returns.
Compare it with others
Lightweight Charts vs mplfinance: interactive web charts or Python candlesticks?
Two free ways to draw candlestick charts of your bot's prices or backtest results: TradingView's JavaScript library for interactive web pages and mplfinance for quick Python charts. Compared from checked sources.
TA-Lib vs ta vs FinanceToolkit: free Python libraries for technical indicators
Three free Python libraries compared for RSI, MACD and Bollinger Bands: TA-Lib for 200+ indicators and candlestick patterns, ta for a simple pip install on Pandas, and FinanceToolkit for ratios, indicators and risk metrics. Licences, level and who each suits.
Finnhub vs Alpha Vantage vs Massive (Polygon.io): which market data API for your bot?
The Finnhub Python client, Alpha Vantage and Massive (formerly Polygon.io) compared side by side: coverage, free tier, licence, difficulty and who each one suits.
Guides that use it
Quick answers
How much does exchange_calendars cost?
Free and open source (Apache-2.0 per the GitHub repository). Prices change, so check the official website before you decide.
Is exchange_calendars open source?
Yes. License: Apache-2.0.
Who is exchange_calendars for?
Python users who schedule bots, backtests or data downloads and need to skip non-trading days and respect opening hours.
What is exchange_calendars written in?
exchange_calendars is written in Python.
What should I know before using exchange_calendars?
Calendars are maintained through user contributions: missing holidays or wrong times are fixed by contributing updates, so double-check important dates. Trading minutes exclude pre-trading, post-trading, auction periods and lunch breaks. Several methods were renamed, deprecated or removed (for example sessions_opens and sessions_closes in 4.3), so check your version against the docs. It is a calendar only; it has no price data, indicators or backtesting engine.
Want a bot like this when custom bots open? Get notified · All comparisons · Guides
Sources
Every fact on this page comes from these sources, checked on 2026-11-25. If something has changed, the source wins.
- https://github.com/gerrymanoim/exchange_calendars: 50+ exchanges, sessions, schedule, minutes, ecal command, pip install, Apache-2.0, caveats on minutes and renamed methods
- https://api.github.com/repos/gerrymanoim/exchange_calendars: Apache-2.0 license, about 690 stars, last push 2026-11-24, not archived
Alternatives in Market data
Lightweight Charts
Small, fast open-source JavaScript library from TradingView for showing interactive financial charts, such as candlesticks and lines, on your own web page.
OpenBB
Open-source data platform that connects many data sources and exposes them to Python, a command line, a local REST API and AI agents.
SEC EDGAR APIs
Free JSON APIs from the U.S. Securities and Exchange Commission with company filing histories and XBRL financial facts from 10-K, 10-Q, 8-K and other filings, plus nightly bulk downloads.
TA-Lib (Python wrapper)
Python wrapper for the TA-Lib technical analysis library, with 200+ indicators and 61 candlestick pattern functions that work on NumPy, pandas and Polars data.