pandas-market-calendars 4.3.2__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.
- pandas_market_calendars/__init__.py +38 -38
- pandas_market_calendars/calendar_registry.py +53 -52
- pandas_market_calendars/calendar_utils.py +261 -261
- pandas_market_calendars/calendars/asx.py +66 -66
- pandas_market_calendars/calendars/bmf.py +206 -206
- pandas_market_calendars/calendars/bse.py +407 -407
- pandas_market_calendars/calendars/cboe.py +145 -145
- pandas_market_calendars/calendars/cme.py +402 -402
- pandas_market_calendars/calendars/cme_globex_agriculture.py +126 -127
- pandas_market_calendars/calendars/cme_globex_base.py +119 -119
- pandas_market_calendars/calendars/cme_globex_crypto.py +160 -147
- pandas_market_calendars/calendars/cme_globex_energy_and_metals.py +216 -216
- pandas_market_calendars/calendars/cme_globex_equities.py +123 -121
- pandas_market_calendars/calendars/cme_globex_fixed_income.py +136 -134
- pandas_market_calendars/calendars/cme_globex_fx.py +101 -92
- pandas_market_calendars/calendars/eurex.py +139 -139
- pandas_market_calendars/calendars/eurex_fixed_income.py +98 -0
- pandas_market_calendars/calendars/hkex.py +426 -426
- pandas_market_calendars/calendars/ice.py +81 -81
- pandas_market_calendars/calendars/iex.py +112 -111
- pandas_market_calendars/calendars/jpx.py +109 -109
- pandas_market_calendars/calendars/lse.py +114 -114
- pandas_market_calendars/calendars/mirror.py +130 -129
- pandas_market_calendars/calendars/nyse.py +1324 -1324
- pandas_market_calendars/calendars/ose.py +116 -116
- pandas_market_calendars/calendars/sifma.py +350 -335
- pandas_market_calendars/calendars/six.py +132 -132
- pandas_market_calendars/calendars/sse.py +311 -311
- pandas_market_calendars/calendars/tase.py +197 -195
- pandas_market_calendars/calendars/tsx.py +181 -181
- pandas_market_calendars/holidays/cme.py +385 -372
- pandas_market_calendars/holidays/cme_globex.py +214 -223
- pandas_market_calendars/holidays/cn.py +1455 -1455
- pandas_market_calendars/holidays/jp.py +398 -394
- pandas_market_calendars/holidays/nyse.py +1531 -1539
- pandas_market_calendars/holidays/oz.py +63 -65
- pandas_market_calendars/holidays/sifma.py +338 -350
- pandas_market_calendars/holidays/us.py +376 -377
- pandas_market_calendars/market_calendar.py +895 -895
- {pandas_market_calendars-4.3.2.dist-info → pandas_market_calendars-4.3.3.dist-info}/METADATA +3 -3
- pandas_market_calendars-4.3.3.dist-info/RECORD +50 -0
- pandas_market_calendars-4.3.2.dist-info/RECORD +0 -49
- {pandas_market_calendars-4.3.2.dist-info → pandas_market_calendars-4.3.3.dist-info}/LICENSE +0 -0
- {pandas_market_calendars-4.3.2.dist-info → pandas_market_calendars-4.3.3.dist-info}/NOTICE +0 -0
- {pandas_market_calendars-4.3.2.dist-info → pandas_market_calendars-4.3.3.dist-info}/WHEEL +0 -0
- {pandas_market_calendars-4.3.2.dist-info → pandas_market_calendars-4.3.3.dist-info}/top_level.txt +0 -0
@@ -1,402 +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 (
|
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
|
+
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)]
|