From ad2270a21f16d458e8b4e0f50c91b066f77938a2 Mon Sep 17 00:00:00 2001 From: Richard Dale Date: Wed, 5 Feb 2020 18:45:05 +0800 Subject: [PATCH] Modify trading hours to suit ASX Single Closing Price Auction, add early close for Good Friday 1992-2008 inclusive --- .gitignore | 1 + trading_calendars/exchange_calendar_xasx.py | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 0fe2d77d..42f8da29 100644 --- a/.gitignore +++ b/.gitignore @@ -77,3 +77,4 @@ TAGS etc/lunar-ecliptic-longitude/* etc/solar-ecliptic-longitude/* +/trading_calendars.pyproj diff --git a/trading_calendars/exchange_calendar_xasx.py b/trading_calendars/exchange_calendar_xasx.py index 0dfb8a1b..14835224 100644 --- a/trading_calendars/exchange_calendar_xasx.py +++ b/trading_calendars/exchange_calendar_xasx.py @@ -111,6 +111,17 @@ observance=previous_friday, ) +# Early close on day prior to Good Friday 1992-2008 +LastTradingDayBeforeGoodFriday1992To2008 = Holiday( + "Day prior to Good Friday", + month=1, + day=1, + offset=[Easter(), Day(-3)], + start_date='1992', + end_date='2009' +) + + # additional ad-hoc holidays NYEMonday1984AdHoc = Timestamp('1984-12-31', tz=UTC) NYEMonday1990AdHoc = Timestamp('1990-12-31', tz=UTC) @@ -139,7 +150,7 @@ class XASXExchangeCalendar(TradingCalendar): - Last trading day before Christmas - Last trading day of the calendar year """ - regular_early_close = time(14, 10) + regular_early_close = time(14, 12) # Early close is a variable time 14:10-14:11, for Zipline compatiblity: (14,12) name = 'XASX' @@ -150,7 +161,7 @@ class XASXExchangeCalendar(TradingCalendar): ) close_times = ( - (None, time(16)), + (None, time(16,12)), # Single closing-price auction is a variable time 16:10-16:11, for Zipline compatiblity: (16,12) ) @property @@ -186,6 +197,7 @@ def special_closes(self): HolidayCalendar([ LastTradingDayBeforeChristmas, LastTradingDayOfCalendarYear, + LastTradingDayBeforeGoodFriday1992To2008, ]), ), ]