From 7ffbe414a81f67e69b4e60d6d00b87631e4cf7ff Mon Sep 17 00:00:00 2001 From: Paresh Joshi <194076591+pareshjoshij@users.noreply.github.com> Date: Sat, 25 Jul 2026 14:45:35 +0000 Subject: [PATCH 1/5] Add Singapore Exchange (SGX) holidays --- README.md | 7 ++ holidays/financial/__init__.py | 1 + holidays/financial/singapore_exchange.py | 71 ++++++++++++++ holidays/locale/en_SG/LC_MESSAGES/XSES.po | 45 +++++++++ holidays/locale/en_US/LC_MESSAGES/XSES.po | 45 +++++++++ holidays/locale/th/LC_MESSAGES/XSES.po | 45 +++++++++ holidays/registry.py | 1 + tests/financial/test_singapore_exchange.py | 105 +++++++++++++++++++++ 8 files changed, 320 insertions(+) create mode 100644 holidays/financial/singapore_exchange.py create mode 100644 holidays/locale/en_SG/LC_MESSAGES/XSES.po create mode 100644 holidays/locale/en_US/LC_MESSAGES/XSES.po create mode 100644 holidays/locale/th/LC_MESSAGES/XSES.po create mode 100644 tests/financial/test_singapore_exchange.py diff --git a/README.md b/README.md index 943ef5c126..1eaf607b63 100644 --- a/README.md +++ b/README.md @@ -2045,6 +2045,13 @@ code when available. The following financial markets are available: +Singapore Exchange +XSES +Singapore Exchange (SGX) market holidays +en_SG, en_US, th +HALF_DAY + + SIX Swiss Exchange XSWX SIX Swiss Exchange market holidays diff --git a/holidays/financial/__init__.py b/holidays/financial/__init__.py index 64114de8b4..3898f2bf2d 100644 --- a/holidays/financial/__init__.py +++ b/holidays/financial/__init__.py @@ -29,5 +29,6 @@ from holidays.financial.ny_stock_exchange import NewYorkStockExchange, XNYS, NYSE from holidays.financial.shanghai_stock_exchange import ShanghaiStockExchange, XSHG, SSE from holidays.financial.shenzhen_stock_exchange import ShenzhenStockExchange, XSHE, SZSE +from holidays.financial.singapore_exchange import SingaporeExchange, XSES, SGX from holidays.financial.six_swiss_exchange import SIXSwissExchange, XSWX, SIX from holidays.financial.toronto_stock_exchange import TorontoStockExchange, XTSE, TSX diff --git a/holidays/financial/singapore_exchange.py b/holidays/financial/singapore_exchange.py new file mode 100644 index 0000000000..37f8c6950b --- /dev/null +++ b/holidays/financial/singapore_exchange.py @@ -0,0 +1,71 @@ +# holidays +# -------- +# A fast, efficient Python library for generating country, province and state +# specific sets of holidays on the fly. It aims to make determining whether a +# specific date is a holiday as fast and flexible as possible. +# +# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file) +# dr-prodigy (c) 2017-2023 +# ryanss (c) 2014-2017 +# Website: https://github.com/vacanza/holidays +# License: MIT (see LICENSE file) + +from gettext import gettext as tr + +from holidays.constants import HALF_DAY, PUBLIC +from holidays.countries.singapore import Singapore +from holidays.observed_holiday_base import SAT_SUN_TO_NONE + + +class SingaporeExchange(Singapore): + """Singapore Exchange (SGX) holidays. + + References: + + """ + + country = None # type: ignore[assignment] + market = "XSES" + parent_entity = Singapore + supported_categories: tuple[str, ...] = (HALF_DAY, PUBLIC) # type: ignore[assignment] + start_year = 2000 + observed_label = "%s" + + def _populate_public_holidays(self): + super()._populate_public_holidays() + + for dt in tuple(self): + if self._is_weekend(dt): + self.pop(dt) + + def _populate_half_day_holidays(self): + # %s (markets close at 12:00 p.m. SGT). + pause_label = tr("%s (markets close at 12:00 p.m. SGT)") + + self._move_holiday( + # Christmas Eve. + self._add_christmas_eve(self._format_holiday_name(pause_label, tr("Christmas Eve"))), + rule=SAT_SUN_TO_NONE, + ) + + self._move_holiday( + # New Year's Eve. + self._add_new_years_eve(self._format_holiday_name(pause_label, tr("New Year's Eve"))), + rule=SAT_SUN_TO_NONE, + ) + + self._move_holiday( + # Chinese New Year's Eve. + self._add_chinese_new_years_eve( + self._format_holiday_name(pause_label, tr("Chinese New Year's Eve")) + ), + rule=SAT_SUN_TO_NONE, + ) + + +class XSES(SingaporeExchange): + pass + + +class SGX(SingaporeExchange): + pass diff --git a/holidays/locale/en_SG/LC_MESSAGES/XSES.po b/holidays/locale/en_SG/LC_MESSAGES/XSES.po new file mode 100644 index 0000000000..a0085d103f --- /dev/null +++ b/holidays/locale/en_SG/LC_MESSAGES/XSES.po @@ -0,0 +1,45 @@ +# holidays +# -------- +# A fast, efficient Python library for generating country, province and state +# specific sets of holidays on the fly. It aims to make determining whether a +# specific date is a holiday as fast and flexible as possible. +# +# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file) +# dr-prodigy (c) 2017-2023 +# ryanss (c) 2014-2017 +# Website: https://github.com/vacanza/holidays +# License: MIT (see LICENSE file) +# +# Singapore Exchange (SGX) holidays. +# +msgid "" +msgstr "" +"Project-Id-Version: Holidays 0.102\n" +"Report-Msgid-Bugs-To: l10n@vacanza.dev\n" +"POT-Creation-Date: 2026-07-25 04:57+0000\n" +"PO-Revision-Date: 2026-07-25 04:57+0000\n" +"Last-Translator: Paresh Joshi <194076591+pareshjoshij@users.noreply.github.com>\n" +"Language-Team: Holidays Localization Team\n" +"Language: en_SG\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Lingva 5.0.6\n" +"X-Source-Language: en_SG\n" + +#. %s (markets close at 12:00 p.m. SGT). +#, c-format +msgid "%s (markets close at 12:00 p.m. SGT)" +msgstr "" + +#. Christmas Eve. +msgid "Christmas Eve" +msgstr "" + +#. New Year's Eve. +msgid "New Year's Eve" +msgstr "" + +#. Chinese New Year's Eve. +msgid "Chinese New Year's Eve" +msgstr "" diff --git a/holidays/locale/en_US/LC_MESSAGES/XSES.po b/holidays/locale/en_US/LC_MESSAGES/XSES.po new file mode 100644 index 0000000000..50ca00b55c --- /dev/null +++ b/holidays/locale/en_US/LC_MESSAGES/XSES.po @@ -0,0 +1,45 @@ +# holidays +# -------- +# A fast, efficient Python library for generating country, province and state +# specific sets of holidays on the fly. It aims to make determining whether a +# specific date is a holiday as fast and flexible as possible. +# +# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file) +# dr-prodigy (c) 2017-2023 +# ryanss (c) 2014-2017 +# Website: https://github.com/vacanza/holidays +# License: MIT (see LICENSE file) +# +# Singapore Exchange (SGX) holidays en_US localization. +# +msgid "" +msgstr "" +"Project-Id-Version: Holidays 0.102\n" +"Report-Msgid-Bugs-To: l10n@vacanza.dev\n" +"POT-Creation-Date: 2026-07-25 04:57+0000\n" +"PO-Revision-Date: 2026-07-25 04:57+0000\n" +"Last-Translator: Paresh Joshi \n" +"Language-Team: Holidays Localization Team\n" +"Language: en_US\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Lingva 5.0.6\n" +"X-Source-Language: en_SG\n" + +#. %s (markets close at 12:00 p.m. SGT). +#, c-format +msgid "%s (markets close at 12:00 p.m. SGT)" +msgstr "%s (markets close at 12:00 p.m. SGT)" + +#. Christmas Eve. +msgid "Christmas Eve" +msgstr "Christmas Eve" + +#. New Year's Eve. +msgid "New Year's Eve" +msgstr "New Year's Eve" + +#. Chinese New Year's Eve. +msgid "Chinese New Year's Eve" +msgstr "Chinese New Year's Eve" diff --git a/holidays/locale/th/LC_MESSAGES/XSES.po b/holidays/locale/th/LC_MESSAGES/XSES.po new file mode 100644 index 0000000000..e4076804ac --- /dev/null +++ b/holidays/locale/th/LC_MESSAGES/XSES.po @@ -0,0 +1,45 @@ +# holidays +# -------- +# A fast, efficient Python library for generating country, province and state +# specific sets of holidays on the fly. It aims to make determining whether a +# specific date is a holiday as fast and flexible as possible. +# +# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file) +# dr-prodigy (c) 2017-2023 +# ryanss (c) 2014-2017 +# Website: https://github.com/vacanza/holidays +# License: MIT (see LICENSE file) +# +# Singapore Exchange (SGX) holidays th localization. +# +msgid "" +msgstr "" +"Project-Id-Version: Holidays 0.102\n" +"Report-Msgid-Bugs-To: l10n@vacanza.dev\n" +"POT-Creation-Date: 2026-07-25 04:57+0000\n" +"PO-Revision-Date: 2026-07-25 04:57+0000\n" +"Last-Translator: Paresh Joshi \n" +"Language-Team: Holidays Localization Team\n" +"Language: th\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Lingva 5.0.6\n" +"X-Source-Language: en_SG\n" + +#. %s (markets close at 12:00 p.m. SGT). +#, c-format +msgid "%s (markets close at 12:00 p.m. SGT)" +msgstr "%s (ตลาดปิดเวลา 12:00 น. SGT)" + +#. Christmas Eve. +msgid "Christmas Eve" +msgstr "วันคริสต์มาสอีฟ" + +#. New Year's Eve. +msgid "New Year's Eve" +msgstr "วันสิ้นปี" + +#. Chinese New Year's Eve. +msgid "Chinese New Year's Eve" +msgstr "วันสิ้นปีจีน" diff --git a/holidays/registry.py b/holidays/registry.py index 615cac53b1..d6517c2183 100644 --- a/holidays/registry.py +++ b/holidays/registry.py @@ -301,6 +301,7 @@ "ny_stock_exchange": ("NewYorkStockExchange", "XNYS", "NYSE"), "shanghai_stock_exchange": ("ShanghaiStockExchange", "XSHG", "SSE"), "shenzhen_stock_exchange": ("ShenzhenStockExchange", "XSHE", "SZSE"), + "singapore_exchange": ("SingaporeExchange", "XSES", "SGX"), "six_swiss_exchange": ("SIXSwissExchange", "XSWX", "SIX"), "toronto_stock_exchange": ("TorontoStockExchange", "XTSE", "TSX"), } diff --git a/tests/financial/test_singapore_exchange.py b/tests/financial/test_singapore_exchange.py new file mode 100644 index 0000000000..7b2affd191 --- /dev/null +++ b/tests/financial/test_singapore_exchange.py @@ -0,0 +1,105 @@ +# holidays +# -------- +# A fast, efficient Python library for generating country, province and state +# specific sets of holidays on the fly. It aims to make determining whether a +# specific date is a holiday as fast and flexible as possible. +# +# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file) +# dr-prodigy (c) 2017-2023 +# ryanss (c) 2014-2017 +# Website: https://github.com/vacanza/holidays +# License: MIT (see LICENSE file) + +from unittest import TestCase + +from holidays.financial.singapore_exchange import SingaporeExchange +from tests.common import CommonFinancialTests + + +class TestSingaporeExchange(CommonFinancialTests, TestCase): + @classmethod + def setUpClass(cls): + super().setUpClass(SingaporeExchange) + + def test_code(self): + self.assertTrue(hasattr(self.holidays, "market")) + self.assertIsNone(getattr(self.holidays, "country", None)) + + def test_christmas_eve(self): + name = "Christmas Eve (markets close at 12:00 p.m. SGT)" + self.assertNoHolidayName(name) + self.assertHalfDayNonObservedHolidayName( + name, (f"{year}-12-24" for year in self.full_range) + ) + self.assertHalfDayHolidayName( + name, + "2020-12-24", + "2021-12-24", + "2024-12-24", + "2025-12-24", + "2026-12-24", + ) + self.assertNoHalfDayHolidayName( + name, + "2022-12-24", + "2023-12-24", + ) + + def test_new_years_eve(self): + name = "New Year's Eve (markets close at 12:00 p.m. SGT)" + self.assertNoHolidayName(name) + self.assertHalfDayNonObservedHolidayName( + name, (f"{year}-12-31" for year in self.full_range) + ) + self.assertHalfDayHolidayName( + name, + "2020-12-31", + "2021-12-31", + "2024-12-31", + "2025-12-31", + "2026-12-31", + ) + self.assertNoHalfDayHolidayName( + name, + "2022-12-31", + "2023-12-31", + ) + + def test_chinese_new_years_eve(self): + name = "Chinese New Year's Eve (markets close at 12:00 p.m. SGT)" + self.assertNoHolidayName(name) + self.assertHalfDayHolidayName( + name, + "2020-01-24", + "2021-02-11", + "2022-01-31", + "2024-02-09", + "2025-01-28", + "2026-02-16", + ) + self.assertNoHalfDayHolidayName( + name, + "2023-01-21", + ) + + def test_2025(self): + self.assertHolidaysInYear( + 2025, + ("2025-01-01", "New Year's Day"), + ("2025-01-29", "Chinese New Year"), + ("2025-01-30", "Chinese New Year"), + ("2025-03-31", "Hari Raya Puasa"), + ("2025-04-18", "Good Friday"), + ("2025-05-01", "Labour Day"), + ("2025-05-12", "Vesak Day"), + ("2025-10-20", "Deepavali"), + ("2025-12-25", "Christmas Day"), + ) + + def test_half_day_2025(self): + self.assertHalfDayHolidaysInYear( + 2025, + ("2025-01-28", "Chinese New Year's Eve (markets close at 12:00 p.m. SGT)"), + ("2025-12-24", "Christmas Eve (markets close at 12:00 p.m. SGT)"), + ("2025-12-31", "New Year's Eve (markets close at 12:00 p.m. SGT)"), + ) From c0743b57b3a8dfbeb897c6f1b3b05ef1bcf986bd Mon Sep 17 00:00:00 2001 From: Paresh Joshi <194076591+pareshjoshij@users.noreply.github.com> Date: Sat, 25 Jul 2026 14:56:25 +0000 Subject: [PATCH 2/5] Add Singapore Exchange (SGX) holidays --- holidays/financial/singapore_exchange.py | 2 +- holidays/locale/en_SG/LC_MESSAGES/XSES.po | 4 ++-- holidays/locale/en_US/LC_MESSAGES/XSES.po | 2 +- holidays/locale/th/LC_MESSAGES/XSES.po | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/holidays/financial/singapore_exchange.py b/holidays/financial/singapore_exchange.py index 37f8c6950b..d218260e47 100644 --- a/holidays/financial/singapore_exchange.py +++ b/holidays/financial/singapore_exchange.py @@ -55,8 +55,8 @@ def _populate_half_day_holidays(self): ) self._move_holiday( - # Chinese New Year's Eve. self._add_chinese_new_years_eve( + # Chinese New Year's Eve. self._format_holiday_name(pause_label, tr("Chinese New Year's Eve")) ), rule=SAT_SUN_TO_NONE, diff --git a/holidays/locale/en_SG/LC_MESSAGES/XSES.po b/holidays/locale/en_SG/LC_MESSAGES/XSES.po index a0085d103f..700c8f03d0 100644 --- a/holidays/locale/en_SG/LC_MESSAGES/XSES.po +++ b/holidays/locale/en_SG/LC_MESSAGES/XSES.po @@ -17,8 +17,8 @@ msgstr "" "Project-Id-Version: Holidays 0.102\n" "Report-Msgid-Bugs-To: l10n@vacanza.dev\n" "POT-Creation-Date: 2026-07-25 04:57+0000\n" -"PO-Revision-Date: 2026-07-25 04:57+0000\n" -"Last-Translator: Paresh Joshi <194076591+pareshjoshij@users.noreply.github.com>\n" +"PO-Revision-Date: 2026-07-25 14:54+0000\n" +"Last-Translator: Paresh Joshi \n" "Language-Team: Holidays Localization Team\n" "Language: en_SG\n" "MIME-Version: 1.0\n" diff --git a/holidays/locale/en_US/LC_MESSAGES/XSES.po b/holidays/locale/en_US/LC_MESSAGES/XSES.po index 50ca00b55c..ae6a64f27b 100644 --- a/holidays/locale/en_US/LC_MESSAGES/XSES.po +++ b/holidays/locale/en_US/LC_MESSAGES/XSES.po @@ -17,7 +17,7 @@ msgstr "" "Project-Id-Version: Holidays 0.102\n" "Report-Msgid-Bugs-To: l10n@vacanza.dev\n" "POT-Creation-Date: 2026-07-25 04:57+0000\n" -"PO-Revision-Date: 2026-07-25 04:57+0000\n" +"PO-Revision-Date: 2026-07-25 14:54+0000\n" "Last-Translator: Paresh Joshi \n" "Language-Team: Holidays Localization Team\n" "Language: en_US\n" diff --git a/holidays/locale/th/LC_MESSAGES/XSES.po b/holidays/locale/th/LC_MESSAGES/XSES.po index e4076804ac..1e6cd9f4c9 100644 --- a/holidays/locale/th/LC_MESSAGES/XSES.po +++ b/holidays/locale/th/LC_MESSAGES/XSES.po @@ -17,7 +17,7 @@ msgstr "" "Project-Id-Version: Holidays 0.102\n" "Report-Msgid-Bugs-To: l10n@vacanza.dev\n" "POT-Creation-Date: 2026-07-25 04:57+0000\n" -"PO-Revision-Date: 2026-07-25 04:57+0000\n" +"PO-Revision-Date: 2026-07-25 14:54+0000\n" "Last-Translator: Paresh Joshi \n" "Language-Team: Holidays Localization Team\n" "Language: th\n" From 1ecbe67931cf01a75183ac296a959eebf83b62fc Mon Sep 17 00:00:00 2001 From: Paresh Joshi <194076591+pareshjoshij@users.noreply.github.com> Date: Sat, 25 Jul 2026 18:31:32 +0000 Subject: [PATCH 3/5] Apply suggestions --- holidays/financial/singapore_exchange.py | 4 +- holidays/locale/th/LC_MESSAGES/XSES.po | 2 +- tests/financial/test_singapore_exchange.py | 88 +++++++++++++++------- 3 files changed, 63 insertions(+), 31 deletions(-) diff --git a/holidays/financial/singapore_exchange.py b/holidays/financial/singapore_exchange.py index d218260e47..3836105076 100644 --- a/holidays/financial/singapore_exchange.py +++ b/holidays/financial/singapore_exchange.py @@ -31,8 +31,8 @@ class SingaporeExchange(Singapore): start_year = 2000 observed_label = "%s" - def _populate_public_holidays(self): - super()._populate_public_holidays() + def _populate_common_holidays(self): + super()._populate_common_holidays() for dt in tuple(self): if self._is_weekend(dt): diff --git a/holidays/locale/th/LC_MESSAGES/XSES.po b/holidays/locale/th/LC_MESSAGES/XSES.po index 1e6cd9f4c9..e6c51aa109 100644 --- a/holidays/locale/th/LC_MESSAGES/XSES.po +++ b/holidays/locale/th/LC_MESSAGES/XSES.po @@ -42,4 +42,4 @@ msgstr "วันสิ้นปี" #. Chinese New Year's Eve. msgid "Chinese New Year's Eve" -msgstr "วันสิ้นปีจีน" +msgstr "วันก่อนวันตรุษจีน" diff --git a/tests/financial/test_singapore_exchange.py b/tests/financial/test_singapore_exchange.py index 7b2affd191..eb751d30ee 100644 --- a/tests/financial/test_singapore_exchange.py +++ b/tests/financial/test_singapore_exchange.py @@ -19,6 +19,7 @@ class TestSingaporeExchange(CommonFinancialTests, TestCase): @classmethod def setUpClass(cls): + cls.full_range = range(2000, 2027) super().setUpClass(SingaporeExchange) def test_code(self): @@ -27,42 +28,20 @@ def test_code(self): def test_christmas_eve(self): name = "Christmas Eve (markets close at 12:00 p.m. SGT)" + years_absent = {2000, 2005, 2006, 2011, 2016, 2017, 2022, 2023} self.assertNoHolidayName(name) + self.assertNoHalfDayHolidayName(name, (f"{year}-12-24" for year in years_absent)) self.assertHalfDayNonObservedHolidayName( - name, (f"{year}-12-24" for year in self.full_range) - ) - self.assertHalfDayHolidayName( - name, - "2020-12-24", - "2021-12-24", - "2024-12-24", - "2025-12-24", - "2026-12-24", - ) - self.assertNoHalfDayHolidayName( - name, - "2022-12-24", - "2023-12-24", + name, (f"{year}-12-24" for year in self.full_range if year not in years_absent) ) def test_new_years_eve(self): name = "New Year's Eve (markets close at 12:00 p.m. SGT)" + years_absent = {2000, 2005, 2006, 2011, 2016, 2017, 2022, 2023} self.assertNoHolidayName(name) + self.assertNoHalfDayHolidayName(name, (f"{year}-12-31" for year in years_absent)) self.assertHalfDayNonObservedHolidayName( - name, (f"{year}-12-31" for year in self.full_range) - ) - self.assertHalfDayHolidayName( - name, - "2020-12-31", - "2021-12-31", - "2024-12-31", - "2025-12-31", - "2026-12-31", - ) - self.assertNoHalfDayHolidayName( - name, - "2022-12-31", - "2023-12-31", + name, (f"{year}-12-31" for year in self.full_range if year not in years_absent) ) def test_chinese_new_years_eve(self): @@ -103,3 +82,56 @@ def test_half_day_2025(self): ("2025-12-24", "Christmas Eve (markets close at 12:00 p.m. SGT)"), ("2025-12-31", "New Year's Eve (markets close at 12:00 p.m. SGT)"), ) + + def test_l10n_default(self): + self.assertLocalizedHolidays( + ("2024-01-01", "New Year's Day"), + ("2024-02-09", "Chinese New Year's Eve (markets close at 12:00 p.m. SGT)"), + ("2024-02-12", "Chinese New Year"), + ("2024-03-29", "Good Friday"), + ("2024-04-10", "Hari Raya Puasa"), + ("2024-05-01", "Labour Day"), + ("2024-05-22", "Vesak Day"), + ("2024-06-17", "Hari Raya Haji"), + ("2024-08-09", "National Day"), + ("2024-10-31", "Deepavali"), + ("2024-12-24", "Christmas Eve (markets close at 12:00 p.m. SGT)"), + ("2024-12-25", "Christmas Day"), + ("2024-12-31", "New Year's Eve (markets close at 12:00 p.m. SGT)"), + ) + + def test_l10n_en_us(self): + self.assertLocalizedHolidays( + "en_US", + ("2024-01-01", "New Year's Day"), + ("2024-02-09", "Chinese New Year's Eve (markets close at 12:00 p.m. SGT)"), + ("2024-02-12", "Chinese New Year"), + ("2024-03-29", "Good Friday"), + ("2024-04-10", "Eid al-Fitr"), + ("2024-05-01", "Labor Day"), + ("2024-05-22", "Vesak Day"), + ("2024-06-17", "Eid al-Adha"), + ("2024-08-09", "National Day"), + ("2024-10-31", "Deepavali"), + ("2024-12-24", "Christmas Eve (markets close at 12:00 p.m. SGT)"), + ("2024-12-25", "Christmas Day"), + ("2024-12-31", "New Year's Eve (markets close at 12:00 p.m. SGT)"), + ) + + def test_l10n_th(self): + self.assertLocalizedHolidays( + "th", + ("2024-01-01", "วันขึ้นปีใหม่"), + ("2024-02-09", "วันสิ้นปีจีน (ตลาดปิดเวลา 12:00 น. SGT)"), + ("2024-02-12", "วันตรุษจีน"), + ("2024-03-29", "วันศุกร์ประเสริฐ"), + ("2024-04-10", "วันอีฎิ้ลฟิตริ"), + ("2024-05-01", "วันแรงงาน"), + ("2024-05-22", "วันวิสาขบูชา"), + ("2024-06-17", "วันอีดิ้ลอัฎฮา"), + ("2024-08-09", "วันชาติสิงคโปร์"), + ("2024-10-31", "วันดีปาวลี"), + ("2024-12-24", "วันคริสต์มาสอีฟ (ตลาดปิดเวลา 12:00 น. SGT)"), + ("2024-12-25", "วันคริสต์มาส"), + ("2024-12-31", "วันสิ้นปี (ตลาดปิดเวลา 12:00 น. SGT)"), + ) From 329a4ec3e99bbe2bab84821a06075fff743756ca Mon Sep 17 00:00:00 2001 From: Paresh Joshi <194076591+pareshjoshij@users.noreply.github.com> Date: Sat, 25 Jul 2026 18:47:24 +0000 Subject: [PATCH 4/5] update test --- tests/financial/test_singapore_exchange.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/financial/test_singapore_exchange.py b/tests/financial/test_singapore_exchange.py index eb751d30ee..e2efa78d93 100644 --- a/tests/financial/test_singapore_exchange.py +++ b/tests/financial/test_singapore_exchange.py @@ -122,7 +122,7 @@ def test_l10n_th(self): self.assertLocalizedHolidays( "th", ("2024-01-01", "วันขึ้นปีใหม่"), - ("2024-02-09", "วันสิ้นปีจีน (ตลาดปิดเวลา 12:00 น. SGT)"), + ("2024-02-09", "วันก่อนวันตรุษจีน (ตลาดปิดเวลา 12:00 น. SGT)"), ("2024-02-12", "วันตรุษจีน"), ("2024-03-29", "วันศุกร์ประเสริฐ"), ("2024-04-10", "วันอีฎิ้ลฟิตริ"), From 23d9c9e1eb588c242e1ab6d40cbc50a06beb958b Mon Sep 17 00:00:00 2001 From: Paresh Joshi <194076591+pareshjoshij@users.noreply.github.com> Date: Sun, 26 Jul 2026 04:49:49 +0000 Subject: [PATCH 5/5] Fix docstring formatting and remove redundant _move_holiday --- holidays/financial/singapore_exchange.py | 28 ++++++++---------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/holidays/financial/singapore_exchange.py b/holidays/financial/singapore_exchange.py index 3836105076..55651573f2 100644 --- a/holidays/financial/singapore_exchange.py +++ b/holidays/financial/singapore_exchange.py @@ -14,14 +14,13 @@ from holidays.constants import HALF_DAY, PUBLIC from holidays.countries.singapore import Singapore -from holidays.observed_holiday_base import SAT_SUN_TO_NONE class SingaporeExchange(Singapore): """Singapore Exchange (SGX) holidays. References: - + * """ country = None # type: ignore[assignment] @@ -34,7 +33,7 @@ class SingaporeExchange(Singapore): def _populate_common_holidays(self): super()._populate_common_holidays() - for dt in tuple(self): + for dt in tuple(self.keys()): if self._is_weekend(dt): self.pop(dt) @@ -42,24 +41,15 @@ def _populate_half_day_holidays(self): # %s (markets close at 12:00 p.m. SGT). pause_label = tr("%s (markets close at 12:00 p.m. SGT)") - self._move_holiday( - # Christmas Eve. - self._add_christmas_eve(self._format_holiday_name(pause_label, tr("Christmas Eve"))), - rule=SAT_SUN_TO_NONE, - ) + # Christmas Eve. + self._add_christmas_eve(self._format_holiday_name(pause_label, tr("Christmas Eve"))) - self._move_holiday( - # New Year's Eve. - self._add_new_years_eve(self._format_holiday_name(pause_label, tr("New Year's Eve"))), - rule=SAT_SUN_TO_NONE, - ) + # New Year's Eve. + self._add_new_years_eve(self._format_holiday_name(pause_label, tr("New Year's Eve"))) - self._move_holiday( - self._add_chinese_new_years_eve( - # Chinese New Year's Eve. - self._format_holiday_name(pause_label, tr("Chinese New Year's Eve")) - ), - rule=SAT_SUN_TO_NONE, + self._add_chinese_new_years_eve( + # Chinese New Year's Eve. + self._format_holiday_name(pause_label, tr("Chinese New Year's Eve")) )