Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Holiday files for G20 countries [closed]

Tags:

python

finance

For proper financial FX option pricing I require the exact number of business days between two dates. These dates can be up to 10 years in the future, for 2 different countries. I therefore need to know, in advance the holidays for both of those countries between the two dates. I plan to restrict myself to G20 countries for now.

Anybody know if Python modules exist which have holiday lists included?

Anywhere else to find holiday lists/files?

like image 566
Thomas Browne Avatar asked Jun 22 '09 22:06

Thomas Browne


2 Answers

Edit: Updated the link from from novapost's github repo.

I recently came across https://github.com/peopledoc/workalendar. I use it for France and it works like a charm.

"""
>>> from datetime import date
>>> from workalendar.europe import France
>>> cal = France()
>>> cal.holidays(2013)
[(datetime.date(2013, 1, 1), 'New year'),
 (datetime.date(2013, 4, 1), 'Easter Monday'),
 (datetime.date(2013, 5, 1), 'Labour Day'),
 (datetime.date(2013, 5, 8), 'Victory in Europe Day'),
 (datetime.date(2013, 5, 9), 'Ascension Thursday'),
 (datetime.date(2013, 5, 20), 'Whit Monday'),
 (datetime.date(2013, 5, 30), 'Corpus Christi'),
 (datetime.date(2013, 7, 14), 'Bastille Day'),
 (datetime.date(2013, 8, 15), 'Assumption of Mary to Heaven'),
 (datetime.date(2013, 11, 1), 'All Saints Day'),
 (datetime.date(2013, 11, 11), 'Armistice Day'),
 (datetime.date(2013, 12, 25), 'Christmas Day')]
>>> cal.is_working_day(date(2013, 12, 25))  # it's Christmas
False
>>> cal.is_working_day(date(2013, 12, 29))  # it's Sunday
False
>>> cal.is_working_day(date(2013, 12, 26))
True
like image 120
Andre Miras Avatar answered Oct 23 '22 15:10

Andre Miras


www.bank-holidays.com seems cheaper.

However, if you look at the public holiday for banks in England, you see the following (http://www.direct.gov.uk/en/Governmentcitizensandrights/LivingintheUK/DG_073741)

Special bank holidays

There are laws that allow the dates of bank holidays to be changed, or other holidays to be declared, for example to celebrate special occasions.

The most recent examples of special bank holidays were for the Royal Wedding in 1981, the Millennium holiday in 1999 and the Queen’s Golden Jubilee in 2002.

So. It is not possible to predict holiday in the next ten year. One possibility would be to approximate the number of holiday in a given period.

like image 43
Eolmar Avatar answered Oct 23 '22 15:10

Eolmar