From b2b7ea0063efeddf170ac779693d9e47725b7f9d Mon Sep 17 00:00:00 2001 From: Eddie Hebert Date: Tue, 4 Dec 2012 14:08:30 -0500 Subject: [PATCH] Adds closings due to 9/11 attacks. --- zipline/utils/tradingcalendar.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/zipline/utils/tradingcalendar.py b/zipline/utils/tradingcalendar.py index ac2c2638..dbf308fb 100644 --- a/zipline/utils/tradingcalendar.py +++ b/zipline/utils/tradingcalendar.py @@ -128,3 +128,21 @@ for rule in non_trading_rules: non_trading_ruleset.rrule(rule) non_trading_days = non_trading_ruleset.between(start, end, inc=True) + +# Add September 11th closings +# http://en.wikipedia.org/wiki/Aftermath_of_the_September_11_attacks +# Due to the terrorist attacks, the stock market did not open on 9/11/2001 +# It did not open again until 9/17/2001. +# +# September 2001 +# Su Mo Tu We Th Fr Sa +# 1 +# 2 3 4 5 6 7 8 +# 9 10 11 12 13 14 15 +# 16 17 18 19 20 21 22 +# 23 24 25 26 27 28 29 +# 30 + +for day_num in range(11, 17): + non_trading_days.append( + datetime(2001, 9, day_num, tzinfo=pytz.utc))