diff --git a/src/quant_platform_kit/common/cn_equity_calendar.py b/src/quant_platform_kit/common/cn_equity_calendar.py index f4aeefe..7d879f3 100644 --- a/src/quant_platform_kit/common/cn_equity_calendar.py +++ b/src/quant_platform_kit/common/cn_equity_calendar.py @@ -5,9 +5,28 @@ CN_EQUITY_TIMEZONE = "Asia/Shanghai" -# Weekday holidays on SSE/SZSE calendars (2024-01-01 .. 2026-12-31), sourced from AkShare trade-date history. +# Weekday holidays on SSE/SZSE calendars (2023-01-01 .. 2026-12-31), sourced from the official +# SSE/SZSE holiday notices for 2023 and the existing trade-date history for later years. CN_EQUITY_HOLIDAYS: frozenset[str] = frozenset( { + "2023-01-02", + "2023-01-23", + "2023-01-24", + "2023-01-25", + "2023-01-26", + "2023-01-27", + "2023-04-05", + "2023-05-01", + "2023-05-02", + "2023-05-03", + "2023-06-22", + "2023-06-23", + "2023-09-29", + "2023-10-02", + "2023-10-03", + "2023-10-04", + "2023-10-05", + "2023-10-06", "2024-01-01", "2024-02-09", "2024-02-12", diff --git a/tests/test_cn_equity_calendar.py b/tests/test_cn_equity_calendar.py index 82f29f2..5cefd93 100644 --- a/tests/test_cn_equity_calendar.py +++ b/tests/test_cn_equity_calendar.py @@ -25,6 +25,36 @@ def test_new_year_holiday_is_not_trading_day(self) -> None: def test_regular_weekday_is_trading_day(self) -> None: self.assertTrue(is_cn_equity_trading_day("2024-01-02")) + def test_2023_weekday_holidays_are_not_trading_days(self) -> None: + closed_days = ( + "2023-01-02", + "2023-01-23", + "2023-01-24", + "2023-01-25", + "2023-01-26", + "2023-01-27", + "2023-04-05", + "2023-05-01", + "2023-05-02", + "2023-05-03", + "2023-06-22", + "2023-06-23", + "2023-09-29", + "2023-10-02", + "2023-10-03", + "2023-10-04", + "2023-10-05", + "2023-10-06", + ) + for day in closed_days: + with self.subTest(day=day): + self.assertFalse(is_cn_equity_trading_day(day)) + + def test_2023_post_holiday_weekdays_are_trading_days(self) -> None: + for day in ("2023-01-03", "2023-01-30", "2023-04-06", "2023-05-04", "2023-06-26", "2023-10-09"): + with self.subTest(day=day): + self.assertTrue(is_cn_equity_trading_day(day)) + def test_next_trading_day_skips_weekend_and_holiday(self) -> None: self.assertEqual(next_cn_equity_trading_day("2024-02-08"), date(2024, 2, 19))