Coder Social home page Coder Social logo

salmansamie / pandas_market_calendars Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rsheftel/pandas_market_calendars

0.0 1.0 0.0 123 KB

Exchange calendars to use with pandas for trading applications

License: MIT License

Shell 0.16% Python 99.84%

pandas_market_calendars's Introduction

pandas_market_calendars

Market calendars to use with pandas for trading applications.

https://travis-ci.org/rsheftel/pandas_market_calendars.svg?branch=master https://coveralls.io/repos/github/rsheftel/pandas_market_calendars/badge.svg?branch=master Code Health 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

Quick Start

import pandas_market_calendars as mcal
nyse = mcal.get_calendar('NYSE')
early = nyse.schedule(start_date='2012-07-01', end_date='2012-07-10')
early
                  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
mcal.date_range(early, frequency='1D')
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)
mcal.date_range(early, frequency='1H')
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.

pandas_market_calendars's People

Contributors

rsheftel avatar pehowell avatar obiben avatar bonesmccoy avatar matthewgilbert avatar

Watchers

Salman Rahman (السميع) avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.