G20国家/地区的假期档案 [英] Holiday files for G20 countries

查看:65
本文介绍了G20国家/地区的假期档案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为获得适当的金融外汇期权定价,我需要两个日期之间确切的营业天数.对于2个不同的国家,这些日期最多可以是10年.因此,我需要提前知道这两个国家在两个日期之间的假期.我打算暂时将自己限制在G20国家.

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.

有人知道是否存在包含假期清单的Python模块吗?

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

还有其他地方可以找到假期清单/文件吗?

Anywhere else to find holiday lists/files?

推荐答案

更新了novapost的github存储库中的链接.

Updated the link from from novapost's github repo.

我最近遇到了 https://github.com/peopledoc/workalendar . 我在法国使用它,它的工作原理就像一种魅力.

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

这篇关于G20国家/地区的假期档案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆