Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify trading hours to suit ASX Single Closing Price Auction time + Good Friday early close 92-08 #121

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,4 @@ TAGS

etc/lunar-ecliptic-longitude/*
etc/solar-ecliptic-longitude/*
/trading_calendars.pyproj
16 changes: 14 additions & 2 deletions trading_calendars/exchange_calendar_xasx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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'

Expand All @@ -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
Expand Down Expand Up @@ -186,6 +197,7 @@ def special_closes(self):
HolidayCalendar([
LastTradingDayBeforeChristmas,
LastTradingDayOfCalendarYear,
LastTradingDayBeforeGoodFriday1992To2008,
]),
),
]