pandas-market-calendars 5.0.0__py3-none-any.whl → 5.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. pandas_market_calendars/__init__.py +39 -39
  2. pandas_market_calendars/calendar_registry.py +57 -57
  3. pandas_market_calendars/calendar_utils.py +1151 -1147
  4. pandas_market_calendars/calendars/asx.py +77 -70
  5. pandas_market_calendars/calendars/bmf.py +226 -219
  6. pandas_market_calendars/calendars/bse.py +432 -425
  7. pandas_market_calendars/calendars/cboe.py +156 -149
  8. pandas_market_calendars/calendars/cme.py +412 -405
  9. pandas_market_calendars/calendars/cme_globex_agriculture.py +172 -172
  10. pandas_market_calendars/calendars/cme_globex_base.py +126 -119
  11. pandas_market_calendars/calendars/cme_globex_crypto.py +165 -158
  12. pandas_market_calendars/calendars/cme_globex_energy_and_metals.py +223 -216
  13. pandas_market_calendars/calendars/cme_globex_equities.py +130 -123
  14. pandas_market_calendars/calendars/cme_globex_fixed_income.py +136 -136
  15. pandas_market_calendars/calendars/cme_globex_fx.py +101 -101
  16. pandas_market_calendars/calendars/eurex.py +138 -131
  17. pandas_market_calendars/calendars/eurex_fixed_income.py +105 -98
  18. pandas_market_calendars/calendars/hkex.py +438 -431
  19. pandas_market_calendars/calendars/ice.py +88 -81
  20. pandas_market_calendars/calendars/iex.py +162 -155
  21. pandas_market_calendars/calendars/jpx.py +124 -117
  22. pandas_market_calendars/calendars/lse.py +125 -118
  23. pandas_market_calendars/calendars/mirror.py +144 -144
  24. pandas_market_calendars/calendars/nyse.py +1472 -1466
  25. pandas_market_calendars/calendars/ose.py +125 -118
  26. pandas_market_calendars/calendars/sifma.py +390 -356
  27. pandas_market_calendars/calendars/six.py +143 -136
  28. pandas_market_calendars/calendars/sse.py +322 -315
  29. pandas_market_calendars/calendars/tase.py +231 -224
  30. pandas_market_calendars/calendars/tsx.py +192 -185
  31. pandas_market_calendars/class_registry.py +115 -115
  32. pandas_market_calendars/holidays/cme.py +385 -385
  33. pandas_market_calendars/holidays/cme_globex.py +214 -214
  34. pandas_market_calendars/holidays/cn.py +1476 -1476
  35. pandas_market_calendars/holidays/jp.py +401 -401
  36. pandas_market_calendars/holidays/jpx_equinox.py +506 -506
  37. pandas_market_calendars/holidays/nyse.py +1536 -1536
  38. pandas_market_calendars/holidays/oz.py +63 -63
  39. pandas_market_calendars/holidays/sifma.py +350 -350
  40. pandas_market_calendars/holidays/us.py +376 -376
  41. pandas_market_calendars/market_calendar.py +1008 -1008
  42. {pandas_market_calendars-5.0.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/METADATA +3 -1
  43. pandas_market_calendars-5.1.1.dist-info/RECORD +50 -0
  44. {pandas_market_calendars-5.0.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/WHEEL +1 -1
  45. pandas_market_calendars-5.0.0.dist-info/RECORD +0 -50
  46. {pandas_market_calendars-5.0.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/licenses/LICENSE +0 -0
  47. {pandas_market_calendars-5.0.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/licenses/NOTICE +0 -0
  48. {pandas_market_calendars-5.0.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/top_level.txt +0 -0
@@ -1,356 +1,390 @@
1
- from datetime import time
2
-
3
- from pandas.tseries.holiday import AbstractHolidayCalendar
4
- from zoneinfo import ZoneInfo
5
- from itertools import chain
6
-
7
- ########################################################################################################################
8
- # SIFMA Financial Markets Calendar for US, UK, JP
9
- #
10
- # https://www.sifma.com/
11
- #
12
- # US: SIFMAUSExchangeCalendar() ['SIFMAUS', 'SIFMA_US', "Capital_Markets_US", "Financial_Markets_US", "Bond_Markets_US"]
13
- # UK: SIFMAUKExchangeCalendar() ['SIFMAUK', 'SIFMA_UK', "Capital_Markets_UK", "Financial_Markets_UK", "Bond_Markets_UK"]
14
- # JP: SIFMAJPExchangeCalendar() ['SIFMAJP', 'SIFMA_JP', "Capital_Markets_JP", "Financial_Markets_JP", "Bond_Markets_JP"]
15
- #
16
- # Trading Hours:
17
- # US: 7:00 to 17:30
18
- # UK: 8:00 to 17:00
19
- # JP: 8:30 to 18:30
20
- ########################################################################################################################
21
-
22
-
23
- from pandas_market_calendars.holidays.sifma import (
24
- # US Holidays
25
- USNewYearsDay, # Not observed if a Saturday
26
- USNewYearsEve2pmEarlyClose,
27
- MartinLutherKingJr,
28
- USPresidentsDay,
29
- GoodFridayThru2020,
30
- DayBeforeGoodFriday2pmEarlyCloseThru2020,
31
- GoodFridayAdHoc,
32
- GoodFriday2pmEarlyCloseAdHoc,
33
- DayBeforeGoodFriday2pmEarlyCloseAdHoc,
34
- DayBeforeUSMemorialDay2pmEarlyClose,
35
- USMemorialDay,
36
- USJuneteenthAfter2022,
37
- USIndependenceDay,
38
- DayBeforeUSIndependenceDay2pmEarlyClose,
39
- ThursdayBeforeUSIndependenceDay2pmEarlyClose,
40
- USLaborDay,
41
- USColumbusDay,
42
- USVeteransDay2022,
43
- USVeteransDay,
44
- USThanksgivingDay,
45
- DayAfterThanksgiving2pmEarlyClose,
46
- Christmas,
47
- ChristmasEve2pmEarlyClose,
48
- ChristmasEveThursday2pmEarlyClose,
49
- # UK Specific Holidays
50
- UKNewYearsDay, # Saturdays observed on Monday
51
- UKGoodFriday,
52
- UKEasterMonday,
53
- UKMayDay,
54
- UKSpringBankAdHoc, # Usually follows US Memorial Day but not always
55
- UKSummerBank,
56
- UKChristmas,
57
- UKChristmaEve,
58
- UKWeekendChristmas, # Observed Tuesday when Boxing Day is on Monday
59
- UKBoxingDay,
60
- UKWeekendBoxingDay,
61
- UKPlatinumJubilee2022,
62
- )
63
- from pandas_market_calendars.market_calendar import MarketCalendar
64
-
65
-
66
- ########################################################################################################################
67
- # SIFMA Financial Markets Calendar for US, UK, JP
68
- #
69
- # https://www.sifma.com/
70
- #
71
- # US: SIFMAUSExchangeCalendar() ['SIFMAUS', 'SIFMA_US', "Capital_Markets_US", "Financial_Markets_US", "Bond_Markets_US"]
72
- # UK: SIFMAUKExchangeCalendar() ['SIFMAUK', 'SIFMA_UK', "Capital_Markets_UK", "Financial_Markets_UK", "Bond_Markets_UK"]
73
- # JP: SIFMAJPExchangeCalendar() ['SIFMAJP', 'SIFMA_JP', "Capital_Markets_JP", "Financial_Markets_JP", "Bond_Markets_JP"]
74
- #
75
- # Trading Hours:
76
- # US: 7:00 to 17:30
77
- # UK: 8:00 to 17:00
78
- # JP: 8:30 to 18:30
79
- ########################################################################################################################
80
-
81
- # AbstractHolidayCalendar.start_date = '1998-01-01'
82
-
83
- ############################################################
84
- # US
85
- ############################################################
86
-
87
-
88
- class SIFMAUSExchangeCalendar(MarketCalendar):
89
- """
90
- Exchange calendar for SIFMA United States
91
-
92
- https://www.sifma.org/resources/general/holiday-schedule/#US
93
-
94
- """
95
-
96
- aliases = [
97
- "SIFMAUS",
98
- "SIFMA_US",
99
- "Capital_Markets_US",
100
- "Financial_Markets_US",
101
- "Bond_Markets_US",
102
- ]
103
-
104
- regular_market_times = {
105
- "market_open": ((None, time(7)),),
106
- "market_close": ((None, time(17, 30)),),
107
- }
108
-
109
- @property
110
- def name(self):
111
- return "SIFMA_US"
112
-
113
- @property
114
- def full_name(self):
115
- return "Securities Industry and Financial Markets Association"
116
-
117
- @property
118
- def tz(self):
119
- return ZoneInfo("America/New_York")
120
-
121
- @property
122
- def regular_holidays(self):
123
- return AbstractHolidayCalendar(
124
- rules=[
125
- USNewYearsDay,
126
- MartinLutherKingJr,
127
- USPresidentsDay,
128
- GoodFridayThru2020,
129
- USMemorialDay,
130
- USJuneteenthAfter2022,
131
- USIndependenceDay,
132
- USLaborDay,
133
- USColumbusDay,
134
- USVeteransDay2022,
135
- USVeteransDay,
136
- USThanksgivingDay,
137
- Christmas,
138
- ]
139
- )
140
-
141
- @property
142
- def adhoc_holidays(self):
143
- return list(
144
- chain(
145
- GoodFridayAdHoc,
146
- )
147
- )
148
-
149
- @property
150
- def special_closes(self):
151
- return [
152
- (
153
- time(14),
154
- AbstractHolidayCalendar(
155
- rules=[
156
- DayBeforeGoodFriday2pmEarlyCloseThru2020,
157
- DayBeforeUSMemorialDay2pmEarlyClose,
158
- DayBeforeUSIndependenceDay2pmEarlyClose,
159
- ThursdayBeforeUSIndependenceDay2pmEarlyClose,
160
- DayAfterThanksgiving2pmEarlyClose,
161
- ChristmasEve2pmEarlyClose,
162
- ChristmasEveThursday2pmEarlyClose,
163
- USNewYearsEve2pmEarlyClose,
164
- ]
165
- ),
166
- )
167
- ]
168
-
169
- @property
170
- def special_closes_adhoc(self):
171
- return [
172
- (
173
- time(14, tzinfo=ZoneInfo("America/New_York")),
174
- GoodFriday2pmEarlyCloseAdHoc
175
- + DayBeforeGoodFriday2pmEarlyCloseAdHoc, # list
176
- ),
177
- ]
178
-
179
-
180
- ############################################################
181
- # UK
182
- ############################################################
183
-
184
-
185
- class SIFMAUKExchangeCalendar(MarketCalendar):
186
- """
187
- Exchange calendar for SIFMA United Kingdom
188
-
189
- https://www.sifma.org/resources/general/holiday-schedule/#UK
190
-
191
- """
192
-
193
- aliases = [
194
- "SIFMAUK",
195
- "SIFMA_UK",
196
- "Capital_Markets_UK",
197
- "Financial_Markets_UK",
198
- "Bond_Markets_UK",
199
- ]
200
-
201
- regular_market_times = {
202
- "market_open": ((None, time(8)),),
203
- "market_close": ((None, time(17)),),
204
- }
205
-
206
- @property
207
- def name(self):
208
- return "SIFMA_UK"
209
-
210
- @property
211
- def tz(self):
212
- return ZoneInfo("Europe/London")
213
-
214
- @property
215
- def regular_holidays(self):
216
- return AbstractHolidayCalendar(
217
- rules=[
218
- UKNewYearsDay,
219
- MartinLutherKingJr,
220
- USPresidentsDay,
221
- UKGoodFriday,
222
- UKEasterMonday,
223
- UKMayDay,
224
- USMemorialDay,
225
- USJuneteenthAfter2022,
226
- USIndependenceDay,
227
- UKSummerBank,
228
- USLaborDay,
229
- USColumbusDay,
230
- USVeteransDay2022,
231
- USVeteransDay,
232
- USThanksgivingDay,
233
- UKChristmas,
234
- UKChristmaEve,
235
- UKWeekendChristmas,
236
- UKBoxingDay,
237
- UKWeekendBoxingDay,
238
- ]
239
- )
240
-
241
- @property
242
- def adhoc_holidays(self):
243
- return list(
244
- chain(
245
- UKSpringBankAdHoc,
246
- UKPlatinumJubilee2022,
247
- )
248
- )
249
-
250
-
251
- ############################################################
252
- # Japan
253
- ############################################################
254
- from pandas_market_calendars.holidays.jp import (
255
- JapanComingOfAgeDay,
256
- JapanNationalFoundationDay,
257
- JapanEmperorsBirthday,
258
- JapanVernalEquinox,
259
- JapanShowaDay,
260
- JapanConstitutionMemorialDay,
261
- JapanGreeneryDay,
262
- JapanChildrensDay,
263
- JapanMarineDay,
264
- JapanMountainDay,
265
- JapanRespectForTheAgedDay,
266
- JapanAutumnalEquinox,
267
- JapanHealthAndSportsDay2000To2019,
268
- JapanSportsDay2020,
269
- JapanSportsDay,
270
- JapanCultureDay,
271
- JapanLaborThanksgivingDay,
272
- )
273
-
274
-
275
- class SIFMAJPExchangeCalendar(MarketCalendar):
276
- """
277
- Exchange calendar for SIFMA Japan
278
-
279
- https://www.sifma.org/resources/general/holiday-schedule/#JP
280
-
281
- """
282
-
283
- aliases = [
284
- "SIFMAJP",
285
- "SIFMA_JP",
286
- "Capital_Markets_JP",
287
- "Financial_Markets_JP",
288
- "Bond_Markets_JP",
289
- ]
290
-
291
- regular_market_times = {
292
- "market_open": ((None, time(8, 30)),),
293
- "market_close": ((None, time(18, 30)),),
294
- }
295
-
296
- @property
297
- def name(self):
298
- return "SIFMA_JP"
299
-
300
- @property
301
- def tz(self):
302
- return ZoneInfo("Asia/Tokyo")
303
-
304
- @property
305
- def regular_holidays(self):
306
- return AbstractHolidayCalendar(
307
- rules=[
308
- UKNewYearsDay,
309
- JapanComingOfAgeDay,
310
- MartinLutherKingJr,
311
- JapanNationalFoundationDay,
312
- USPresidentsDay,
313
- JapanEmperorsBirthday,
314
- JapanVernalEquinox,
315
- UKGoodFriday,
316
- UKEasterMonday,
317
- JapanShowaDay,
318
- JapanConstitutionMemorialDay,
319
- JapanGreeneryDay,
320
- JapanChildrensDay,
321
- USMemorialDay,
322
- USJuneteenthAfter2022,
323
- USIndependenceDay,
324
- JapanMarineDay,
325
- JapanMountainDay,
326
- UKSummerBank,
327
- USLaborDay,
328
- JapanRespectForTheAgedDay,
329
- JapanAutumnalEquinox,
330
- JapanSportsDay,
331
- JapanSportsDay2020,
332
- JapanHealthAndSportsDay2000To2019,
333
- JapanCultureDay,
334
- USVeteransDay2022,
335
- USVeteransDay,
336
- JapanLaborThanksgivingDay,
337
- USThanksgivingDay,
338
- UKChristmas,
339
- UKChristmaEve,
340
- UKBoxingDay,
341
- UKWeekendBoxingDay,
342
- ]
343
- )
344
-
345
- @property
346
- def adhoc_holidays(self):
347
- return list(
348
- chain(
349
- UKSpringBankAdHoc,
350
- UKPlatinumJubilee2022,
351
- )
352
- )
353
-
354
- @property
355
- def special_closes(self):
356
- return [(time(15), AbstractHolidayCalendar(rules=[UKMayDay, UKWeekendChristmas]))]
1
+ from datetime import time
2
+ import functools
3
+
4
+ import pandas as pd
5
+ from pandas.tseries.holiday import AbstractHolidayCalendar
6
+ import sys
7
+ # check python versiOn aNd import accordingly
8
+ if sys.version_info >= (3, 9):
9
+ # For Python 3.9 and later, import directly
10
+ from zoneinfo import ZoneInfo
11
+ else:
12
+ # For Python 3.8 and earlier, import from backports
13
+ from backports.zoneinfo import ZoneInfo
14
+ from itertools import chain
15
+
16
+ ########################################################################################################################
17
+ # SIFMA Financial Markets Calendar for US, UK, JP
18
+ #
19
+ # https://www.sifma.com/
20
+ #
21
+ # US: SIFMAUSExchangeCalendar() ['SIFMAUS', 'SIFMA_US', "Capital_Markets_US", "Financial_Markets_US", "Bond_Markets_US"]
22
+ # UK: SIFMAUKExchangeCalendar() ['SIFMAUK', 'SIFMA_UK', "Capital_Markets_UK", "Financial_Markets_UK", "Bond_Markets_UK"]
23
+ # JP: SIFMAJPExchangeCalendar() ['SIFMAJP', 'SIFMA_JP', "Capital_Markets_JP", "Financial_Markets_JP", "Bond_Markets_JP"]
24
+ #
25
+ # Trading Hours:
26
+ # US: 7:00 to 17:30
27
+ # UK: 8:00 to 17:00
28
+ # JP: 8:30 to 18:30
29
+ ########################################################################################################################
30
+
31
+
32
+ from pandas_market_calendars.holidays.sifma import (
33
+ # US Holidays
34
+ USNewYearsDay, # Not observed if a Saturday
35
+ USNewYearsEve2pmEarlyClose,
36
+ MartinLutherKingJr,
37
+ USPresidentsDay,
38
+ # --- Good Friday Rules --- #
39
+ is_first_friday,
40
+ GoodFridayThru2020,
41
+ DayBeforeGoodFriday2pmEarlyCloseThru2020,
42
+ GoodFridayPotentialPost2020, # Potential dates, filtered later
43
+ DayBeforeGoodFridayPotentialPost2020, # Potential dates, filtered later
44
+ # --- End Good Friday Rules --- #
45
+ DayBeforeUSMemorialDay2pmEarlyClose,
46
+ USMemorialDay,
47
+ USJuneteenthAfter2022,
48
+ USIndependenceDay,
49
+ DayBeforeUSIndependenceDay2pmEarlyClose,
50
+ ThursdayBeforeUSIndependenceDay2pmEarlyClose,
51
+ USLaborDay,
52
+ USColumbusDay,
53
+ USVeteransDay,
54
+ USThanksgivingDay,
55
+ DayAfterThanksgiving2pmEarlyClose,
56
+ Christmas,
57
+ ChristmasEve2pmEarlyClose,
58
+ ChristmasEveThursday2pmEarlyClose,
59
+ # UK Specific Holidays
60
+ UKNewYearsDay, # Saturdays observed on Monday
61
+ UKGoodFriday,
62
+ UKEasterMonday,
63
+ UKMayDay,
64
+ UKSpringBankAdHoc, # Usually follows US Memorial Day but not always
65
+ UKSummerBank,
66
+ UKChristmas,
67
+ UKChristmaEve,
68
+ UKWeekendChristmas, # Observed Tuesday when Boxing Day is on Monday
69
+ UKBoxingDay,
70
+ UKWeekendBoxingDay,
71
+ UKPlatinumJubilee2022,
72
+ )
73
+ from pandas_market_calendars.market_calendar import MarketCalendar
74
+
75
+
76
+ ########################################################################################################################
77
+ # SIFMA Financial Markets Calendar for US, UK, JP
78
+ #
79
+ # https://www.sifma.com/
80
+ #
81
+ # US: SIFMAUSExchangeCalendar() ['SIFMAUS', 'SIFMA_US', "Capital_Markets_US", "Financial_Markets_US", "Bond_Markets_US"]
82
+ # UK: SIFMAUKExchangeCalendar() ['SIFMAUK', 'SIFMA_UK', "Capital_Markets_UK", "Financial_Markets_UK", "Bond_Markets_UK"]
83
+ # JP: SIFMAJPExchangeCalendar() ['SIFMAJP', 'SIFMA_JP', "Capital_Markets_JP", "Financial_Markets_JP", "Bond_Markets_JP"]
84
+ #
85
+ # Trading Hours:
86
+ # US: 7:00 to 17:30
87
+ # UK: 8:00 to 17:00
88
+ # JP: 8:30 to 18:30
89
+ ########################################################################################################################
90
+
91
+ # AbstractHolidayCalendar.start_date = '1998-01-01'
92
+
93
+ ############################################################
94
+ # US
95
+ ############################################################
96
+
97
+
98
+ class SIFMAUSExchangeCalendar(MarketCalendar):
99
+ """
100
+ Exchange calendar for SIFMA United States
101
+
102
+ https://www.sifma.org/resources/general/holiday-schedule/#US
103
+
104
+ """
105
+
106
+ aliases = [
107
+ "SIFMAUS",
108
+ "SIFMA_US",
109
+ "Capital_Markets_US",
110
+ "Financial_Markets_US",
111
+ "Bond_Markets_US",
112
+ ]
113
+
114
+ regular_market_times = {
115
+ "market_open": ((None, time(7)),),
116
+ "market_close": ((None, time(17, 30)),),
117
+ }
118
+
119
+ @property
120
+ def name(self):
121
+ return "SIFMA_US"
122
+
123
+ @property
124
+ def full_name(self):
125
+ return "Securities Industry and Financial Markets Association"
126
+
127
+ @property
128
+ def tz(self):
129
+ return ZoneInfo("America/New_York")
130
+
131
+ # Helper method to calculate and cache dynamic dates
132
+ @functools.lru_cache()
133
+ def _get_dynamic_gf_rules(self):
134
+ # Calculate rules for a wide fixed range to avoid arbitrary cutoffs
135
+ # while preventing infinite generation. 1970-2100 is a reasonable range.
136
+ calc_start = pd.Timestamp("1970-01-01")
137
+ calc_end = pd.Timestamp("2100-12-31")
138
+
139
+ # Filter potential dates based on the start_date of the underlying Holiday rules
140
+ gf_rule_start = GoodFridayPotentialPost2020.start_date
141
+ thurs_rule_start = DayBeforeGoodFridayPotentialPost2020.start_date
142
+
143
+ # Ensure calculation range respects the rule start dates
144
+ effective_gf_start = max(calc_start, gf_rule_start) if gf_rule_start else calc_start
145
+ effective_thurs_start = max(calc_start, thurs_rule_start) if thurs_rule_start else calc_start
146
+
147
+ potential_gf_dates = GoodFridayPotentialPost2020.dates(effective_gf_start, calc_end)
148
+ gf_full_holidays = [d for d in potential_gf_dates if not is_first_friday(d)]
149
+ gf_12pm_early_closes = [d for d in potential_gf_dates if is_first_friday(d)]
150
+
151
+ potential_thurs_dates = DayBeforeGoodFridayPotentialPost2020.dates(effective_thurs_start, calc_end)
152
+ thurs_before_gf_2pm_early_closes = [
153
+ thurs for thurs in potential_thurs_dates if not is_first_friday(thurs + pd.Timedelta(days=1))
154
+ ]
155
+ return gf_full_holidays, gf_12pm_early_closes, thurs_before_gf_2pm_early_closes
156
+
157
+ @property
158
+ def regular_holidays(self):
159
+ return AbstractHolidayCalendar(
160
+ rules=[
161
+ USNewYearsDay,
162
+ MartinLutherKingJr,
163
+ USPresidentsDay,
164
+ GoodFridayThru2020,
165
+ USMemorialDay,
166
+ USJuneteenthAfter2022,
167
+ USIndependenceDay,
168
+ USLaborDay,
169
+ USColumbusDay,
170
+ USVeteransDay,
171
+ USThanksgivingDay,
172
+ Christmas,
173
+ ]
174
+ )
175
+
176
+ @property
177
+ def adhoc_holidays(self):
178
+ gf_full_holidays, _, _ = self._get_dynamic_gf_rules()
179
+ return gf_full_holidays
180
+
181
+ @property
182
+ def special_closes(self):
183
+ return [
184
+ (
185
+ time(14),
186
+ AbstractHolidayCalendar(
187
+ rules=[
188
+ DayBeforeGoodFriday2pmEarlyCloseThru2020,
189
+ DayBeforeUSMemorialDay2pmEarlyClose,
190
+ DayBeforeUSIndependenceDay2pmEarlyClose,
191
+ ThursdayBeforeUSIndependenceDay2pmEarlyClose,
192
+ DayAfterThanksgiving2pmEarlyClose,
193
+ ChristmasEve2pmEarlyClose,
194
+ ChristmasEveThursday2pmEarlyClose,
195
+ USNewYearsEve2pmEarlyClose,
196
+ ]
197
+ ),
198
+ )
199
+ ]
200
+
201
+ @property
202
+ def special_closes_adhoc(self):
203
+ _, gf_12pm_early_closes, thurs_before_gf_2pm_early_closes = self._get_dynamic_gf_rules()
204
+ return [
205
+ (
206
+ time(12), # SIFMA rule specifies 12:00 PM ET
207
+ gf_12pm_early_closes,
208
+ ),
209
+ (
210
+ time(14), # SIFMA rule specifies 2:00 PM ET
211
+ thurs_before_gf_2pm_early_closes,
212
+ ),
213
+ ]
214
+
215
+
216
+ ############################################################
217
+ # UK
218
+ ############################################################
219
+
220
+
221
+ class SIFMAUKExchangeCalendar(MarketCalendar):
222
+ """
223
+ Exchange calendar for SIFMA United Kingdom
224
+
225
+ https://www.sifma.org/resources/general/holiday-schedule/#UK
226
+
227
+ """
228
+
229
+ aliases = [
230
+ "SIFMAUK",
231
+ "SIFMA_UK",
232
+ "Capital_Markets_UK",
233
+ "Financial_Markets_UK",
234
+ "Bond_Markets_UK",
235
+ ]
236
+
237
+ regular_market_times = {
238
+ "market_open": ((None, time(8)),),
239
+ "market_close": ((None, time(17)),),
240
+ }
241
+
242
+ @property
243
+ def name(self):
244
+ return "SIFMA_UK"
245
+
246
+ @property
247
+ def tz(self):
248
+ return ZoneInfo("Europe/London")
249
+
250
+ @property
251
+ def regular_holidays(self):
252
+ return AbstractHolidayCalendar(
253
+ rules=[
254
+ UKNewYearsDay,
255
+ MartinLutherKingJr,
256
+ USPresidentsDay,
257
+ UKGoodFriday,
258
+ UKEasterMonday,
259
+ UKMayDay,
260
+ USMemorialDay,
261
+ USJuneteenthAfter2022,
262
+ USIndependenceDay,
263
+ UKSummerBank,
264
+ USLaborDay,
265
+ USColumbusDay,
266
+ USVeteransDay,
267
+ USThanksgivingDay,
268
+ UKChristmas,
269
+ UKChristmaEve,
270
+ UKWeekendChristmas,
271
+ UKBoxingDay,
272
+ UKWeekendBoxingDay,
273
+ ]
274
+ )
275
+
276
+ @property
277
+ def adhoc_holidays(self):
278
+ return list(
279
+ chain(
280
+ UKSpringBankAdHoc,
281
+ UKPlatinumJubilee2022,
282
+ )
283
+ )
284
+
285
+
286
+ ############################################################
287
+ # Japan
288
+ ############################################################
289
+ from pandas_market_calendars.holidays.jp import (
290
+ JapanComingOfAgeDay,
291
+ JapanNationalFoundationDay,
292
+ JapanEmperorsBirthday,
293
+ JapanVernalEquinox,
294
+ JapanShowaDay,
295
+ JapanConstitutionMemorialDay,
296
+ JapanGreeneryDay,
297
+ JapanChildrensDay,
298
+ JapanMarineDay,
299
+ JapanMountainDay,
300
+ JapanRespectForTheAgedDay,
301
+ JapanAutumnalEquinox,
302
+ JapanHealthAndSportsDay2000To2019,
303
+ JapanSportsDay2020,
304
+ JapanSportsDay,
305
+ JapanCultureDay,
306
+ JapanLaborThanksgivingDay,
307
+ )
308
+
309
+
310
+ class SIFMAJPExchangeCalendar(MarketCalendar):
311
+ """
312
+ Exchange calendar for SIFMA Japan
313
+
314
+ https://www.sifma.org/resources/general/holiday-schedule/#JP
315
+
316
+ """
317
+
318
+ aliases = [
319
+ "SIFMAJP",
320
+ "SIFMA_JP",
321
+ "Capital_Markets_JP",
322
+ "Financial_Markets_JP",
323
+ "Bond_Markets_JP",
324
+ ]
325
+
326
+ regular_market_times = {
327
+ "market_open": ((None, time(8, 30)),),
328
+ "market_close": ((None, time(18, 30)),),
329
+ }
330
+
331
+ @property
332
+ def name(self):
333
+ return "SIFMA_JP"
334
+
335
+ @property
336
+ def tz(self):
337
+ return ZoneInfo("Asia/Tokyo")
338
+
339
+ @property
340
+ def regular_holidays(self):
341
+ return AbstractHolidayCalendar(
342
+ rules=[
343
+ UKNewYearsDay,
344
+ JapanComingOfAgeDay,
345
+ MartinLutherKingJr,
346
+ JapanNationalFoundationDay,
347
+ USPresidentsDay,
348
+ JapanEmperorsBirthday,
349
+ JapanVernalEquinox,
350
+ UKGoodFriday,
351
+ UKEasterMonday,
352
+ JapanShowaDay,
353
+ JapanConstitutionMemorialDay,
354
+ JapanGreeneryDay,
355
+ JapanChildrensDay,
356
+ USMemorialDay,
357
+ USJuneteenthAfter2022,
358
+ USIndependenceDay,
359
+ JapanMarineDay,
360
+ JapanMountainDay,
361
+ UKSummerBank,
362
+ USLaborDay,
363
+ JapanRespectForTheAgedDay,
364
+ JapanAutumnalEquinox,
365
+ JapanSportsDay,
366
+ JapanSportsDay2020,
367
+ JapanHealthAndSportsDay2000To2019,
368
+ JapanCultureDay,
369
+ USVeteransDay,
370
+ JapanLaborThanksgivingDay,
371
+ USThanksgivingDay,
372
+ UKChristmas,
373
+ UKChristmaEve,
374
+ UKBoxingDay,
375
+ UKWeekendBoxingDay,
376
+ ]
377
+ )
378
+
379
+ @property
380
+ def adhoc_holidays(self):
381
+ return list(
382
+ chain(
383
+ UKSpringBankAdHoc,
384
+ UKPlatinumJubilee2022,
385
+ )
386
+ )
387
+
388
+ @property
389
+ def special_closes(self):
390
+ return [(time(15), AbstractHolidayCalendar(rules=[UKMayDay, UKWeekendChristmas]))]