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.
- pandas_market_calendars/__init__.py +39 -39
- pandas_market_calendars/calendar_registry.py +57 -57
- pandas_market_calendars/calendar_utils.py +1151 -1147
- pandas_market_calendars/calendars/asx.py +77 -70
- pandas_market_calendars/calendars/bmf.py +226 -219
- pandas_market_calendars/calendars/bse.py +432 -425
- pandas_market_calendars/calendars/cboe.py +156 -149
- pandas_market_calendars/calendars/cme.py +412 -405
- pandas_market_calendars/calendars/cme_globex_agriculture.py +172 -172
- pandas_market_calendars/calendars/cme_globex_base.py +126 -119
- pandas_market_calendars/calendars/cme_globex_crypto.py +165 -158
- pandas_market_calendars/calendars/cme_globex_energy_and_metals.py +223 -216
- pandas_market_calendars/calendars/cme_globex_equities.py +130 -123
- pandas_market_calendars/calendars/cme_globex_fixed_income.py +136 -136
- pandas_market_calendars/calendars/cme_globex_fx.py +101 -101
- pandas_market_calendars/calendars/eurex.py +138 -131
- pandas_market_calendars/calendars/eurex_fixed_income.py +105 -98
- pandas_market_calendars/calendars/hkex.py +438 -431
- pandas_market_calendars/calendars/ice.py +88 -81
- pandas_market_calendars/calendars/iex.py +162 -155
- pandas_market_calendars/calendars/jpx.py +124 -117
- pandas_market_calendars/calendars/lse.py +125 -118
- pandas_market_calendars/calendars/mirror.py +144 -144
- pandas_market_calendars/calendars/nyse.py +1472 -1466
- pandas_market_calendars/calendars/ose.py +125 -118
- pandas_market_calendars/calendars/sifma.py +390 -356
- pandas_market_calendars/calendars/six.py +143 -136
- pandas_market_calendars/calendars/sse.py +322 -315
- pandas_market_calendars/calendars/tase.py +231 -224
- pandas_market_calendars/calendars/tsx.py +192 -185
- pandas_market_calendars/class_registry.py +115 -115
- pandas_market_calendars/holidays/cme.py +385 -385
- pandas_market_calendars/holidays/cme_globex.py +214 -214
- pandas_market_calendars/holidays/cn.py +1476 -1476
- pandas_market_calendars/holidays/jp.py +401 -401
- pandas_market_calendars/holidays/jpx_equinox.py +506 -506
- pandas_market_calendars/holidays/nyse.py +1536 -1536
- pandas_market_calendars/holidays/oz.py +63 -63
- pandas_market_calendars/holidays/sifma.py +350 -350
- pandas_market_calendars/holidays/us.py +376 -376
- pandas_market_calendars/market_calendar.py +1008 -1008
- {pandas_market_calendars-5.0.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/METADATA +3 -1
- pandas_market_calendars-5.1.1.dist-info/RECORD +50 -0
- {pandas_market_calendars-5.0.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/WHEEL +1 -1
- pandas_market_calendars-5.0.0.dist-info/RECORD +0 -50
- {pandas_market_calendars-5.0.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/licenses/LICENSE +0 -0
- {pandas_market_calendars-5.0.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/licenses/NOTICE +0 -0
- {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
|
-
|
4
|
-
|
5
|
-
from
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
#
|
10
|
-
|
11
|
-
|
12
|
-
#
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
# US
|
18
|
-
#
|
19
|
-
#
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
#
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
#
|
78
|
-
#
|
79
|
-
|
80
|
-
|
81
|
-
#
|
82
|
-
|
83
|
-
|
84
|
-
#
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
)
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
)
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
)
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
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]))]
|