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,405 +1,412 @@
|
|
1
|
-
#
|
2
|
-
# Copyright 2016 Quantopian, Inc.
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
|
16
|
-
from datetime import time
|
17
|
-
from itertools import chain
|
18
|
-
|
19
|
-
from pandas import Timestamp
|
20
|
-
from pandas.tseries.holiday import (
|
21
|
-
AbstractHolidayCalendar,
|
22
|
-
GoodFriday,
|
23
|
-
USLaborDay,
|
24
|
-
USPresidentsDay,
|
25
|
-
USThanksgivingDay,
|
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
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
),
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
1
|
+
#
|
2
|
+
# Copyright 2016 Quantopian, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
from datetime import time
|
17
|
+
from itertools import chain
|
18
|
+
|
19
|
+
from pandas import Timestamp
|
20
|
+
from pandas.tseries.holiday import (
|
21
|
+
AbstractHolidayCalendar,
|
22
|
+
GoodFriday,
|
23
|
+
USLaborDay,
|
24
|
+
USPresidentsDay,
|
25
|
+
USThanksgivingDay,
|
26
|
+
)
|
27
|
+
import sys
|
28
|
+
# check python versiOn aNd import accordingly
|
29
|
+
if sys.version_info >= (3, 9):
|
30
|
+
# For Python 3.9 and later, import directly
|
31
|
+
from zoneinfo import ZoneInfo
|
32
|
+
else:
|
33
|
+
# For Python 3.8 and earlier, import from backports
|
34
|
+
from backports.zoneinfo import ZoneInfo
|
35
|
+
|
36
|
+
from pandas_market_calendars.holidays.us import (
|
37
|
+
Christmas,
|
38
|
+
ChristmasEveBefore1993,
|
39
|
+
ChristmasEveInOrAfter1993,
|
40
|
+
USBlackFridayInOrAfter1993,
|
41
|
+
USJuneteenthAfter2022,
|
42
|
+
USIndependenceDay,
|
43
|
+
USMartinLutherKingJrAfter1998,
|
44
|
+
USMemorialDay,
|
45
|
+
USNationalDaysofMourning,
|
46
|
+
USNewYearsDay,
|
47
|
+
)
|
48
|
+
from pandas_market_calendars.market_calendar import MarketCalendar
|
49
|
+
|
50
|
+
|
51
|
+
# Useful resources for making changes to this file: http://www.cmegroup.com/tools-information/holiday-calendar.html
|
52
|
+
# The CME has different holiday rules depending on the type of instrument.
|
53
|
+
# For example, http://www.cmegroup.com/tools-information/holiday-calendar/files/2016-4th-of-july-holiday-schedule.pdf # noqa
|
54
|
+
# shows that Equity, Interest Rate, FX, Energy, Metals & DME Products close at 1200 CT on July 4, 2016, while Grain,
|
55
|
+
# Oilseed & MGEX Products and Livestock, Dairy & Lumber products are completely closed.
|
56
|
+
|
57
|
+
|
58
|
+
class CMEEquityExchangeCalendar(MarketCalendar):
|
59
|
+
"""
|
60
|
+
Exchange calendar for CME for Equity products
|
61
|
+
|
62
|
+
Open Time: 6:00 PM, America/New_York / 5:00 PM Chicago
|
63
|
+
Close Time: 5:00 PM, America/New_York / 4:00 PM Chicago
|
64
|
+
Break: 4:15 - 4:30pm America/New_York / 3:15 - 3:30 PM Chicago
|
65
|
+
"""
|
66
|
+
|
67
|
+
aliases = ["CME_Equity", "CBOT_Equity"]
|
68
|
+
regular_market_times = {
|
69
|
+
"market_open": ((None, time(17), -1),), # offset by -1 day
|
70
|
+
"market_close": ((None, time(16)),),
|
71
|
+
"break_start": ((None, time(15, 15)),),
|
72
|
+
"break_end": ((None, time(15, 30)),),
|
73
|
+
}
|
74
|
+
|
75
|
+
@property
|
76
|
+
def name(self):
|
77
|
+
return "CME_Equity"
|
78
|
+
|
79
|
+
@property
|
80
|
+
def tz(self):
|
81
|
+
return ZoneInfo("America/Chicago")
|
82
|
+
|
83
|
+
@property
|
84
|
+
def regular_holidays(self):
|
85
|
+
# Many days that are holidays for the NYSE are an early close day for CME
|
86
|
+
return AbstractHolidayCalendar(
|
87
|
+
rules=[
|
88
|
+
USNewYearsDay,
|
89
|
+
GoodFriday,
|
90
|
+
Christmas,
|
91
|
+
]
|
92
|
+
)
|
93
|
+
|
94
|
+
@property
|
95
|
+
def adhoc_holidays(self):
|
96
|
+
return USNationalDaysofMourning
|
97
|
+
|
98
|
+
@property
|
99
|
+
def special_closes(self):
|
100
|
+
return [
|
101
|
+
(
|
102
|
+
time(12),
|
103
|
+
AbstractHolidayCalendar(
|
104
|
+
rules=[
|
105
|
+
USMartinLutherKingJrAfter1998,
|
106
|
+
USPresidentsDay,
|
107
|
+
USMemorialDay,
|
108
|
+
USLaborDay,
|
109
|
+
USJuneteenthAfter2022,
|
110
|
+
USIndependenceDay,
|
111
|
+
USThanksgivingDay,
|
112
|
+
USBlackFridayInOrAfter1993,
|
113
|
+
ChristmasEveBefore1993,
|
114
|
+
ChristmasEveInOrAfter1993,
|
115
|
+
]
|
116
|
+
),
|
117
|
+
)
|
118
|
+
]
|
119
|
+
|
120
|
+
|
121
|
+
class CMEAgricultureExchangeCalendar(MarketCalendar):
|
122
|
+
"""
|
123
|
+
Exchange calendar for CME for Agriculture products
|
124
|
+
|
125
|
+
Open Time: 5:00 PM, America/Chicago
|
126
|
+
Close Time: 5:00 PM, America/Chicago
|
127
|
+
|
128
|
+
Regularly-Observed Holidays:
|
129
|
+
- New Years Day
|
130
|
+
- Good Friday
|
131
|
+
- Christmas
|
132
|
+
"""
|
133
|
+
|
134
|
+
aliases = [
|
135
|
+
"CME_Agriculture",
|
136
|
+
"CBOT_Agriculture",
|
137
|
+
"COMEX_Agriculture",
|
138
|
+
"NYMEX_Agriculture",
|
139
|
+
]
|
140
|
+
regular_market_times = {
|
141
|
+
"market_open": ((None, time(17, 1), -1),), # offset by -1 day
|
142
|
+
"market_close": ((None, time(17)),),
|
143
|
+
}
|
144
|
+
|
145
|
+
@property
|
146
|
+
def name(self):
|
147
|
+
return "CME_Agriculture"
|
148
|
+
|
149
|
+
@property
|
150
|
+
def tz(self):
|
151
|
+
return ZoneInfo("America/Chicago")
|
152
|
+
|
153
|
+
@property
|
154
|
+
def regular_holidays(self):
|
155
|
+
# Ignore gap between 13:20 CST and 14:30 CST for regular trading hours
|
156
|
+
#
|
157
|
+
# The CME has different holiday rules depending on the type of
|
158
|
+
# instrument. For example, http://www.cmegroup.com/tools-information/holiday-calendar/files/2016-4th-of-july-holiday-schedule.pdf # noqa
|
159
|
+
# shows that Equity, Interest Rate, FX, Energy, Metals & DME Products
|
160
|
+
# close at 1200 CT on July 4, 2016, while Grain, Oilseed & MGEX
|
161
|
+
# Products and Livestock, Dairy & Lumber products are completely
|
162
|
+
# closed.
|
163
|
+
return AbstractHolidayCalendar(
|
164
|
+
rules=[
|
165
|
+
USNewYearsDay,
|
166
|
+
USMartinLutherKingJrAfter1998,
|
167
|
+
USPresidentsDay,
|
168
|
+
GoodFriday,
|
169
|
+
USMemorialDay,
|
170
|
+
USJuneteenthAfter2022,
|
171
|
+
USIndependenceDay,
|
172
|
+
USLaborDay,
|
173
|
+
USThanksgivingDay,
|
174
|
+
Christmas,
|
175
|
+
]
|
176
|
+
)
|
177
|
+
|
178
|
+
@property
|
179
|
+
def adhoc_holidays(self):
|
180
|
+
return USNationalDaysofMourning
|
181
|
+
|
182
|
+
@property
|
183
|
+
def special_closes(self):
|
184
|
+
return [
|
185
|
+
(
|
186
|
+
time(12),
|
187
|
+
AbstractHolidayCalendar(
|
188
|
+
rules=[
|
189
|
+
USBlackFridayInOrAfter1993,
|
190
|
+
ChristmasEveBefore1993,
|
191
|
+
ChristmasEveInOrAfter1993,
|
192
|
+
]
|
193
|
+
),
|
194
|
+
)
|
195
|
+
]
|
196
|
+
|
197
|
+
|
198
|
+
# For the bond market Good Friday that coincides with the release of NFP on the first friday of the month is an open day
|
199
|
+
goodFridayClosed = [
|
200
|
+
"1970-03-27",
|
201
|
+
"1971-04-09",
|
202
|
+
"1972-03-31",
|
203
|
+
"1973-04-20",
|
204
|
+
"1974-04-12",
|
205
|
+
"1975-03-28",
|
206
|
+
"1976-04-16",
|
207
|
+
"1977-04-08",
|
208
|
+
"1978-03-24",
|
209
|
+
"1979-04-13",
|
210
|
+
"1981-04-17",
|
211
|
+
"1982-04-09",
|
212
|
+
"1984-04-20",
|
213
|
+
"1986-03-28",
|
214
|
+
"1987-04-17",
|
215
|
+
"1989-03-24",
|
216
|
+
"1990-04-13",
|
217
|
+
"1991-03-29",
|
218
|
+
"1992-04-17",
|
219
|
+
"1993-04-09",
|
220
|
+
"1995-04-14",
|
221
|
+
"1997-03-28",
|
222
|
+
"1998-04-10",
|
223
|
+
"2000-04-21",
|
224
|
+
"2001-04-13",
|
225
|
+
"2002-03-29",
|
226
|
+
"2003-04-18",
|
227
|
+
"2004-04-09",
|
228
|
+
"2005-03-25",
|
229
|
+
"2006-04-14",
|
230
|
+
"2008-03-21",
|
231
|
+
"2009-04-10",
|
232
|
+
"2011-04-22",
|
233
|
+
"2013-03-29",
|
234
|
+
"2014-04-18",
|
235
|
+
"2016-03-25",
|
236
|
+
"2017-04-14",
|
237
|
+
"2018-03-30",
|
238
|
+
"2019-04-19",
|
239
|
+
"2020-04-10",
|
240
|
+
"2022-04-15",
|
241
|
+
"2024-03-29",
|
242
|
+
"2025-04-18",
|
243
|
+
"2027-03-26",
|
244
|
+
"2028-04-14",
|
245
|
+
"2029-03-30",
|
246
|
+
"2030-04-19",
|
247
|
+
"2031-04-11",
|
248
|
+
"2032-03-26",
|
249
|
+
"2033-04-15",
|
250
|
+
"2035-03-23",
|
251
|
+
"2036-04-11",
|
252
|
+
"2038-04-23",
|
253
|
+
"2039-04-08",
|
254
|
+
"2040-03-30",
|
255
|
+
"2041-04-19",
|
256
|
+
"2043-03-27",
|
257
|
+
"2044-04-15",
|
258
|
+
"2046-03-23",
|
259
|
+
"2047-04-12",
|
260
|
+
"2049-04-16",
|
261
|
+
"2050-04-08",
|
262
|
+
"2051-03-31",
|
263
|
+
"2052-04-19",
|
264
|
+
"2054-03-27",
|
265
|
+
"2055-04-16",
|
266
|
+
"2056-03-31",
|
267
|
+
"2057-04-20",
|
268
|
+
"2058-04-12",
|
269
|
+
"2059-03-28",
|
270
|
+
"2060-04-16",
|
271
|
+
"2061-04-08",
|
272
|
+
"2062-03-24",
|
273
|
+
"2063-04-13",
|
274
|
+
"2065-03-27",
|
275
|
+
"2066-04-09",
|
276
|
+
"2068-04-20",
|
277
|
+
"2069-04-12",
|
278
|
+
"2070-03-28",
|
279
|
+
"2071-04-17",
|
280
|
+
"2072-04-08",
|
281
|
+
"2073-03-24",
|
282
|
+
"2074-04-13",
|
283
|
+
"2076-04-17",
|
284
|
+
"2077-04-09",
|
285
|
+
"2079-04-21",
|
286
|
+
"2081-03-28",
|
287
|
+
"2082-04-17",
|
288
|
+
"2084-03-24",
|
289
|
+
"2085-04-13",
|
290
|
+
"2086-03-29",
|
291
|
+
"2087-04-18",
|
292
|
+
"2088-04-09",
|
293
|
+
"2090-04-14",
|
294
|
+
"2092-03-28",
|
295
|
+
"2093-04-10",
|
296
|
+
"2095-04-22",
|
297
|
+
"2096-04-13",
|
298
|
+
"2097-03-29",
|
299
|
+
"2098-04-18",
|
300
|
+
"2099-04-10",
|
301
|
+
]
|
302
|
+
|
303
|
+
BondsGoodFridayClosed = [Timestamp(x, tz="UTC") for x in goodFridayClosed]
|
304
|
+
|
305
|
+
goodFridayOpen = [
|
306
|
+
"1980-04-04",
|
307
|
+
"1983-04-01",
|
308
|
+
"1985-04-05",
|
309
|
+
"1988-04-01",
|
310
|
+
"1994-04-01",
|
311
|
+
"1996-04-05",
|
312
|
+
"1999-04-02",
|
313
|
+
"2007-04-06",
|
314
|
+
"2010-04-02",
|
315
|
+
"2012-04-06",
|
316
|
+
"2015-04-03",
|
317
|
+
"2021-04-02",
|
318
|
+
"2023-04-07",
|
319
|
+
"2026-04-03",
|
320
|
+
"2034-04-07",
|
321
|
+
"2037-04-03",
|
322
|
+
"2042-04-04",
|
323
|
+
"2045-04-07",
|
324
|
+
"2048-04-03",
|
325
|
+
"2053-04-04",
|
326
|
+
"2064-04-04",
|
327
|
+
"2067-04-01",
|
328
|
+
"2075-04-05",
|
329
|
+
"2078-04-01",
|
330
|
+
"2080-04-05",
|
331
|
+
"2083-04-02",
|
332
|
+
"2089-04-01",
|
333
|
+
"2091-04-06",
|
334
|
+
"2094-04-02",
|
335
|
+
]
|
336
|
+
|
337
|
+
BondsGoodFridayOpen = [Timestamp(x, tz="UTC") for x in goodFridayOpen]
|
338
|
+
|
339
|
+
|
340
|
+
class CMEBondExchangeCalendar(MarketCalendar):
|
341
|
+
"""
|
342
|
+
Exchange calendar for CME for Interest Rate and Bond products
|
343
|
+
|
344
|
+
The Holiday calendar is different between the open outcry trading floor hours and GLOBEX electronic trading hours.
|
345
|
+
This calendar attempts to be accurate for the GLOBEX holidays and hours from approx 2010 onward.
|
346
|
+
"""
|
347
|
+
|
348
|
+
aliases = [
|
349
|
+
"CME_Rate",
|
350
|
+
"CBOT_Rate",
|
351
|
+
"CME_InterestRate",
|
352
|
+
"CBOT_InterestRate",
|
353
|
+
"CME_Bond",
|
354
|
+
"CBOT_Bond",
|
355
|
+
]
|
356
|
+
regular_market_times = {
|
357
|
+
"market_open": ((None, time(17), -1),), # offset by -1 day
|
358
|
+
"market_close": ((None, time(16)),),
|
359
|
+
}
|
360
|
+
|
361
|
+
@property
|
362
|
+
def name(self):
|
363
|
+
return "CME_Bond"
|
364
|
+
|
365
|
+
@property
|
366
|
+
def tz(self):
|
367
|
+
return ZoneInfo("America/Chicago")
|
368
|
+
|
369
|
+
@property
|
370
|
+
def regular_holidays(self):
|
371
|
+
return AbstractHolidayCalendar(
|
372
|
+
rules=[
|
373
|
+
USNewYearsDay,
|
374
|
+
Christmas,
|
375
|
+
]
|
376
|
+
)
|
377
|
+
|
378
|
+
@property
|
379
|
+
def adhoc_holidays(self):
|
380
|
+
return list(chain(USNationalDaysofMourning, BondsGoodFridayClosed))
|
381
|
+
|
382
|
+
@property
|
383
|
+
def special_closes(self):
|
384
|
+
return [
|
385
|
+
(
|
386
|
+
time(12),
|
387
|
+
AbstractHolidayCalendar(
|
388
|
+
rules=[
|
389
|
+
USMartinLutherKingJrAfter1998,
|
390
|
+
USPresidentsDay,
|
391
|
+
USMemorialDay,
|
392
|
+
USIndependenceDay,
|
393
|
+
USLaborDay,
|
394
|
+
USThanksgivingDay,
|
395
|
+
]
|
396
|
+
),
|
397
|
+
),
|
398
|
+
(
|
399
|
+
time(12, 15),
|
400
|
+
AbstractHolidayCalendar(
|
401
|
+
rules=[
|
402
|
+
USBlackFridayInOrAfter1993,
|
403
|
+
ChristmasEveBefore1993,
|
404
|
+
ChristmasEveInOrAfter1993,
|
405
|
+
]
|
406
|
+
),
|
407
|
+
),
|
408
|
+
]
|
409
|
+
|
410
|
+
@property
|
411
|
+
def special_closes_adhoc(self):
|
412
|
+
return [(time(10, tzinfo=self.tz), BondsGoodFridayOpen)]
|