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

BUG: Fix christmas early closes to work around 1945/1956 Christmas closings #204

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
8 changes: 6 additions & 2 deletions trading_calendars/exchange_calendar_cmes.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
from .us_holidays import (
USNewYearsDay,
Christmas,
ChristmasEveBefore1993,
ChristmasEveBefore1945,
ChristmasEveBefore1946To1955,
ChristmasEveAfter1957Before1993,
ChristmasEveInOrAfter1993,
USBlackFridayInOrAfter1993,
USNationalDaysofMourning,
Expand Down Expand Up @@ -102,7 +104,9 @@ def special_closes(self):
USIndependenceDay,
USThanksgivingDay,
USBlackFridayInOrAfter1993,
ChristmasEveBefore1993,
ChristmasEveBefore1945,
ChristmasEveBefore1946To1955,
ChristmasEveAfter1957Before1993,
ChristmasEveInOrAfter1993,
])
)]
13 changes: 10 additions & 3 deletions trading_calendars/exchange_calendar_xnys.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
August45VictoryOverJapan,
Christmas,
ChristmasBefore1954,
ChristmasEveBefore1993,
ChristmasEveBefore1945,
ChristmasEveBefore1946To1955,
ChristmasEveAfter1957Before1993,
ChristmasEveInOrAfter1993,
ChristmasEvesAdhoc,
DayAfterChristmasAdhoc,
Expand Down Expand Up @@ -235,7 +237,12 @@ def special_closes(self):
(
time(14),
HolidayCalendar(
[ChristmasEveBefore1993, USBlackFridayBefore1993, ]
[
ChristmasEveBefore1945,
ChristmasEveBefore1946To1955,
ChristmasEveAfter1957Before1993,
USBlackFridayBefore1993,
]
),
),
]
Expand All @@ -246,7 +253,7 @@ def special_closes_adhoc(self):
(
self.regular_early_close,
DatetimeIndex(
["1997-12-26", "1999-12-31", "2003-12-26", ], tz=UTC,
["1997-12-26", "1999-12-31", "2003-12-26"], tz=UTC,
),
)
]
22 changes: 20 additions & 2 deletions trading_calendars/us_holidays.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,29 @@ def following_tuesday_every_four_years_observance(dt):

# These have the same definition, but are used in different places because the
# NYSE closed at 2:00 PM on Christmas Eve until 1993.
ChristmasEveBefore1993 = Holiday(
ChristmasEveBefore1945 = Holiday(
"Christmas Eve",
month=12,
day=24,
end_date=Timestamp("1993-01-01"),
end_date=Timestamp("1945-12-01"),
# When Christmas is a Saturday, the 24th is a full holiday.
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY),
)
ChristmasEveBefore1946To1955 = Holiday(
"Christmas Eve",
month=12,
day=24,
start_date=Timestamp("1946-01-01"),
end_date=Timestamp("1956-01-01"),
# When Christmas is a Saturday, the 24th is a full holiday.
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY),
)
ChristmasEveAfter1957Before1993 = Holiday(
"Christmas Eve",
month=12,
day=24,
start_date=Timestamp("1957-01-01"),
end_date=Timestamp("1992-12-31"),
# When Christmas is a Saturday, the 24th is a full holiday.
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY),
)
Expand Down