def test_special_holidays():
# 9/11
# Sept 11, 12, 13, 14 2001
nyse = NYSEExchangeCalendar()
good_dates = nyse.valid_days('2001-01-01', '2016-12-31')
assert pd.Timestamp("9/11/2001") not in good_dates
assert pd.Timestamp("9/12/2001") not in good_dates
assert pd.Timestamp("9/13/2001") not in good_dates
assert pd.Timestamp("9/14/2001") not in good_dates
# Hurricane Sandy
# Oct 29, 30 2012
assert pd.Timestamp("10/29/2012") not in good_dates
assert pd.Timestamp("10/30/2012") not in good_dates
# various national days of mourning
# Gerald Ford - 1/2/2007
assert pd.Timestamp("1/2/2007") not in good_dates
# Ronald Reagan - 6/11/2004
assert pd.Timestamp("6/11/2004") not in good_dates
# Richard Nixon - 4/27/1994
assert pd.Timestamp("4/27/1994") not in good_dates
test_nyse_calendar.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录