Add Singapore Exchange (SGX) holidays#3719
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Summary by CodeRabbit
WalkthroughAdds Singapore Exchange holiday support with weekend-adjusted public holidays, Christmas Eve, New Year’s Eve, and Chinese New Year’s Eve half-days. Registers ChangesSingapore Exchange holidays
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
1 issue found across 8 files
Confidence score: 4/5
- In
holidays/financial/singapore_exchange.py, weekend special closures can be added after the weekend-filtering loop, so dates like Saturday 2025-05-03 (Polling Day) may incorrectly appear in the exchange holiday set and cause downstream scheduling/trading-calendar consumers to treat weekends as special closures—reapply weekend filtering (or guard static-holiday appends) after all holiday additions.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="holidays/financial/singapore_exchange.py">
<violation number="1" location="holidays/financial/singapore_exchange.py:37">
P2: Weekend special closures leak into the exchange calendar because Singapore's static holidays are appended after this loop. For example, `SingaporeExchange(years=2025)` includes Saturday 2025-05-03 (Polling Day), while this class otherwise removes non-trading weekend dates; filter special public holidays too.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| def _populate_public_holidays(self): | ||
| super()._populate_public_holidays() | ||
|
|
||
| for dt in tuple(self): |
There was a problem hiding this comment.
P2: Weekend special closures leak into the exchange calendar because Singapore's static holidays are appended after this loop. For example, SingaporeExchange(years=2025) includes Saturday 2025-05-03 (Polling Day), while this class otherwise removes non-trading weekend dates; filter special public holidays too.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At holidays/financial/singapore_exchange.py, line 37:
<comment>Weekend special closures leak into the exchange calendar because Singapore's static holidays are appended after this loop. For example, `SingaporeExchange(years=2025)` includes Saturday 2025-05-03 (Polling Day), while this class otherwise removes non-trading weekend dates; filter special public holidays too.</comment>
<file context>
@@ -0,0 +1,71 @@
+ def _populate_public_holidays(self):
+ super()._populate_public_holidays()
+
+ for dt in tuple(self):
+ if self._is_weekend(dt):
+ self.pop(dt)
</file context>
There was a problem hiding this comment.
To resolve this issue, you can override _populate_common_holidays instead of _populate_public_holidays.
|
|
||
| #. Chinese New Year's Eve. | ||
| msgid "Chinese New Year's Eve" | ||
| msgstr "วันสิ้นปีจีน" |
There was a problem hiding this comment.
Chinese and Vietnamese New Year in Thai l10n has their own special name:
| msgstr "วันสิ้นปีจีน" | |
| msgstr "วันก่อนวันตรุษจีน" |
There was a problem hiding this comment.
l10n tests should be added here
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #3719 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 321 322 +1
Lines 19320 19346 +26
Branches 2477 2479 +2
=========================================
+ Hits 19320 19346 +26 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
| """Singapore Exchange (SGX) holidays. | ||
|
|
||
| References: | ||
| <https://web.archive.org/web/20260725102849/https://www.sgx.com/stock-exchange/trading> |
There was a problem hiding this comment.
| <https://web.archive.org/web/20260725102849/https://www.sgx.com/stock-exchange/trading> | |
| * <https://web.archive.org/web/20260725102849/https://www.sgx.com/stock-exchange/trading> |
| # %s (markets close at 12:00 p.m. SGT). | ||
| pause_label = tr("%s (markets close at 12:00 p.m. SGT)") | ||
|
|
||
| self._move_holiday( |
There was a problem hiding this comment.
Since we're removing holidays that fall on a weekend in _populate_common_holidays, there's no need to use _move_holiday here.



This PR adds the holidays for the Singapore Exchange (SGX) financial calendar and l10n support.
Part of GSoC (#3424)
holidaysfunctionality in general)Checklist
make checklocally; all checks and tests passed.