Skip to content

Commit

Permalink
Update NYSE holidays: fix New Year's Day observed (#1585)
Browse files Browse the repository at this point in the history
  • Loading branch information
KJhellico committed Dec 7, 2023
1 parent 3e5174b commit 2c890a2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
9 changes: 5 additions & 4 deletions holidays/financial/ny_stock_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def _populate(self, year):
# New Year's Day.
name = "New Year's Day"
self._move_holiday(self._add_new_years_day(name))
self._add_observed(self._next_year_new_years_day, name)

# MLK, 3rd Monday of January.
if year >= 1998:
Expand Down Expand Up @@ -169,7 +168,6 @@ class NewYorkStockExchangeStaticHolidays:
(JAN, 28, "Heatless Day"),
(FEB, 4, "Heatless Day"),
(FEB, 11, "Heatless Day"),
(JUN, 14, "Heatless Day"),
(SEP, 12, "Draft Registration Day"),
(NOV, 11, "Armistice Day"),
),
Expand All @@ -183,7 +181,10 @@ class NewYorkStockExchangeStaticHolidays:
(AUG, 10, "Funeral of President Warren G. Harding"),
),
1927: (JUN, 13, "Parade for Colonel Charles Lindbergh"),
1929: (NOV, 29, "Catch Up Day"),
1929: (
(NOV, 1, "Catch Up Day"),
(NOV, 29, "Catch Up Day"),
),
1933: (
(MAR, 6, "Special Bank Holiday"),
(MAR, 7, "Special Bank Holiday"),
Expand Down Expand Up @@ -215,7 +216,7 @@ class NewYorkStockExchangeStaticHolidays:
),
1972: (DEC, 28, "Funeral for President Harry S. Truman"),
1973: (JAN, 25, "Funeral for President Lyndon B. Johnson"),
1977: (JUL, 14, "Blackout in New Yor City"),
1977: (JUL, 14, "Blackout in New York City"),
1985: (SEP, 27, "Hurricane Gloria"),
1994: (APR, 27, "Funeral for President Richard M. Nixon"),
2001: (
Expand Down
11 changes: 4 additions & 7 deletions tests/financial/test_ny_stock_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,18 @@ def test_new_years(self):
date(1930, JAN, 1),
date(1950, JAN, 2),
date(1999, JAN, 1),
date(1999, DEC, 31),
date(2010, JAN, 1),
date(2018, JAN, 1),
date(2019, JAN, 1),
date(2020, JAN, 1),
date(2021, JAN, 1),
date(2021, DEC, 31),
date(2027, DEC, 31),
):
self.assertHoliday(dt)
self.assertNoHoliday(dt + td(days=-1))
self.assertNoHoliday(dt + td(days=+1))
self.assertNoHoliday(dt + td(days=+7))

# observed on previous year Dec 31
# no observed on previous year Dec 31
for dt in (
date(1994, JAN, 1),
date(2000, JAN, 1),
Expand All @@ -67,7 +64,7 @@ def test_new_years(self):
date(2022, JAN, 1),
):
self.assertNoHoliday(dt)
self.assertHoliday(dt + td(days=-1))
self.assertNoHoliday(dt + td(days=-1))

def test_mlk(self):
for dt in (
Expand Down Expand Up @@ -398,7 +395,6 @@ def test_special_holidays(self):
date(1918, JAN, 28), # Heatless Day
date(1918, FEB, 4), # Heatless Day
date(1918, FEB, 11), # Heatless Day
date(1918, JUN, 14), # Heatless Day
date(1918, SEP, 12), # Draft Registration Day
date(1918, NOV, 11), # Armistice Day
date(1919, MAR, 25), # Homecoming Day for 27th Division
Expand All @@ -407,6 +403,7 @@ def test_special_holidays(self):
date(1923, AUG, 3), # Death of President Warren G. Harding
date(1923, AUG, 10), # Funeral of President Warren G. Harding
date(1927, JUN, 13), # Parade for Colonel Charles Lindbergh
date(1929, NOV, 1), # Catch Up Day
date(1929, NOV, 29), # Catch Up Day
date(1945, AUG, 15), # V-J Day (WWII)
date(1945, AUG, 16), # V-J Day (WWII)
Expand All @@ -424,7 +421,7 @@ def test_special_holidays(self):
date(1969, JUL, 21), # National Participation in Lunar Exploration
date(1972, DEC, 28), # Funeral for President Harry S. Truman
date(1973, JAN, 25), # Funeral for President Lyndon B. Johnson
date(1977, JUL, 14), # Blackout in New Yor City
date(1977, JUL, 14), # Blackout in New York City
date(1985, SEP, 27), # Hurricane Gloria
date(1994, APR, 27), # Funeral for President Richard M. Nixon
date(2001, SEP, 11), # Closed for Sept 11, 2001 Attacks
Expand Down

0 comments on commit 2c890a2

Please sign in to comment.