Skip to main content
=======================
Market calendars to use with pandas for trading applications.

.. image:: https://badge.fury.io/py/pandas-market-calendars.svg
:target: https://badge.fury.io/py/pandas-market-calendars

.. image:: https://travis-ci.org/rsheftel/pandas_market_calendars.svg?branch=master
:target: https://travis-ci.org/rsheftel/pandas_market_calendars

.. image:: https://coveralls.io/repos/github/rsheftel/pandas_market_calendars/badge.svg?branch=master
:target: https://coveralls.io/github/rsheftel/pandas_market_calendars?branch=master

.. image:: https://landscape.io/github/rsheftel/pandas_market_calendars/master/landscape.svg?style=flat
:target: https://landscape.io/github/rsheftel/pandas_market_calendars/master
:alt: Code Health

.. image:: https://readthedocs.org/projects/pandas-market-calendars/badge/?version=latest
:target: http://pandas-market-calendars.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status

Documentation
-------------
http://pandas_market_calendars.readthedocs.io/en/latest/

Overview
--------
The Pandas package is widely used in finance and specifically for time series analysis. It includes excellent
functionality for generating sequences of dates and capabilities for custom holiday calendars, but as an explicit
design choice it does not include the actual holiday calendars for specific exchanges or OTC markets.

The pandas_market_calendars package looks to fill that role with the holiday, late open and early close calendars
for specific exchanges and OTC conventions. pandas_market_calendars also adds several functions to manipulate the
market calendars and includes a date_range function to create a pandas DatetimeIndex including only the datetimes
when the markets are open.

This package is a fork of the Zipline package from Quantopian and extracts just the relevant parts. All credit for
their excellent work to Quantopian.

Installation
------------
``pip install pandas_market_calendars``

Arch Linux package available here: https://aur.archlinux.org/packages/python-pandas_market_calendars/

Quick Start
-----------
.. code:: python

import pandas_market_calendars as mcal

# Create a calendar
nyse = mcal.get_calendar('NYSE')

# Show available calendars
print(mcal.get_calendar_names())

.. code:: python

early = nyse.schedule(start_date='2012-07-01', end_date='2012-07-10')
early


.. parsed-literal::

market_open market_close
=========== ========================= =========================
2012-07-02 2012-07-02 13:30:00+00:00 2012-07-02 20:00:00+00:00
2012-07-03 2012-07-03 13:30:00+00:00 2012-07-03 17:00:00+00:00
2012-07-05 2012-07-05 13:30:00+00:00 2012-07-05 20:00:00+00:00
2012-07-06 2012-07-06 13:30:00+00:00 2012-07-06 20:00:00+00:00
2012-07-09 2012-07-09 13:30:00+00:00 2012-07-09 20:00:00+00:00
2012-07-10 2012-07-10 13:30:00+00:00 2012-07-10 20:00:00+00:00


.. code:: python

mcal.date_range(early, frequency='1D')




.. parsed-literal::

DatetimeIndex(['2012-07-02 20:00:00+00:00', '2012-07-03 17:00:00+00:00',
'2012-07-05 20:00:00+00:00', '2012-07-06 20:00:00+00:00',
'2012-07-09 20:00:00+00:00', '2012-07-10 20:00:00+00:00'],
dtype='datetime64[ns, UTC]', freq=None)



.. code:: python

mcal.date_range(early, frequency='1H')




.. parsed-literal::

DatetimeIndex(['2012-07-02 14:30:00+00:00', '2012-07-02 15:30:00+00:00',
'2012-07-02 16:30:00+00:00', '2012-07-02 17:30:00+00:00',
'2012-07-02 18:30:00+00:00', '2012-07-02 19:30:00+00:00',
'2012-07-02 20:00:00+00:00', '2012-07-03 14:30:00+00:00',
'2012-07-03 15:30:00+00:00', '2012-07-03 16:30:00+00:00',
'2012-07-03 17:00:00+00:00', '2012-07-05 14:30:00+00:00',
'2012-07-05 15:30:00+00:00', '2012-07-05 16:30:00+00:00',
'2012-07-05 17:30:00+00:00', '2012-07-05 18:30:00+00:00',
'2012-07-05 19:30:00+00:00', '2012-07-05 20:00:00+00:00',
'2012-07-06 14:30:00+00:00', '2012-07-06 15:30:00+00:00',
'2012-07-06 16:30:00+00:00', '2012-07-06 17:30:00+00:00',
'2012-07-06 18:30:00+00:00', '2012-07-06 19:30:00+00:00',
'2012-07-06 20:00:00+00:00', '2012-07-09 14:30:00+00:00',
'2012-07-09 15:30:00+00:00', '2012-07-09 16:30:00+00:00',
'2012-07-09 17:30:00+00:00', '2012-07-09 18:30:00+00:00',
'2012-07-09 19:30:00+00:00', '2012-07-09 20:00:00+00:00',
'2012-07-10 14:30:00+00:00', '2012-07-10 15:30:00+00:00',
'2012-07-10 16:30:00+00:00', '2012-07-10 17:30:00+00:00',
'2012-07-10 18:30:00+00:00', '2012-07-10 19:30:00+00:00',
'2012-07-10 20:00:00+00:00'],
dtype='datetime64[ns, UTC]', freq=None)

Future
------
This package is open sourced under the MIT license. Everyone is welcome to add more exchanges or OTC markets, confirm
or correct the existing calendars, and generally do whatever they desire with this code.

Keywords: trading exchanges markets OTC datetime holiday business days
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7

Release files for market-calendars 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for market-calendars 0.0.6
File Size Uploaded
market_calendars-0.0.6.tar.gz 22.5 kB Details

Release files / market_calendars-0.0.6.tar.gz

Download URL market_calendars-0.0.6.tar.gz
Size 22.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ba84dadacabfec22a97ed2cb1d574be28dd6773c26fd443d2b02e9c065f78475
BLAKE2b-256 checksum
How to use checksums
5a4071ab1168545207599015ba71aa4c67d6c6bfca0025d8b9f94f7846591002
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5

Release history Release notifications | RSS feed

0.1.6

1 release file

0.1.5

2 release files

0.1.2

1 release file

0.1.0

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

This release

0.0.6 This release

1 release file

0.0.5

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page