Skip to content

Commit 1ab0ff4

Browse files
authored
Merge pull request #492 from rsheftel/dev
v 5.5.0
2 parents 2758907 + 6ed4edd commit 1ab0ff4

27 files changed

Lines changed: 1568 additions & 49 deletions
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Issue 464 CME 2026 Early-Close Plan
2+
3+
## Current Step
4+
5+
4. Run the focused calendar tests, formatter, and diff checks. Completed.
6+
7+
## Plan
8+
9+
1. Reproduce the five reported close times on the current `dev` branch and identify the holiday rules that emit them. Completed.
10+
2. Add 2026-only holiday rules so the correction doesn't change other calendar years. Completed.
11+
3. Add focused regression coverage through the public `CMEGlobex_GC` and `CMEGlobex_MCL` aliases. Completed.
12+
4. Run the focused calendar tests, formatter, and diff checks. Completed.
13+
14+
## Assumptions
15+
16+
- The five dates and close times reported in issue #464 are the authoritative 2026 values.
17+
- This change applies only to the Energy and Metals calendar family.
18+
19+
## Validation
20+
21+
- Energy and Metals test file: 12 passed.
22+
- CME Globex calendar test files: 1070 passed.
23+
- Ruff formatting and lint checks passed for the changed Python files.
24+
- The full fast suite reached 1254 passing tests before stopping at the existing timezone-sensitive `test_valid_days_tz_aware` assertion in `tests/test_nyse_calendar.py`.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Issue 477 CME Equity Market Pause Plan
2+
3+
## Current Step
4+
5+
4. Run focused plus full validation. Completed.
6+
7+
## Plan
8+
9+
1. Reproduce the obsolete post-cutover pause and confirm the historical boundary. Completed.
10+
2. Add focused schedule, open-state, and intraday-grid regression tests around the cutover. Completed.
11+
3. Add a date-effective CME equity-hours transition that preserves the pre-2021 pause. Completed.
12+
4. Run focused plus full validation. Completed.
13+
14+
## Assumptions
15+
16+
- CME's June 2021 Globex notice is authoritative for the June 28, 2021 trade-date cutover.
17+
- Historical sessions before the cutover must retain the 15:15-15:30 CT pause.
18+
- A zero-length break at the former 15:15 CT pause boundary preserves the established schedule schema without
19+
removing any tradable time.
20+
21+
## Validation
22+
23+
- The two new regression tests failed before the implementation and passed afterward.
24+
- Focused CME equity and source tests: 25 passed.
25+
- Fast suite: 1492 passed and 1 failed; the only failure was the existing timezone-sensitive
26+
`test_valid_days_tz_aware` NYSE baseline already documented on `dev`.
27+
- Ruff lint and format checks passed for all changed Python files.
28+
- `git diff --check` passed with CRLF treated as a valid line ending.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Issue 484 TASE Monday-Friday Trading Week Plan
2+
3+
## Current Step
4+
5+
5. Run the TASE tests, the full fast suite, and the formatter checks. Completed.
6+
7+
## Plan
8+
9+
1. Confirm the trading week change (Sunday-Thursday to Monday-Friday effective 2026-01-05, last Sunday session 2026-01-04) and the 2026 closure dates against the exchange schedule, and cross-check both against the upstream `exchange_calendars` XTAE calendar. Completed.
10+
2. Change the weekmask to Monday-Friday and handle the crossover in `valid_days`, following the NYSE pre/post-1952 Saturday pattern so pre-2026 schedules are unchanged. Completed.
11+
3. Add the 2026 and 2027 closures to `TASEClosedDay` (the list ended at 2025-10-14). Completed.
12+
4. Add the Friday 13:34 early close through `special_closes` with the weekday form. Completed.
13+
5. Add native TASE tests (`tests/test_tase_calendar.py`), run the full fast suite, and run ruff format and check. Completed.
14+
15+
## Assumptions
16+
17+
- The exchange's published schedule is authoritative: Monday-Friday trading from 2026-01-05, Friday sessions 9:59-13:34, and a Friday before a Sunday holiday or holiday eve is closed.
18+
- The 2027 closures follow the same rules; election days or other one-off closures are added when announced.
19+
- The regular Monday-Thursday close time (15:59) is left as is; it predates this change and is noted in the issue.
20+
21+
## Validation
22+
23+
- `tests/test_tase_calendar.py`: 6 passed.
24+
- Full fast suite on the `dev` base: 1497 passed.
25+
- 2026-2027 session sets identical to the upstream `exchange_calendars` XTAE calendar (492 sessions each, no differences).
26+
- 2019-2025 schedule output hash-identical to the unmodified branch.
27+
- Ruff format and check passed for the changed Python files.

‎docs/change_log.rst‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
Change Log
22
==========
33

4+
5.5.0 (10/04/2026)
5+
~~~~~~~~~~~~~~~~~~
6+
- Added 2026-04-07 as an HKEX compensatory holiday for the Easter Monday / Ching Ming overlap (PR #472)
7+
- Fixed the 2022 LSE spring bank holiday, keeping May 30 open after the holiday was moved for the Platinum Jubilee; corrected Jubilee holiday assertions (PR #473)
8+
- Added missing 2024 and 2026 special trading holidays to the BSE/NSE calendars (PR #474)
9+
- Fixed cloudpickle serialization of mirrored calendar classes to preserve the calendar registry (PR #476)
10+
- Fixed CME equity schedules to remove the obsolete 15:15–15:30 CT pause from trade date 2021-06-28 while preserving historical breaks (PR #478)
11+
- Overhauled the NSE calendar with curated holidays, era-dependent trading hours, weekday Muhurat sessions, and the 2021 outage interruption; retained backward-compatible imports (PR #479)
12+
- Fixed SIX New Year's Eve weekend handling so it does not close the preceding Friday (PR #482)
13+
- Updated the TASE calendar for its Monday-Friday trading week from 2026-01-05, including the transition, 2026-2027 holidays, and Friday early close (PR #485)
14+
415
5.4.0 (05/25/2026)
516
~~~~~~~~~~~~~~~~~~
617
- PR #462 to fix numerous issues

‎pandas_market_calendars/calendar_registry.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
from .market_calendar import MarketCalendar
66
from .calendars.asx import ASXExchangeCalendar
77
from .calendars.bmf import BMFExchangeCalendar
8-
from .calendars.bse import BSEExchangeCalendar, NSEExchangeCalendar
8+
from .calendars.bse import BSEExchangeCalendar
9+
from .calendars.nse import NSEExchangeCalendar
910
from .calendars.cboe import CFEExchangeCalendar
1011
from .calendars.cme import (
1112
CMEEquityExchangeCalendar, CMEBondExchangeCalendar, CMETradeDateCalendar

‎pandas_market_calendars/calendars/bse.py‎

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@
378378
Timestamp("2023-11-14", tz="UTC"), # Tue, Diwali
379379
Timestamp("2023-11-27", tz="UTC"), # Mon, Guru Nanak's Birthday
380380
Timestamp("2023-12-25", tz="UTC"), # Mon, Christmas
381+
Timestamp("2024-01-22", tz="UTC"), # Mon, Ram Mandir Pran Pratishtha ceremony
381382
Timestamp("2024-01-26", tz="UTC"), # Fri, Republic Day
382383
Timestamp("2024-03-08", tz="UTC"), # Fri, Mahashivratri
383384
Timestamp("2024-03-25", tz="UTC"), # Mon, Holi
@@ -392,6 +393,7 @@
392393
Timestamp("2024-10-02", tz="UTC"), # Wed, Mahatma Gandhi Jayanti
393394
Timestamp("2024-11-01", tz="UTC"), # Fri, Diwali
394395
Timestamp("2024-11-15", tz="UTC"), # Fri, Guru Nanak's Birthday
396+
Timestamp("2024-11-20", tz="UTC"), # Wed, Maharashtra Assembly Elections
395397
Timestamp("2024-12-25", tz="UTC"), # Wed, Christmas
396398
Timestamp("2025-02-26", tz="UTC"), # Wed, Mahashivratri
397399
Timestamp("2025-03-14", tz="UTC"), # Fri, Holi
@@ -407,6 +409,7 @@
407409
Timestamp("2025-10-22", tz="UTC"), # Wed, Balipratipada
408410
Timestamp("2025-11-05", tz="UTC"), # Wed, Prakash Gurpurb Sri Guru Nanak Dev
409411
Timestamp("2025-12-25", tz="UTC"), # Thu, Christmas
412+
Timestamp("2026-01-15", tz="UTC"), # Thu, Maharashtra Municipal Elections
410413
Timestamp("2026-01-26", tz="UTC"), # Mon, Republic Day
411414
Timestamp("2026-03-03", tz="UTC"), # Tue, Holi
412415
Timestamp("2026-03-26", tz="UTC"), # Thu, Shri Ram Navami
@@ -424,10 +427,6 @@
424427
Timestamp("2026-12-25", tz="UTC"), # Fri, Christmas
425428
]
426429

427-
# BSE and NSE currently share the same published closure set in this module.
428-
# Keep this as a shared object so future exchange-specific deltas are explicit.
429-
NSEClosedDay = BSEClosedDay
430-
431430

432431
class BSEExchangeCalendar(MarketCalendar):
433432
"""
@@ -463,21 +462,6 @@ def adhoc_holidays(self) -> List[Any]:
463462
return BSEClosedDay
464463

465464

466-
class NSEExchangeCalendar(BSEExchangeCalendar):
467-
"""
468-
Exchange calendar for the National Stock Exchange of India (NSE, XNSE).
469-
"""
470-
471-
aliases = ["NSE", "XNSE"]
472-
473-
@property
474-
def name(self) -> str:
475-
return "NSE"
476-
477-
@property
478-
def full_name(self) -> str:
479-
return "National Stock Exchange of India"
480-
481-
@property
482-
def adhoc_holidays(self) -> List[Any]:
483-
return NSEClosedDay
465+
# Re-exported for backward compatibility; NSE lives in calendars/nse.py.
466+
from pandas_market_calendars.calendars.nse import NSEExchangeCalendar # noqa: E402, F401
467+
from pandas_market_calendars.holidays.nse import NSEClosedDay # noqa: E402, F401

‎pandas_market_calendars/calendars/cme.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060

6161
CME_EQUITY_LEGACY_HOURS_START = "2005-09-12"
6262
CME_EQUITY_MODERN_HOURS_START = "2012-11-19"
63+
CME_EQUITY_MARKET_PAUSE_END = "2021-06-28"
6364

6465

6566
class CMETradeDateCalendar(MarketCalendar):
@@ -117,7 +118,8 @@ class CMEEquityExchangeCalendar(MarketCalendar):
117118
118119
Open Time: 5:00 PM, America/Chicago
119120
Close Time: 4:00 PM, America/Chicago
120-
Break: 3:15 - 3:30pm America/Chicago
121+
Market pause through June 25, 2021: 3:15 - 3:30pm America/Chicago
122+
No intraday pause from trade date June 28, 2021
121123
"""
122124

123125
aliases = ["CME_Equity", "CBOT_Equity"]
@@ -141,6 +143,8 @@ class CMEEquityExchangeCalendar(MarketCalendar):
141143
(None, time(15, 30)),
142144
(CME_EQUITY_LEGACY_HOURS_START, time(15, 15)),
143145
(CME_EQUITY_MODERN_HOURS_START, time(15, 30)),
146+
# Preserve the schedule columns while representing continuous trading.
147+
(CME_EQUITY_MARKET_PAUSE_END, time(15, 15)),
144148
),
145149
}
146150

‎pandas_market_calendars/calendars/cme_globex_energy_and_metals.py‎

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,16 @@
2222

2323
from pandas_market_calendars.holidays.cme_globex import (
2424
ChristmasCME,
25-
FridayAfterThanksgiving,
25+
FridayAfterThanksgivingFrom2027,
26+
FridayAfterThanksgivingThrough2025,
2627
GoodFriday,
27-
USIndependenceDayFrom2022,
28+
USIndependenceDayFrom2022Through2025,
29+
USIndependenceDayFrom2027,
2830
USIndependenceDayPre2022,
29-
USJuneteenthFrom2022,
30-
USLaborDay,
31+
USJuneteenthFrom2022Through2025,
32+
USJuneteenthFrom2027,
33+
USLaborDayFrom2027,
34+
USLaborDayThrough2025,
3135
USMartinLutherKingJrFrom2022,
3236
USMartinLutherKingJrPre2022,
3337
USMemorialDayFrom2022,
@@ -192,7 +196,8 @@ def special_closes(self) -> List[Any]:
192196
USPresidentsDayPre2022,
193197
USMemorialDayPre2022,
194198
USIndependenceDayPre2022,
195-
USLaborDay,
199+
USLaborDayThrough2025,
200+
USLaborDayFrom2027,
196201
USThanksgivingDayPre2022,
197202
]
198203
),
@@ -201,7 +206,8 @@ def special_closes(self) -> List[Any]:
201206
time(12, 45),
202207
AbstractHolidayCalendar(
203208
rules=[
204-
FridayAfterThanksgiving,
209+
FridayAfterThanksgivingThrough2025,
210+
FridayAfterThanksgivingFrom2027,
205211
]
206212
),
207213
),
@@ -212,8 +218,10 @@ def special_closes(self) -> List[Any]:
212218
USMartinLutherKingJrFrom2022,
213219
USPresidentsDayFrom2022,
214220
USMemorialDayFrom2022,
215-
USJuneteenthFrom2022,
216-
USIndependenceDayFrom2022,
221+
USJuneteenthFrom2022Through2025,
222+
USJuneteenthFrom2027,
223+
USIndependenceDayFrom2022Through2025,
224+
USIndependenceDayFrom2027,
217225
USThanksgivingDayFrom2022,
218226
]
219227
),
@@ -223,8 +231,24 @@ def special_closes(self) -> List[Any]:
223231
@property
224232
def special_closes_adhoc(self) -> List[Any]:
225233
return [
234+
(
235+
time(12),
236+
["2026-06-19", "2026-07-03"],
237+
),
238+
(
239+
time(12, 45),
240+
["2026-12-24"],
241+
),
242+
(
243+
time(13, 30),
244+
["2026-09-07"],
245+
),
246+
(
247+
time(13, 45),
248+
["2026-11-27"],
249+
),
226250
(
227251
time(15, 15),
228252
["2010-12-31"],
229-
)
253+
),
230254
]

‎pandas_market_calendars/calendars/hkex.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,9 @@ def process_queen_birthday(dt: Any) -> Any:
354354
Timestamp("2023-07-17", tz="UTC"), # Typhoon closure
355355
Timestamp("2023-09-01", tz="UTC"), # Typhoon closure
356356
Timestamp("2023-09-08", tz="UTC"), # Typhoon closure
357+
# 2026: Ching Ming substitute (Apr 6) coincides with Easter Monday,
358+
# so Apr 7 is an additional general holiday (same pattern as 2015-04-07)
359+
Timestamp("2026-04-07", tz="UTC"),
357360
]
358361

359362

‎pandas_market_calendars/calendars/mirror.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,16 @@ def weekmask(self) -> str:
148148
regular_market_times[new] = times
149149

150150
cal = type(
151-
exchange,
151+
f"{exchange}ExchangeCalendar",
152152
(TradingCalendar,),
153153
{
154+
"__module__": __name__,
154155
"_ec_class": calendars[exchange],
155-
"alias": [exchange],
156+
"aliases": [exchange],
156157
"regular_market_times": regular_market_times,
157158
},
158159
)
159-
locals()[f"{exchange}ExchangeCalendar"] = cal
160+
locals()[cal.__name__] = cal
160161

161162

162163
class XTAEExchangeCalendar(TradingCalendar):

0 commit comments

Comments
 (0)