Skip to content

Commit 6f06484

Browse files
author
Gerry Manoim
committed
BUG: Fix christmas early closes to work around 1945/1956 Christmas closings
1 parent 875de03 commit 6f06484

File tree

3 files changed

+36
-7
lines changed

3 files changed

+36
-7
lines changed

trading_calendars/exchange_calendar_cmes.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
from .us_holidays import (
3131
USNewYearsDay,
3232
Christmas,
33-
ChristmasEveBefore1993,
33+
ChristmasEveBefore1945,
34+
ChristmasEveBefore1946To1955,
35+
ChristmasEveAfter1957Before1993,
3436
ChristmasEveInOrAfter1993,
3537
USBlackFridayInOrAfter1993,
3638
USNationalDaysofMourning,
@@ -102,7 +104,9 @@ def special_closes(self):
102104
USIndependenceDay,
103105
USThanksgivingDay,
104106
USBlackFridayInOrAfter1993,
105-
ChristmasEveBefore1993,
107+
ChristmasEveBefore1945,
108+
ChristmasEveBefore1946To1955,
109+
ChristmasEveAfter1957Before1993,
106110
ChristmasEveInOrAfter1993,
107111
])
108112
)]

trading_calendars/exchange_calendar_xnys.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
August45VictoryOverJapan,
3030
Christmas,
3131
ChristmasBefore1954,
32-
ChristmasEveBefore1993,
32+
ChristmasEveBefore1945,
33+
ChristmasEveBefore1946To1955,
34+
ChristmasEveAfter1957Before1993,
3335
ChristmasEveInOrAfter1993,
3436
ChristmasEvesAdhoc,
3537
DayAfterChristmasAdhoc,
@@ -235,7 +237,12 @@ def special_closes(self):
235237
(
236238
time(14),
237239
HolidayCalendar(
238-
[ChristmasEveBefore1993, USBlackFridayBefore1993, ]
240+
[
241+
ChristmasEveBefore1945,
242+
ChristmasEveBefore1946To1955,
243+
ChristmasEveAfter1957Before1993,
244+
USBlackFridayBefore1993,
245+
]
239246
),
240247
),
241248
]
@@ -246,7 +253,7 @@ def special_closes_adhoc(self):
246253
(
247254
self.regular_early_close,
248255
DatetimeIndex(
249-
["1997-12-26", "1999-12-31", "2003-12-26", ], tz=UTC,
256+
["1997-12-26", "1999-12-31", "2003-12-26"], tz=UTC,
250257
),
251258
)
252259
]

trading_calendars/us_holidays.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,29 @@ def following_tuesday_every_four_years_observance(dt):
4646

4747
# These have the same definition, but are used in different places because the
4848
# NYSE closed at 2:00 PM on Christmas Eve until 1993.
49-
ChristmasEveBefore1993 = Holiday(
49+
ChristmasEveBefore1945 = Holiday(
5050
"Christmas Eve",
5151
month=12,
5252
day=24,
53-
end_date=Timestamp("1993-01-01"),
53+
end_date=Timestamp("1945-12-01"),
54+
# When Christmas is a Saturday, the 24th is a full holiday.
55+
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY),
56+
)
57+
ChristmasEveBefore1946To1955 = Holiday(
58+
"Christmas Eve",
59+
month=12,
60+
day=24,
61+
start_date=Timestamp("1946-01-01"),
62+
end_date=Timestamp("1956-01-01"),
63+
# When Christmas is a Saturday, the 24th is a full holiday.
64+
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY),
65+
)
66+
ChristmasEveAfter1957Before1993 = Holiday(
67+
"Christmas Eve",
68+
month=12,
69+
day=24,
70+
start_date=Timestamp("1957-01-01"),
71+
end_date=Timestamp("1992-12-31"),
5472
# When Christmas is a Saturday, the 24th is a full holiday.
5573
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY),
5674
)

0 commit comments

Comments
 (0)