2
$\begingroup$

Is there a reliable machine readable source of stock market holiday calendars?

I found this source: https://eresearch.fidelity.com/eresearch/markets_sectors/global/holidayCalendar.jhtml

I could scrape it, but honestly, I have my doubts about it staying well formatted and conforming over time, or even exist at all over time. Also it doesn't seem to have historic data, including abnormal close times like 9/11.

A good thing about it is that it includes special close times. Some markets close early on some days, notably Stockholm has a bunch of them.

2020-06-08 Edit: My worries turned out to be warranted. The source now just reads:

International Holiday Calendar permanently unavailable.

$\endgroup$
1

2 Answers 2

2
$\begingroup$

The best most comprehensive (and therefore not free) calendar service I know of is at Swaps Monitor - sounds very fixed income-y, but they also have stock market calendar data. If you are doing something in a production environment, this is the sort of thing you want.

http://www.financialcalendar.com/Data/Holidays/Overview

$\endgroup$
2
  • $\begingroup$ Thanks! This looks like it. It even includes "Economic events". I'll tag this as the accepted answer if no free alternative shows up. Have an upvote for now. $\endgroup$ Apr 25, 2017 at 21:00
  • 1
    $\begingroup$ Three years later, I now see that I forgot to accept your answer. Done, now. $\endgroup$ Jun 5, 2020 at 20:26
2
$\begingroup$

pandas_market_calendars should do the job. I think there aren't any market calendars that feature 9/11 or the 2012 storm days as holidays.

$\endgroup$
5
  • 1
    $\begingroup$ Thank you. Actually, the zipline library, which this package forks parts of, is what I started with. I've implemented a calendar for Oslo Stock Exchange (OSE) using pandas with the same principles. To be honest, I've come to the opinion that the approach taken here, i.e., programmatically calculating the calendar, is the wrong way to go. It is error prone, does not adjust to future events like 9/11, and is limited to direct use with python unless you export it (which I have). This is such a small dataset that a curated dataset from a data provider makes much more sense. $\endgroup$ Apr 25, 2017 at 16:24
  • $\begingroup$ To its credit, though, it does include some past special events. E.g., September11Closings is a date range in the ` us_holidays.py` module used in exchange_calendar_nyse.py. $\endgroup$ Apr 25, 2017 at 16:26
  • $\begingroup$ Calculating future holidays programmatically would be the right way to go as that ensures the code can run forever without interference. You can pipe out the holidays into any languages you choose, it's not strictly tied to Python. How can you adjust to a future 9/11 type event? $\endgroup$
    – misantroop
    Apr 25, 2017 at 20:23
  • $\begingroup$ Not sure if curated or programmatic but this is the default web calendar I use. link $\endgroup$
    – misantroop
    Apr 25, 2017 at 20:27
  • $\begingroup$ A curated dataset would be kept constantly updated through a daily load from the data provider’s API, into our systems. If any 9/11 event happens, or the exchanges schedule changes, say a new holiday, the providers would do an update and the changes would appear in our dataset the day after, if not immediately. With this package, changes from the preprogrammed schedule would not be captured. And if it were to be updated we would have to actually wait for, or in worst case contribute to, a software update, for something which should be a simple data update. $\endgroup$ Apr 25, 2017 at 20:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.