pandas-market-calendars 4.3.3__py3-none-any.whl → 4.6.0__py3-none-any.whl

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