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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. pandas_market_calendars/__init__.py +38 -37
  2. pandas_market_calendars/calendar_registry.py +53 -48
  3. pandas_market_calendars/calendar_utils.py +261 -225
  4. pandas_market_calendars/calendars/asx.py +66 -63
  5. pandas_market_calendars/calendars/bmf.py +206 -227
  6. pandas_market_calendars/calendars/bse.py +407 -409
  7. pandas_market_calendars/calendars/cboe.py +145 -115
  8. pandas_market_calendars/calendars/cme.py +402 -240
  9. pandas_market_calendars/calendars/cme_globex_agriculture.py +126 -103
  10. pandas_market_calendars/calendars/cme_globex_base.py +119 -103
  11. pandas_market_calendars/calendars/cme_globex_crypto.py +160 -147
  12. pandas_market_calendars/calendars/cme_globex_energy_and_metals.py +216 -138
  13. pandas_market_calendars/calendars/cme_globex_equities.py +123 -104
  14. pandas_market_calendars/calendars/cme_globex_fixed_income.py +136 -113
  15. pandas_market_calendars/calendars/cme_globex_fx.py +101 -78
  16. pandas_market_calendars/calendars/eurex.py +139 -119
  17. pandas_market_calendars/calendars/eurex_fixed_income.py +98 -0
  18. pandas_market_calendars/calendars/hkex.py +426 -408
  19. pandas_market_calendars/calendars/ice.py +81 -65
  20. pandas_market_calendars/calendars/iex.py +112 -98
  21. pandas_market_calendars/calendars/jpx.py +109 -103
  22. pandas_market_calendars/calendars/lse.py +114 -91
  23. pandas_market_calendars/calendars/mirror.py +130 -114
  24. pandas_market_calendars/calendars/nyse.py +1324 -1127
  25. pandas_market_calendars/calendars/ose.py +116 -150
  26. pandas_market_calendars/calendars/sifma.py +350 -297
  27. pandas_market_calendars/calendars/six.py +132 -114
  28. pandas_market_calendars/calendars/sse.py +311 -290
  29. pandas_market_calendars/calendars/tase.py +197 -195
  30. pandas_market_calendars/calendars/tsx.py +181 -159
  31. pandas_market_calendars/class_registry.py +22 -16
  32. pandas_market_calendars/holidays/cme.py +385 -340
  33. pandas_market_calendars/holidays/cme_globex.py +214 -198
  34. pandas_market_calendars/holidays/cn.py +1455 -1436
  35. pandas_market_calendars/holidays/jp.py +398 -396
  36. pandas_market_calendars/holidays/jpx_equinox.py +453 -95
  37. pandas_market_calendars/holidays/nyse.py +1531 -1472
  38. pandas_market_calendars/holidays/oz.py +63 -65
  39. pandas_market_calendars/holidays/sifma.py +338 -321
  40. pandas_market_calendars/holidays/uk.py +32 -26
  41. pandas_market_calendars/holidays/us.py +376 -360
  42. pandas_market_calendars/market_calendar.py +895 -789
  43. {pandas_market_calendars-4.3.1.dist-info → pandas_market_calendars-4.3.3.dist-info}/METADATA +7 -5
  44. pandas_market_calendars-4.3.3.dist-info/RECORD +50 -0
  45. {pandas_market_calendars-4.3.1.dist-info → pandas_market_calendars-4.3.3.dist-info}/WHEEL +1 -1
  46. pandas_market_calendars-4.3.1.dist-info/RECORD +0 -49
  47. {pandas_market_calendars-4.3.1.dist-info → pandas_market_calendars-4.3.3.dist-info}/LICENSE +0 -0
  48. {pandas_market_calendars-4.3.1.dist-info → pandas_market_calendars-4.3.3.dist-info}/NOTICE +0 -0
  49. {pandas_market_calendars-4.3.1.dist-info → pandas_market_calendars-4.3.3.dist-info}/top_level.txt +0 -0
@@ -1,240 +1,402 @@
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 AbstractHolidayCalendar, GoodFriday, USLaborDay, USPresidentsDay, USThanksgivingDay
21
- from pytz import timezone
22
-
23
- from pandas_market_calendars.holidays.us import (Christmas, ChristmasEveBefore1993, ChristmasEveInOrAfter1993, USBlackFridayInOrAfter1993,
24
- USIndependenceDay, USMartinLutherKingJrAfter1998, USMemorialDay, USNationalDaysofMourning,
25
- USNewYearsDay)
26
- from pandas_market_calendars.market_calendar import MarketCalendar
27
-
28
-
29
- # Useful resources for making changes to this file: http://www.cmegroup.com/tools-information/holiday-calendar.html
30
- # The CME has different holiday rules depending on the type of instrument.
31
- # For example, http://www.cmegroup.com/tools-information/holiday-calendar/files/2016-4th-of-july-holiday-schedule.pdf # noqa
32
- # shows that Equity, Interest Rate, FX, Energy, Metals & DME Products close at 1200 CT on July 4, 2016, while Grain,
33
- # Oilseed & MGEX Products and Livestock, Dairy & Lumber products are completely closed.
34
-
35
-
36
- class CMEEquityExchangeCalendar(MarketCalendar):
37
- """
38
- Exchange calendar for CME for Equity products
39
-
40
- Open Time: 6:00 PM, America/New_York / 5:00 PM Chicago
41
- Close Time: 5:00 PM, America/New_York / 4:00 PM Chicago
42
- Break: 4:15 - 4:30pm America/New_York / 3:15 - 3:30 PM Chicago
43
- """
44
- aliases = ['CME_Equity', 'CBOT_Equity']
45
- regular_market_times = {
46
- "market_open": ((None, time(17), -1),), # offset by -1 day
47
- "market_close": ((None, time(16)),),
48
- "break_start": ((None, time(15,15)),),
49
- "break_end": ((None, time(15,30)),)
50
- }
51
-
52
- @property
53
- def name(self):
54
- return "CME_Equity"
55
-
56
- @property
57
- def tz(self):
58
- return timezone('America/Chicago')
59
-
60
- @property
61
- def regular_holidays(self):
62
- # Many days that are holidays for the NYSE are an early close day for CME
63
- return AbstractHolidayCalendar(rules=[
64
- USNewYearsDay,
65
- GoodFriday,
66
- Christmas,
67
- ])
68
-
69
- @property
70
- def adhoc_holidays(self):
71
- return USNationalDaysofMourning
72
-
73
- @property
74
- def special_closes(self):
75
- return [(
76
- time(12),
77
- AbstractHolidayCalendar(rules=[
78
- USMartinLutherKingJrAfter1998,
79
- USPresidentsDay,
80
- USMemorialDay,
81
- USLaborDay,
82
- USIndependenceDay,
83
- USThanksgivingDay,
84
- USBlackFridayInOrAfter1993,
85
- ChristmasEveBefore1993,
86
- ChristmasEveInOrAfter1993,
87
- ])
88
- )]
89
-
90
-
91
-
92
- class CMEAgricultureExchangeCalendar(MarketCalendar):
93
- """
94
- Exchange calendar for CME for Agriculture products
95
-
96
- Open Time: 5:00 PM, America/Chicago
97
- Close Time: 5:00 PM, America/Chicago
98
-
99
- Regularly-Observed Holidays:
100
- - New Years Day
101
- - Good Friday
102
- - Christmas
103
- """
104
- aliases = ['CME_Agriculture', 'CBOT_Agriculture', 'COMEX_Agriculture', 'NYMEX_Agriculture']
105
- regular_market_times = {
106
- "market_open": ((None, time(17, 1), -1),), # offset by -1 day
107
- "market_close": ((None, time(17)),)
108
- }
109
-
110
- @property
111
- def name(self):
112
- return "CME_Agriculture"
113
-
114
- @property
115
- def tz(self):
116
- return timezone('America/Chicago')
117
-
118
- @property
119
- def regular_holidays(self):
120
- # Ignore gap between 13:20 CST and 14:30 CST for regular trading hours
121
- #
122
- # The CME has different holiday rules depending on the type of
123
- # instrument. For example, http://www.cmegroup.com/tools-information/holiday-calendar/files/2016-4th-of-july-holiday-schedule.pdf # noqa
124
- # shows that Equity, Interest Rate, FX, Energy, Metals & DME Products
125
- # close at 1200 CT on July 4, 2016, while Grain, Oilseed & MGEX
126
- # Products and Livestock, Dairy & Lumber products are completely
127
- # closed.
128
- return AbstractHolidayCalendar(rules=[
129
- USNewYearsDay,
130
- USMartinLutherKingJrAfter1998,
131
- USPresidentsDay,
132
- GoodFriday,
133
- USMemorialDay,
134
- USIndependenceDay,
135
- USLaborDay,
136
- USThanksgivingDay,
137
- Christmas,
138
- ])
139
-
140
- @property
141
- def adhoc_holidays(self):
142
- return USNationalDaysofMourning
143
-
144
- @property
145
- def special_closes(self):
146
- return [(
147
- time(12),
148
- AbstractHolidayCalendar(rules=[
149
- USBlackFridayInOrAfter1993,
150
- ChristmasEveBefore1993,
151
- ChristmasEveInOrAfter1993,
152
- ])
153
- )]
154
-
155
-
156
- # For the bond market Good Friday that coincides with the release of NFP on the first friday of the month is an open day
157
- goodFridayClosed = ['1970-03-27', '1971-04-09', '1972-03-31', '1973-04-20', '1974-04-12', '1975-03-28', '1976-04-16',
158
- '1977-04-08', '1978-03-24', '1979-04-13', '1981-04-17', '1982-04-09', '1984-04-20', '1986-03-28',
159
- '1987-04-17', '1989-03-24', '1990-04-13', '1991-03-29', '1992-04-17', '1993-04-09', '1995-04-14',
160
- '1997-03-28', '1998-04-10', '2000-04-21', '2001-04-13', '2002-03-29', '2003-04-18', '2004-04-09',
161
- '2005-03-25', '2006-04-14', '2008-03-21', '2009-04-10', '2011-04-22', '2013-03-29', '2014-04-18',
162
- '2016-03-25', '2017-04-14', '2018-03-30', '2019-04-19', '2020-04-10', '2022-04-15', '2024-03-29',
163
- '2025-04-18', '2027-03-26', '2028-04-14', '2029-03-30', '2030-04-19', '2031-04-11', '2032-03-26',
164
- '2033-04-15', '2035-03-23', '2036-04-11', '2038-04-23', '2039-04-08', '2040-03-30', '2041-04-19',
165
- '2043-03-27', '2044-04-15', '2046-03-23', '2047-04-12', '2049-04-16', '2050-04-08', '2051-03-31',
166
- '2052-04-19', '2054-03-27', '2055-04-16', '2056-03-31', '2057-04-20', '2058-04-12', '2059-03-28',
167
- '2060-04-16', '2061-04-08', '2062-03-24', '2063-04-13', '2065-03-27', '2066-04-09', '2068-04-20',
168
- '2069-04-12', '2070-03-28', '2071-04-17', '2072-04-08', '2073-03-24', '2074-04-13', '2076-04-17',
169
- '2077-04-09', '2079-04-21', '2081-03-28', '2082-04-17', '2084-03-24', '2085-04-13', '2086-03-29',
170
- '2087-04-18', '2088-04-09', '2090-04-14', '2092-03-28', '2093-04-10', '2095-04-22', '2096-04-13',
171
- '2097-03-29', '2098-04-18', '2099-04-10']
172
-
173
- BondsGoodFridayClosed = [Timestamp(x, tz='UTC') for x in goodFridayClosed]
174
-
175
- goodFridayOpen = ['1980-04-04', '1983-04-01', '1985-04-05', '1988-04-01', '1994-04-01', '1996-04-05', '1999-04-02',
176
- '2007-04-06', '2010-04-02', '2012-04-06', '2015-04-03', '2021-04-02', '2023-04-07', '2026-04-03',
177
- '2034-04-07', '2037-04-03', '2042-04-04', '2045-04-07', '2048-04-03', '2053-04-04', '2064-04-04',
178
- '2067-04-01', '2075-04-05', '2078-04-01', '2080-04-05', '2083-04-02', '2089-04-01', '2091-04-06',
179
- '2094-04-02']
180
-
181
- BondsGoodFridayOpen = [Timestamp(x, tz='UTC') for x in goodFridayOpen]
182
-
183
-
184
- class CMEBondExchangeCalendar(MarketCalendar):
185
- """
186
- Exchange calendar for CME for Interest Rate and Bond products
187
-
188
- The Holiday calendar is different between the open outcry trading floor hours and GLOBEX electronic trading hours.
189
- This calendar attempts to be accurate for the GLOBEX holidays and hours from approx 2010 onward.
190
- """
191
- aliases = ['CME_Rate', 'CBOT_Rate', 'CME_InterestRate', 'CBOT_InterestRate', 'CME_Bond', 'CBOT_Bond']
192
- regular_market_times = {
193
- "market_open": ((None, time(17), -1),), # offset by -1 day
194
- "market_close": ((None, time(16)),)
195
- }
196
-
197
- @property
198
- def name(self):
199
- return "CME_Bond"
200
-
201
- @property
202
- def tz(self):
203
- return timezone('America/Chicago')
204
-
205
- @property
206
- def regular_holidays(self):
207
- return AbstractHolidayCalendar(rules=[
208
- USNewYearsDay,
209
- Christmas,
210
- ])
211
-
212
- @property
213
- def adhoc_holidays(self):
214
- return list(chain(USNationalDaysofMourning, BondsGoodFridayClosed))
215
-
216
- @property
217
- def special_closes(self):
218
- return [
219
- (time(12),
220
- AbstractHolidayCalendar(rules=[
221
- USMartinLutherKingJrAfter1998,
222
- USPresidentsDay,
223
- USMemorialDay,
224
- USIndependenceDay,
225
- USLaborDay,
226
- USThanksgivingDay,
227
- ])),
228
- (time(12, 15),
229
- AbstractHolidayCalendar(rules=[
230
- USBlackFridayInOrAfter1993,
231
- ChristmasEveBefore1993,
232
- ChristmasEveInOrAfter1993,
233
- ]))
234
- ]
235
-
236
- @property
237
- def special_closes_adhoc(self):
238
- return [
239
- (time(10, tzinfo=self.tz), BondsGoodFridayOpen)
240
- ]
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)]