pandas-market-calendars 4.1.3__py3-none-any.whl → 4.2.0__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-4.1.3.dist-info → pandas_market_calendars-4.2.0.dist-info}/METADATA +200 -187
- pandas_market_calendars-4.2.0.dist-info/NOTICE +206 -0
- pandas_market_calendars-4.2.0.dist-info/RECORD +6 -0
- {pandas_market_calendars-4.1.3.dist-info → pandas_market_calendars-4.2.0.dist-info}/WHEEL +1 -1
- pandas_market_calendars/__init__.py +0 -37
- pandas_market_calendars/calendar_registry.py +0 -47
- pandas_market_calendars/calendar_utils.py +0 -225
- pandas_market_calendars/class_registry.py +0 -111
- pandas_market_calendars/exchange_calendar_asx.py +0 -63
- pandas_market_calendars/exchange_calendar_bmf.py +0 -227
- pandas_market_calendars/exchange_calendar_bse.py +0 -409
- pandas_market_calendars/exchange_calendar_cboe.py +0 -115
- pandas_market_calendars/exchange_calendar_cme.py +0 -240
- pandas_market_calendars/exchange_calendar_cme_globex_agriculture.py +0 -109
- pandas_market_calendars/exchange_calendar_cme_globex_base.py +0 -106
- pandas_market_calendars/exchange_calendar_cme_globex_energy_and_metals.py +0 -146
- pandas_market_calendars/exchange_calendar_cme_globex_equities.py +0 -104
- pandas_market_calendars/exchange_calendar_cme_globex_fixed_income.py +0 -114
- pandas_market_calendars/exchange_calendar_cme_globex_fx.py +0 -78
- pandas_market_calendars/exchange_calendar_eurex.py +0 -119
- pandas_market_calendars/exchange_calendar_hkex.py +0 -408
- pandas_market_calendars/exchange_calendar_ice.py +0 -65
- pandas_market_calendars/exchange_calendar_iex.py +0 -98
- pandas_market_calendars/exchange_calendar_jpx.py +0 -98
- pandas_market_calendars/exchange_calendar_lse.py +0 -91
- pandas_market_calendars/exchange_calendar_nyse.py +0 -1127
- pandas_market_calendars/exchange_calendar_ose.py +0 -150
- pandas_market_calendars/exchange_calendar_sifma.py +0 -300
- pandas_market_calendars/exchange_calendar_six.py +0 -114
- pandas_market_calendars/exchange_calendar_sse.py +0 -290
- pandas_market_calendars/exchange_calendar_tase.py +0 -119
- pandas_market_calendars/exchange_calendar_tsx.py +0 -159
- pandas_market_calendars/exchange_calendars_mirror.py +0 -114
- pandas_market_calendars/holidays_cme.py +0 -341
- pandas_market_calendars/holidays_cme_globex.py +0 -169
- pandas_market_calendars/holidays_cn.py +0 -1436
- pandas_market_calendars/holidays_jp.py +0 -362
- pandas_market_calendars/holidays_nyse.py +0 -1474
- pandas_market_calendars/holidays_oz.py +0 -65
- pandas_market_calendars/holidays_sifma.py +0 -321
- pandas_market_calendars/holidays_uk.py +0 -177
- pandas_market_calendars/holidays_us.py +0 -364
- pandas_market_calendars/jpx_equinox.py +0 -147
- pandas_market_calendars/market_calendar.py +0 -770
- pandas_market_calendars-4.1.3.dist-info/RECORD +0 -45
- {pandas_market_calendars-4.1.3.dist-info → pandas_market_calendars-4.2.0.dist-info}/LICENSE +0 -0
- {pandas_market_calendars-4.1.3.dist-info → pandas_market_calendars-4.2.0.dist-info}/top_level.txt +0 -0
@@ -1,115 +0,0 @@
|
|
1
|
-
from datetime import time
|
2
|
-
|
3
|
-
from pandas.tseries.holiday import AbstractHolidayCalendar, \
|
4
|
-
GoodFriday, USLaborDay, USPresidentsDay, USThanksgivingDay, Holiday
|
5
|
-
from pytz import timezone
|
6
|
-
from itertools import chain
|
7
|
-
import pandas as pd
|
8
|
-
|
9
|
-
from .holidays_us import (Christmas, USBlackFridayInOrAfter1993, USIndependenceDay, USMartinLutherKingJrAfter1998,
|
10
|
-
USMemorialDay, USNewYearsDay, HurricaneSandyClosings, USNationalDaysofMourning)
|
11
|
-
from .market_calendar import MarketCalendar
|
12
|
-
|
13
|
-
|
14
|
-
def good_friday_unless_christmas_nye_friday(dt):
|
15
|
-
"""
|
16
|
-
Good Friday is a valid trading day if Christmas Day or New Years Day fall
|
17
|
-
on a Friday.
|
18
|
-
"""
|
19
|
-
year_str = str(dt.year)
|
20
|
-
christmas_weekday = Christmas.observance(
|
21
|
-
pd.Timestamp(year_str+"-12-25")
|
22
|
-
).weekday()
|
23
|
-
nyd_weekday = USNewYearsDay.observance(
|
24
|
-
pd.Timestamp(year_str+"-01-01")
|
25
|
-
).weekday()
|
26
|
-
if christmas_weekday != 4 and nyd_weekday != 4:
|
27
|
-
return GoodFriday._apply_rule(
|
28
|
-
pd.Timestamp(str(dt.year)+"-"+str(dt.month)+"-"+str(dt.day))
|
29
|
-
)
|
30
|
-
else:
|
31
|
-
# compatibility for pandas 0.18.1
|
32
|
-
return pd.NaT
|
33
|
-
|
34
|
-
|
35
|
-
GoodFridayUnlessChristmasNYEFriday = Holiday(
|
36
|
-
name="Good Friday CFE",
|
37
|
-
month=1,
|
38
|
-
day=1,
|
39
|
-
observance=good_friday_unless_christmas_nye_friday,
|
40
|
-
)
|
41
|
-
|
42
|
-
|
43
|
-
class CFEExchangeCalendar(MarketCalendar):
|
44
|
-
"""
|
45
|
-
Exchange calendar for the CBOE Futures Exchange (CFE).
|
46
|
-
|
47
|
-
http://cfe.cboe.com/aboutcfe/expirationcalendar.aspx
|
48
|
-
|
49
|
-
Open Time: 8:30am, America/Chicago
|
50
|
-
Close Time: 3:15pm, America/Chicago
|
51
|
-
|
52
|
-
(We are ignoring extended trading hours for now)
|
53
|
-
"""
|
54
|
-
aliases = ['CFE', "CBOE_Futures"]
|
55
|
-
regular_market_times = {
|
56
|
-
"market_open": ((None, time(8, 30)),),
|
57
|
-
"market_close": ((None, time(15, 15)),)
|
58
|
-
}
|
59
|
-
|
60
|
-
|
61
|
-
@property
|
62
|
-
def name(self):
|
63
|
-
return "CFE"
|
64
|
-
|
65
|
-
@property
|
66
|
-
def tz(self):
|
67
|
-
return timezone("America/Chicago")
|
68
|
-
|
69
|
-
@property
|
70
|
-
def regular_holidays(self):
|
71
|
-
return AbstractHolidayCalendar(rules=[
|
72
|
-
USNewYearsDay,
|
73
|
-
USMartinLutherKingJrAfter1998,
|
74
|
-
USPresidentsDay,
|
75
|
-
GoodFridayUnlessChristmasNYEFriday,
|
76
|
-
USIndependenceDay,
|
77
|
-
USMemorialDay,
|
78
|
-
USLaborDay,
|
79
|
-
USThanksgivingDay,
|
80
|
-
Christmas
|
81
|
-
])
|
82
|
-
|
83
|
-
@property
|
84
|
-
def special_closes(self):
|
85
|
-
return [(
|
86
|
-
time(12, 15),
|
87
|
-
AbstractHolidayCalendar(rules=[
|
88
|
-
USBlackFridayInOrAfter1993,
|
89
|
-
])
|
90
|
-
)]
|
91
|
-
|
92
|
-
@property
|
93
|
-
def adhoc_holidays(self):
|
94
|
-
return list(chain(
|
95
|
-
HurricaneSandyClosings,
|
96
|
-
USNationalDaysofMourning,
|
97
|
-
))
|
98
|
-
|
99
|
-
class CBOEEquityOptionsExchangeCalendar(CFEExchangeCalendar):
|
100
|
-
name = "CBOE_Equity_Options"
|
101
|
-
aliases = [name]
|
102
|
-
regular_market_times = {
|
103
|
-
"market_open": ((None, time(8, 30)),),
|
104
|
-
"market_close": ((None, time(15)),)
|
105
|
-
}
|
106
|
-
|
107
|
-
class CBOEIndexOptionsExchangeCalendar(CFEExchangeCalendar):
|
108
|
-
name = "CBOE_Index_Options"
|
109
|
-
aliases = [name]
|
110
|
-
regular_market_times = {
|
111
|
-
"market_open": ((None, time(8, 30)),),
|
112
|
-
"market_close": ((None, time(15, 15)),)
|
113
|
-
}
|
114
|
-
|
115
|
-
|
@@ -1,240 +0,0 @@
|
|
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 .holidays_us import (Christmas, ChristmasEveBefore1993, ChristmasEveInOrAfter1993, USBlackFridayInOrAfter1993,
|
24
|
-
USIndependenceDay, USMartinLutherKingJrAfter1998, USMemorialDay, USNationalDaysofMourning,
|
25
|
-
USNewYearsDay)
|
26
|
-
from .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,109 +0,0 @@
|
|
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 abc import ABC, abstractmethod
|
17
|
-
from .exchange_calendar_cme_globex_base import CMEGlobexBaseExchangeCalendar
|
18
|
-
|
19
|
-
from datetime import time
|
20
|
-
from itertools import chain
|
21
|
-
|
22
|
-
from pandas import Timestamp
|
23
|
-
from pandas.tseries.holiday import AbstractHolidayCalendar, GoodFriday, USLaborDay, USPresidentsDay, USThanksgivingDay
|
24
|
-
from pytz import timezone
|
25
|
-
|
26
|
-
from .holidays_us import (Christmas, ChristmasEveBefore1993, ChristmasEveInOrAfter1993, USBlackFridayInOrAfter1993,
|
27
|
-
USIndependenceDay, USMartinLutherKingJrAfter1998, USMemorialDay, USJuneteenthAfter2022,
|
28
|
-
USNationalDaysofMourning, USNewYearsDay)
|
29
|
-
from .market_calendar import MarketCalendar
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
class CMEGlobexAgricultureExchangeCalendar(CMEGlobexBaseExchangeCalendar):
|
35
|
-
"""
|
36
|
-
Exchange calendar for CME for Agriculture products
|
37
|
-
|
38
|
-
Products:
|
39
|
-
- Grains and Oilseeds (same trading hours and holidays)
|
40
|
-
- Livestock
|
41
|
-
- Dairy
|
42
|
-
- Fertilizer
|
43
|
-
- Lumber and Softs
|
44
|
-
|
45
|
-
|
46
|
-
"""
|
47
|
-
|
48
|
-
@property
|
49
|
-
@abstractmethod
|
50
|
-
def name(self):
|
51
|
-
"""
|
52
|
-
Name of the market
|
53
|
-
|
54
|
-
:return: string name
|
55
|
-
"""
|
56
|
-
raise NotImplementedError()
|
57
|
-
|
58
|
-
|
59
|
-
class CMEGlobexLivestockExchangeCalendar(CMEGlobexAgricultureExchangeCalendar):
|
60
|
-
"""
|
61
|
-
Exchange calendar for CME for Livestock products
|
62
|
-
|
63
|
-
https://www.cmegroup.com/trading/agricultural/livestock.html
|
64
|
-
|
65
|
-
GLOBEX Trading Times
|
66
|
-
https://www.cmegroup.com/markets/agriculture/livestock/live-cattle.contractSpecs.html
|
67
|
-
Monday - Friday: 8:30 a.m. - 1:05 p.m. CT
|
68
|
-
"""
|
69
|
-
aliases = ['CMEGlobex_Livestock', 'CMEGlobex_Live_Cattle', 'CMEGlobex_Feeder_Cattle', 'CMEGlobex_Lean_Hog', 'CMEGlobex_Port_Cutout']
|
70
|
-
|
71
|
-
regular_market_times = {
|
72
|
-
"market_open": ((None, time(8, 30)),),
|
73
|
-
"market_close": ((None, time(13, 5)),)
|
74
|
-
}
|
75
|
-
|
76
|
-
@property
|
77
|
-
def name(self):
|
78
|
-
return "CMEGlobex_Livestock"
|
79
|
-
|
80
|
-
@property
|
81
|
-
def regular_holidays(self):
|
82
|
-
return AbstractHolidayCalendar(rules=[
|
83
|
-
USNewYearsDay,
|
84
|
-
USMartinLutherKingJrAfter1998,
|
85
|
-
USPresidentsDay,
|
86
|
-
GoodFriday,
|
87
|
-
USMemorialDay,
|
88
|
-
USIndependenceDay,
|
89
|
-
USLaborDay,
|
90
|
-
USThanksgivingDay,
|
91
|
-
Christmas,
|
92
|
-
])
|
93
|
-
|
94
|
-
# @property
|
95
|
-
# def adhoc_holidays(self):
|
96
|
-
# return USNationalDaysofMourning
|
97
|
-
|
98
|
-
@property
|
99
|
-
def special_closes(self):
|
100
|
-
return [(
|
101
|
-
time(12, 5),
|
102
|
-
AbstractHolidayCalendar(rules=[
|
103
|
-
USBlackFridayInOrAfter1993,
|
104
|
-
ChristmasEveBefore1993,
|
105
|
-
ChristmasEveInOrAfter1993,
|
106
|
-
])
|
107
|
-
)]
|
108
|
-
|
109
|
-
|
@@ -1,106 +0,0 @@
|
|
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 abc import ABC, abstractmethod
|
17
|
-
|
18
|
-
from datetime import time
|
19
|
-
from itertools import chain
|
20
|
-
|
21
|
-
from pandas import Timestamp
|
22
|
-
from pandas.tseries.holiday import AbstractHolidayCalendar, GoodFriday, USLaborDay, USPresidentsDay, USThanksgivingDay
|
23
|
-
from pytz import timezone
|
24
|
-
|
25
|
-
from .holidays_us import (Christmas, ChristmasEveBefore1993, ChristmasEveInOrAfter1993, USBlackFridayInOrAfter1993,
|
26
|
-
USIndependenceDay, USMartinLutherKingJrAfter1998, USMemorialDay, USJuneteenthAfter2022,
|
27
|
-
USNationalDaysofMourning, USNewYearsDay)
|
28
|
-
from .market_calendar import MarketCalendar
|
29
|
-
|
30
|
-
|
31
|
-
class CMEGlobexBaseExchangeCalendar(MarketCalendar, ABC):
|
32
|
-
"""
|
33
|
-
Base Exchange Calendar for CME.
|
34
|
-
|
35
|
-
CME Markets: https://www.cmegroup.com/markets/agriculture.html#overview
|
36
|
-
- Agriculture
|
37
|
-
- Energy
|
38
|
-
- Equity Index
|
39
|
-
- FX
|
40
|
-
- Interest Rates
|
41
|
-
- Metals
|
42
|
-
- Options
|
43
|
-
|
44
|
-
Holiays for which entire GLOBEX is closed:
|
45
|
-
- New Years Day
|
46
|
-
- Good Friday
|
47
|
-
- Christmas
|
48
|
-
|
49
|
-
Product Specific Closures:
|
50
|
-
- MLK Day
|
51
|
-
- Presidents Day
|
52
|
-
- Memorial Day
|
53
|
-
- Juneteenth
|
54
|
-
- US Independence Day
|
55
|
-
- US Labor Day
|
56
|
-
- US Thanksgiving Day
|
57
|
-
"""
|
58
|
-
@property
|
59
|
-
@abstractmethod
|
60
|
-
def name(self):
|
61
|
-
"""
|
62
|
-
Name of the market
|
63
|
-
|
64
|
-
:return: string name
|
65
|
-
"""
|
66
|
-
raise NotImplementedError()
|
67
|
-
|
68
|
-
@property
|
69
|
-
def tz(self):
|
70
|
-
return timezone('America/Chicago')
|
71
|
-
|
72
|
-
@property
|
73
|
-
def regular_holidays(self):
|
74
|
-
return AbstractHolidayCalendar(rules=[
|
75
|
-
USNewYearsDay,
|
76
|
-
GoodFriday,
|
77
|
-
Christmas,
|
78
|
-
])
|
79
|
-
|
80
|
-
# I can't find any reference to these special closings onther than NYSE
|
81
|
-
# @property
|
82
|
-
# def adhoc_holidays(self):
|
83
|
-
# return USNationalDaysofMourning
|
84
|
-
|
85
|
-
@property
|
86
|
-
def special_closes(self):
|
87
|
-
return [(
|
88
|
-
self.special_close_time,
|
89
|
-
AbstractHolidayCalendar(rules=[
|
90
|
-
USMartinLutherKingJrAfter1998,
|
91
|
-
USPresidentsDay,
|
92
|
-
USMemorialDay,
|
93
|
-
USJuneteenthAfter2022,
|
94
|
-
USLaborDay,
|
95
|
-
USIndependenceDay,
|
96
|
-
USThanksgivingDay,
|
97
|
-
USBlackFridayInOrAfter1993,
|
98
|
-
ChristmasEveBefore1993,
|
99
|
-
ChristmasEveInOrAfter1993,
|
100
|
-
])
|
101
|
-
)]
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|