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.
- pandas_market_calendars/__init__.py +39 -38
- pandas_market_calendars/calendar_registry.py +57 -53
- pandas_market_calendars/calendar_utils.py +1200 -261
- pandas_market_calendars/calendars/asx.py +66 -66
- pandas_market_calendars/calendars/bmf.py +223 -206
- pandas_market_calendars/calendars/bse.py +421 -407
- pandas_market_calendars/calendars/cboe.py +145 -145
- pandas_market_calendars/calendars/cme.py +405 -402
- pandas_market_calendars/calendars/cme_globex_agriculture.py +172 -126
- pandas_market_calendars/calendars/cme_globex_base.py +119 -119
- pandas_market_calendars/calendars/cme_globex_crypto.py +160 -160
- pandas_market_calendars/calendars/cme_globex_energy_and_metals.py +216 -216
- pandas_market_calendars/calendars/cme_globex_equities.py +123 -123
- pandas_market_calendars/calendars/cme_globex_fixed_income.py +136 -136
- pandas_market_calendars/calendars/cme_globex_fx.py +101 -101
- pandas_market_calendars/calendars/eurex.py +131 -139
- pandas_market_calendars/calendars/eurex_fixed_income.py +98 -98
- pandas_market_calendars/calendars/hkex.py +429 -426
- pandas_market_calendars/calendars/ice.py +81 -81
- pandas_market_calendars/calendars/iex.py +151 -112
- pandas_market_calendars/calendars/jpx.py +113 -109
- pandas_market_calendars/calendars/lse.py +114 -114
- pandas_market_calendars/calendars/mirror.py +149 -130
- pandas_market_calendars/calendars/nyse.py +1466 -1324
- pandas_market_calendars/calendars/ose.py +116 -116
- pandas_market_calendars/calendars/sifma.py +354 -350
- pandas_market_calendars/calendars/six.py +132 -132
- pandas_market_calendars/calendars/sse.py +311 -311
- pandas_market_calendars/calendars/tase.py +220 -197
- pandas_market_calendars/calendars/tsx.py +181 -181
- pandas_market_calendars/holidays/cme.py +385 -385
- pandas_market_calendars/holidays/cme_globex.py +214 -214
- pandas_market_calendars/holidays/cn.py +1476 -1455
- pandas_market_calendars/holidays/jp.py +401 -398
- pandas_market_calendars/holidays/jpx_equinox.py +1 -0
- pandas_market_calendars/holidays/nyse.py +1536 -1531
- pandas_market_calendars/holidays/oz.py +63 -63
- pandas_market_calendars/holidays/sifma.py +350 -338
- pandas_market_calendars/holidays/us.py +376 -376
- pandas_market_calendars/market_calendar.py +1057 -895
- {pandas_market_calendars-4.3.3.dist-info → pandas_market_calendars-4.6.0.dist-info}/METADATA +13 -9
- pandas_market_calendars-4.6.0.dist-info/RECORD +50 -0
- {pandas_market_calendars-4.3.3.dist-info → pandas_market_calendars-4.6.0.dist-info}/WHEEL +1 -1
- pandas_market_calendars-4.3.3.dist-info/RECORD +0 -50
- {pandas_market_calendars-4.3.3.dist-info → pandas_market_calendars-4.6.0.dist-info}/LICENSE +0 -0
- {pandas_market_calendars-4.3.3.dist-info → pandas_market_calendars-4.6.0.dist-info}/NOTICE +0 -0
- {pandas_market_calendars-4.3.3.dist-info → pandas_market_calendars-4.6.0.dist-info}/top_level.txt +0 -0
@@ -1,216 +1,216 @@
|
|
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
|
-
|
18
|
-
from pandas.tseries.holiday import (
|
19
|
-
AbstractHolidayCalendar,
|
20
|
-
) # , GoodFriday, USLaborDay, USPresidentsDay, USThanksgivingDay
|
21
|
-
from pytz import timezone
|
22
|
-
|
23
|
-
from pandas_market_calendars.holidays.cme_globex import (
|
24
|
-
USMartinLutherKingJrFrom2022,
|
25
|
-
USMartinLutherKingJrPre2022,
|
26
|
-
USNewYearsDay,
|
27
|
-
USPresidentsDayFrom2022,
|
28
|
-
USPresidentsDayPre2022,
|
29
|
-
GoodFriday,
|
30
|
-
USMemorialDayFrom2022,
|
31
|
-
USMemorialDayPre2022,
|
32
|
-
USJuneteenthFrom2022,
|
33
|
-
USIndependenceDayFrom2022,
|
34
|
-
USIndependenceDayPre2022,
|
35
|
-
USLaborDay,
|
36
|
-
USThanksgivingDayFrom2022,
|
37
|
-
USThanksgivingDayPre2022,
|
38
|
-
FridayAfterThanksgiving,
|
39
|
-
ChristmasCME,
|
40
|
-
)
|
41
|
-
from .cme_globex_base import CMEGlobexBaseExchangeCalendar
|
42
|
-
|
43
|
-
|
44
|
-
# from .holidays_us import (Christmas, ChristmasEveBefore1993, ChristmasEveInOrAfter1993, USBlackFridayInOrAfter1993,
|
45
|
-
# USIndependenceDay, USMartinLutherKingJrAfter1998, USMemorialDay, USJuneteenthAfter2022,
|
46
|
-
# USNationalDaysofMourning, USNewYearsDay)
|
47
|
-
|
48
|
-
|
49
|
-
class CMEGlobexEnergyAndMetalsExchangeCalendar(CMEGlobexBaseExchangeCalendar):
|
50
|
-
"""
|
51
|
-
Exchange calendar for CME for Energy and Metals products
|
52
|
-
|
53
|
-
Both follow the same trading/holiday schedule
|
54
|
-
|
55
|
-
NOT IMPLEMENTED: Dubai Mercantile Exchange (DME) follows this schedule but with holiday exceptions.
|
56
|
-
|
57
|
-
Energy Products:
|
58
|
-
Crude and Refined: https://www.cmegroup.com/trading/energy/crude-and-refined-products.html
|
59
|
-
- HO NY Harbor ULSD Futures
|
60
|
-
- CL Crude Oil Futures
|
61
|
-
- RB RBOB Gasoline Futures
|
62
|
-
- MCL Micro WTI Crude Oil Futures
|
63
|
-
Natural Gas
|
64
|
-
- NG Henry Hub Natural Gas Futures
|
65
|
-
- TTF Dutch TTF Natural Gas Calendar Month Futures
|
66
|
-
- NN Henry Hub Natural Gas Last Day Financial Futures
|
67
|
-
Voluntary Carbon Emissions Offset Futures
|
68
|
-
- CGO CBL Core Global Emmissions Offset (C-GEO) Futures
|
69
|
-
- NGO CBL Nature-based Global Emissionns Offset Futures
|
70
|
-
- GEO CBL Global Emissions Offset Futures
|
71
|
-
|
72
|
-
Metals Products: https://www.cmegroup.com/markets/metals.html
|
73
|
-
Precious Metals
|
74
|
-
- GC Gold Futures
|
75
|
-
- SI Silver Futures
|
76
|
-
- PL Platinum Futures
|
77
|
-
Base Metals
|
78
|
-
- HG Copper Futures
|
79
|
-
- ALI Aluminum Futures
|
80
|
-
- QC E-mini Copper Futures
|
81
|
-
Ferrous Metals
|
82
|
-
- HRC U.S. Midwest Domestic Hot-Rolled Coil Steel (CRU) Index Futures
|
83
|
-
- BUS U.S. Midwest Busheling Ferrous Scrap (AMM) Futures
|
84
|
-
- TIO Iron Ore 62% Fe, CFR China (Platts) Futures
|
85
|
-
|
86
|
-
Sample GLOBEX Trading Times
|
87
|
-
https://www.cmegroup.com/markets/energy/crude-oil/light-sweet-crude.contractSpecs.html
|
88
|
-
Sunday - Friday: 5:00pm - 4:00 pm CT
|
89
|
-
|
90
|
-
Calendar: http://www.cmegroup.com/tools-information/holiday-calendar.html
|
91
|
-
"""
|
92
|
-
|
93
|
-
aliases = [
|
94
|
-
"CMEGlobex_EnergyAndMetals",
|
95
|
-
"CMEGlobex_Energy",
|
96
|
-
"CMEGlobex_CrudeAndRefined",
|
97
|
-
"CMEGlobex_NYHarbor",
|
98
|
-
"CMEGlobex_HO",
|
99
|
-
"HO",
|
100
|
-
"CMEGlobex_Crude",
|
101
|
-
"CMEGlobex_CL",
|
102
|
-
"CL",
|
103
|
-
"CMEGlobex_Gas",
|
104
|
-
"CMEGlobex_RB",
|
105
|
-
"RB",
|
106
|
-
"CMEGlobex_MicroCrude",
|
107
|
-
"CMEGlobex_MCL",
|
108
|
-
"MCL",
|
109
|
-
"CMEGlobex_NatGas",
|
110
|
-
"CMEGlobex_NG",
|
111
|
-
"NG",
|
112
|
-
"CMEGlobex_Dutch_NatGas",
|
113
|
-
"CMEGlobex_TTF",
|
114
|
-
"TTF",
|
115
|
-
"CMEGlobex_LastDay_NatGas",
|
116
|
-
"CMEGlobex_NN",
|
117
|
-
"NN",
|
118
|
-
"CMEGlobex_CarbonOffset",
|
119
|
-
"CMEGlobex_CGO",
|
120
|
-
"CGO",
|
121
|
-
"C-GEO",
|
122
|
-
"CMEGlobex_NGO",
|
123
|
-
"NGO",
|
124
|
-
"CMEGlobex_GEO",
|
125
|
-
"GEO",
|
126
|
-
"CMEGlobex_Metals",
|
127
|
-
"CMEGlobex_PreciousMetals",
|
128
|
-
"CMEGlobex_Gold",
|
129
|
-
"CMEGlobex_GC",
|
130
|
-
"GC",
|
131
|
-
"CMEGlobex_Silver",
|
132
|
-
"CMEGlobex_SI",
|
133
|
-
"SI",
|
134
|
-
"CMEGlobex_Platinum",
|
135
|
-
"CMEGlobex_PL",
|
136
|
-
"PL",
|
137
|
-
"CMEGlobex_BaseMetals",
|
138
|
-
"CMEGlobex_Copper",
|
139
|
-
"CMEGlobex_HG",
|
140
|
-
"HG",
|
141
|
-
"CMEGlobex_Aluminum",
|
142
|
-
"CMEGlobex_ALI",
|
143
|
-
"ALI",
|
144
|
-
"CMEGlobex_Copper",
|
145
|
-
"CMEGlobex_QC",
|
146
|
-
"QC",
|
147
|
-
"CMEGlobex_FerrousMetals",
|
148
|
-
"CMEGlobex_HRC",
|
149
|
-
"HRC",
|
150
|
-
"CMEGlobex_BUS",
|
151
|
-
"BUS",
|
152
|
-
"CMEGlobex_TIO",
|
153
|
-
"TIO",
|
154
|
-
]
|
155
|
-
|
156
|
-
regular_market_times = {
|
157
|
-
"market_open": ((None, time(17), -1),), # Sunday offset. Central Timezone (CT)
|
158
|
-
"market_close": ((None, time(16)),),
|
159
|
-
}
|
160
|
-
|
161
|
-
@property
|
162
|
-
def name(self):
|
163
|
-
return "CMEGlobex_EnergyAndMetals"
|
164
|
-
|
165
|
-
@property
|
166
|
-
def regular_holidays(self):
|
167
|
-
return AbstractHolidayCalendar(
|
168
|
-
rules=[
|
169
|
-
USNewYearsDay,
|
170
|
-
GoodFriday,
|
171
|
-
ChristmasCME,
|
172
|
-
]
|
173
|
-
)
|
174
|
-
|
175
|
-
# @property
|
176
|
-
# def adhoc_holidays(self):
|
177
|
-
# return USNationalDaysofMourning
|
178
|
-
|
179
|
-
@property
|
180
|
-
def special_closes(self):
|
181
|
-
return [
|
182
|
-
(
|
183
|
-
time(12, tzinfo=timezone("America/Chicago")),
|
184
|
-
AbstractHolidayCalendar(
|
185
|
-
rules=[
|
186
|
-
USMartinLutherKingJrPre2022,
|
187
|
-
USPresidentsDayPre2022,
|
188
|
-
USMemorialDayPre2022,
|
189
|
-
USIndependenceDayPre2022,
|
190
|
-
USLaborDay,
|
191
|
-
USThanksgivingDayPre2022,
|
192
|
-
]
|
193
|
-
),
|
194
|
-
),
|
195
|
-
(
|
196
|
-
time(12, 45, tzinfo=timezone("America/Chicago")),
|
197
|
-
AbstractHolidayCalendar(
|
198
|
-
rules=[
|
199
|
-
FridayAfterThanksgiving,
|
200
|
-
]
|
201
|
-
),
|
202
|
-
),
|
203
|
-
(
|
204
|
-
time(13, 30, tzinfo=timezone("America/Chicago")),
|
205
|
-
AbstractHolidayCalendar(
|
206
|
-
rules=[
|
207
|
-
USMartinLutherKingJrFrom2022,
|
208
|
-
USPresidentsDayFrom2022,
|
209
|
-
USMemorialDayFrom2022,
|
210
|
-
USJuneteenthFrom2022,
|
211
|
-
USIndependenceDayFrom2022,
|
212
|
-
USThanksgivingDayFrom2022,
|
213
|
-
]
|
214
|
-
),
|
215
|
-
),
|
216
|
-
]
|
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
|
+
|
18
|
+
from pandas.tseries.holiday import (
|
19
|
+
AbstractHolidayCalendar,
|
20
|
+
) # , GoodFriday, USLaborDay, USPresidentsDay, USThanksgivingDay
|
21
|
+
from pytz import timezone
|
22
|
+
|
23
|
+
from pandas_market_calendars.holidays.cme_globex import (
|
24
|
+
USMartinLutherKingJrFrom2022,
|
25
|
+
USMartinLutherKingJrPre2022,
|
26
|
+
USNewYearsDay,
|
27
|
+
USPresidentsDayFrom2022,
|
28
|
+
USPresidentsDayPre2022,
|
29
|
+
GoodFriday,
|
30
|
+
USMemorialDayFrom2022,
|
31
|
+
USMemorialDayPre2022,
|
32
|
+
USJuneteenthFrom2022,
|
33
|
+
USIndependenceDayFrom2022,
|
34
|
+
USIndependenceDayPre2022,
|
35
|
+
USLaborDay,
|
36
|
+
USThanksgivingDayFrom2022,
|
37
|
+
USThanksgivingDayPre2022,
|
38
|
+
FridayAfterThanksgiving,
|
39
|
+
ChristmasCME,
|
40
|
+
)
|
41
|
+
from .cme_globex_base import CMEGlobexBaseExchangeCalendar
|
42
|
+
|
43
|
+
|
44
|
+
# from .holidays_us import (Christmas, ChristmasEveBefore1993, ChristmasEveInOrAfter1993, USBlackFridayInOrAfter1993,
|
45
|
+
# USIndependenceDay, USMartinLutherKingJrAfter1998, USMemorialDay, USJuneteenthAfter2022,
|
46
|
+
# USNationalDaysofMourning, USNewYearsDay)
|
47
|
+
|
48
|
+
|
49
|
+
class CMEGlobexEnergyAndMetalsExchangeCalendar(CMEGlobexBaseExchangeCalendar):
|
50
|
+
"""
|
51
|
+
Exchange calendar for CME for Energy and Metals products
|
52
|
+
|
53
|
+
Both follow the same trading/holiday schedule
|
54
|
+
|
55
|
+
NOT IMPLEMENTED: Dubai Mercantile Exchange (DME) follows this schedule but with holiday exceptions.
|
56
|
+
|
57
|
+
Energy Products:
|
58
|
+
Crude and Refined: https://www.cmegroup.com/trading/energy/crude-and-refined-products.html
|
59
|
+
- HO NY Harbor ULSD Futures
|
60
|
+
- CL Crude Oil Futures
|
61
|
+
- RB RBOB Gasoline Futures
|
62
|
+
- MCL Micro WTI Crude Oil Futures
|
63
|
+
Natural Gas
|
64
|
+
- NG Henry Hub Natural Gas Futures
|
65
|
+
- TTF Dutch TTF Natural Gas Calendar Month Futures
|
66
|
+
- NN Henry Hub Natural Gas Last Day Financial Futures
|
67
|
+
Voluntary Carbon Emissions Offset Futures
|
68
|
+
- CGO CBL Core Global Emmissions Offset (C-GEO) Futures
|
69
|
+
- NGO CBL Nature-based Global Emissionns Offset Futures
|
70
|
+
- GEO CBL Global Emissions Offset Futures
|
71
|
+
|
72
|
+
Metals Products: https://www.cmegroup.com/markets/metals.html
|
73
|
+
Precious Metals
|
74
|
+
- GC Gold Futures
|
75
|
+
- SI Silver Futures
|
76
|
+
- PL Platinum Futures
|
77
|
+
Base Metals
|
78
|
+
- HG Copper Futures
|
79
|
+
- ALI Aluminum Futures
|
80
|
+
- QC E-mini Copper Futures
|
81
|
+
Ferrous Metals
|
82
|
+
- HRC U.S. Midwest Domestic Hot-Rolled Coil Steel (CRU) Index Futures
|
83
|
+
- BUS U.S. Midwest Busheling Ferrous Scrap (AMM) Futures
|
84
|
+
- TIO Iron Ore 62% Fe, CFR China (Platts) Futures
|
85
|
+
|
86
|
+
Sample GLOBEX Trading Times
|
87
|
+
https://www.cmegroup.com/markets/energy/crude-oil/light-sweet-crude.contractSpecs.html
|
88
|
+
Sunday - Friday: 5:00pm - 4:00 pm CT
|
89
|
+
|
90
|
+
Calendar: http://www.cmegroup.com/tools-information/holiday-calendar.html
|
91
|
+
"""
|
92
|
+
|
93
|
+
aliases = [
|
94
|
+
"CMEGlobex_EnergyAndMetals",
|
95
|
+
"CMEGlobex_Energy",
|
96
|
+
"CMEGlobex_CrudeAndRefined",
|
97
|
+
"CMEGlobex_NYHarbor",
|
98
|
+
"CMEGlobex_HO",
|
99
|
+
"HO",
|
100
|
+
"CMEGlobex_Crude",
|
101
|
+
"CMEGlobex_CL",
|
102
|
+
"CL",
|
103
|
+
"CMEGlobex_Gas",
|
104
|
+
"CMEGlobex_RB",
|
105
|
+
"RB",
|
106
|
+
"CMEGlobex_MicroCrude",
|
107
|
+
"CMEGlobex_MCL",
|
108
|
+
"MCL",
|
109
|
+
"CMEGlobex_NatGas",
|
110
|
+
"CMEGlobex_NG",
|
111
|
+
"NG",
|
112
|
+
"CMEGlobex_Dutch_NatGas",
|
113
|
+
"CMEGlobex_TTF",
|
114
|
+
"TTF",
|
115
|
+
"CMEGlobex_LastDay_NatGas",
|
116
|
+
"CMEGlobex_NN",
|
117
|
+
"NN",
|
118
|
+
"CMEGlobex_CarbonOffset",
|
119
|
+
"CMEGlobex_CGO",
|
120
|
+
"CGO",
|
121
|
+
"C-GEO",
|
122
|
+
"CMEGlobex_NGO",
|
123
|
+
"NGO",
|
124
|
+
"CMEGlobex_GEO",
|
125
|
+
"GEO",
|
126
|
+
"CMEGlobex_Metals",
|
127
|
+
"CMEGlobex_PreciousMetals",
|
128
|
+
"CMEGlobex_Gold",
|
129
|
+
"CMEGlobex_GC",
|
130
|
+
"GC",
|
131
|
+
"CMEGlobex_Silver",
|
132
|
+
"CMEGlobex_SI",
|
133
|
+
"SI",
|
134
|
+
"CMEGlobex_Platinum",
|
135
|
+
"CMEGlobex_PL",
|
136
|
+
"PL",
|
137
|
+
"CMEGlobex_BaseMetals",
|
138
|
+
"CMEGlobex_Copper",
|
139
|
+
"CMEGlobex_HG",
|
140
|
+
"HG",
|
141
|
+
"CMEGlobex_Aluminum",
|
142
|
+
"CMEGlobex_ALI",
|
143
|
+
"ALI",
|
144
|
+
"CMEGlobex_Copper",
|
145
|
+
"CMEGlobex_QC",
|
146
|
+
"QC",
|
147
|
+
"CMEGlobex_FerrousMetals",
|
148
|
+
"CMEGlobex_HRC",
|
149
|
+
"HRC",
|
150
|
+
"CMEGlobex_BUS",
|
151
|
+
"BUS",
|
152
|
+
"CMEGlobex_TIO",
|
153
|
+
"TIO",
|
154
|
+
]
|
155
|
+
|
156
|
+
regular_market_times = {
|
157
|
+
"market_open": ((None, time(17), -1),), # Sunday offset. Central Timezone (CT)
|
158
|
+
"market_close": ((None, time(16)),),
|
159
|
+
}
|
160
|
+
|
161
|
+
@property
|
162
|
+
def name(self):
|
163
|
+
return "CMEGlobex_EnergyAndMetals"
|
164
|
+
|
165
|
+
@property
|
166
|
+
def regular_holidays(self):
|
167
|
+
return AbstractHolidayCalendar(
|
168
|
+
rules=[
|
169
|
+
USNewYearsDay,
|
170
|
+
GoodFriday,
|
171
|
+
ChristmasCME,
|
172
|
+
]
|
173
|
+
)
|
174
|
+
|
175
|
+
# @property
|
176
|
+
# def adhoc_holidays(self):
|
177
|
+
# return USNationalDaysofMourning
|
178
|
+
|
179
|
+
@property
|
180
|
+
def special_closes(self):
|
181
|
+
return [
|
182
|
+
(
|
183
|
+
time(12, tzinfo=timezone("America/Chicago")),
|
184
|
+
AbstractHolidayCalendar(
|
185
|
+
rules=[
|
186
|
+
USMartinLutherKingJrPre2022,
|
187
|
+
USPresidentsDayPre2022,
|
188
|
+
USMemorialDayPre2022,
|
189
|
+
USIndependenceDayPre2022,
|
190
|
+
USLaborDay,
|
191
|
+
USThanksgivingDayPre2022,
|
192
|
+
]
|
193
|
+
),
|
194
|
+
),
|
195
|
+
(
|
196
|
+
time(12, 45, tzinfo=timezone("America/Chicago")),
|
197
|
+
AbstractHolidayCalendar(
|
198
|
+
rules=[
|
199
|
+
FridayAfterThanksgiving,
|
200
|
+
]
|
201
|
+
),
|
202
|
+
),
|
203
|
+
(
|
204
|
+
time(13, 30, tzinfo=timezone("America/Chicago")),
|
205
|
+
AbstractHolidayCalendar(
|
206
|
+
rules=[
|
207
|
+
USMartinLutherKingJrFrom2022,
|
208
|
+
USPresidentsDayFrom2022,
|
209
|
+
USMemorialDayFrom2022,
|
210
|
+
USJuneteenthFrom2022,
|
211
|
+
USIndependenceDayFrom2022,
|
212
|
+
USThanksgivingDayFrom2022,
|
213
|
+
]
|
214
|
+
),
|
215
|
+
),
|
216
|
+
]
|
@@ -1,123 +1,123 @@
|
|
1
|
-
from datetime import time
|
2
|
-
|
3
|
-
from pandas.tseries.holiday import AbstractHolidayCalendar
|
4
|
-
from pytz import timezone
|
5
|
-
|
6
|
-
from pandas_market_calendars.holidays.cme import (
|
7
|
-
USMartinLutherKingJrAfter1998Before2015,
|
8
|
-
USMartinLutherKingJrAfter2015,
|
9
|
-
USPresidentsDayBefore2015,
|
10
|
-
USPresidentsDayAfter2015,
|
11
|
-
GoodFridayBefore2021NotEarlyClose,
|
12
|
-
GoodFriday2010,
|
13
|
-
GoodFriday2012,
|
14
|
-
GoodFriday2015,
|
15
|
-
GoodFriday2021,
|
16
|
-
GoodFriday2022,
|
17
|
-
GoodFridayAfter2022,
|
18
|
-
USMemorialDay2013AndPrior,
|
19
|
-
USMemorialDayAfter2013,
|
20
|
-
USIndependenceDayBefore2022PreviousDay,
|
21
|
-
USIndependenceDayBefore2014,
|
22
|
-
USIndependenceDayAfter2014,
|
23
|
-
USLaborDayStarting1887Before2014,
|
24
|
-
USLaborDayStarting1887After2014,
|
25
|
-
USThanksgivingBefore2014,
|
26
|
-
USThanksgivingAfter2014,
|
27
|
-
USThanksgivingFriday,
|
28
|
-
)
|
29
|
-
from pandas_market_calendars.holidays.us import (
|
30
|
-
USNewYearsDay,
|
31
|
-
ChristmasEveInOrAfter1993,
|
32
|
-
Christmas,
|
33
|
-
USJuneteenthAfter2022,
|
34
|
-
)
|
35
|
-
from .cme_globex_base import CMEGlobexBaseExchangeCalendar
|
36
|
-
|
37
|
-
|
38
|
-
class CMEGlobexEquitiesExchangeCalendar(CMEGlobexBaseExchangeCalendar):
|
39
|
-
aliases = ["CME Globex Equity"]
|
40
|
-
|
41
|
-
regular_market_times = {
|
42
|
-
"market_open": ((None, time(17), -1),), # offset by -1 day
|
43
|
-
"market_close": ((None, time(16)),),
|
44
|
-
}
|
45
|
-
|
46
|
-
@property
|
47
|
-
def tz(self):
|
48
|
-
return timezone("America/Chicago")
|
49
|
-
|
50
|
-
@property
|
51
|
-
def name(self):
|
52
|
-
"""
|
53
|
-
Name of the market
|
54
|
-
|
55
|
-
:return: string name
|
56
|
-
"""
|
57
|
-
return "CME Globex Equities"
|
58
|
-
|
59
|
-
@property
|
60
|
-
def regular_holidays(self):
|
61
|
-
return AbstractHolidayCalendar(
|
62
|
-
rules=[
|
63
|
-
USNewYearsDay,
|
64
|
-
GoodFridayBefore2021NotEarlyClose,
|
65
|
-
GoodFriday2022,
|
66
|
-
Christmas,
|
67
|
-
]
|
68
|
-
)
|
69
|
-
|
70
|
-
@property
|
71
|
-
def special_closes(self):
|
72
|
-
# Source https://www.cmegroup.com/tools-information/holiday-calendar.html
|
73
|
-
return [
|
74
|
-
(
|
75
|
-
time(10, 30),
|
76
|
-
AbstractHolidayCalendar(
|
77
|
-
rules=[
|
78
|
-
USMartinLutherKingJrAfter1998Before2015,
|
79
|
-
USPresidentsDayBefore2015,
|
80
|
-
USMemorialDay2013AndPrior,
|
81
|
-
USIndependenceDayBefore2014,
|
82
|
-
USLaborDayStarting1887Before2014,
|
83
|
-
USThanksgivingBefore2014,
|
84
|
-
]
|
85
|
-
),
|
86
|
-
),
|
87
|
-
(
|
88
|
-
time(12, 15),
|
89
|
-
AbstractHolidayCalendar(
|
90
|
-
rules=[
|
91
|
-
USIndependenceDayBefore2022PreviousDay,
|
92
|
-
USThanksgivingFriday,
|
93
|
-
ChristmasEveInOrAfter1993,
|
94
|
-
]
|
95
|
-
),
|
96
|
-
),
|
97
|
-
(
|
98
|
-
time(12),
|
99
|
-
AbstractHolidayCalendar(
|
100
|
-
rules=[
|
101
|
-
USMartinLutherKingJrAfter2015,
|
102
|
-
USPresidentsDayAfter2015,
|
103
|
-
USMemorialDayAfter2013,
|
104
|
-
USIndependenceDayAfter2014,
|
105
|
-
USLaborDayStarting1887After2014,
|
106
|
-
USThanksgivingAfter2014,
|
107
|
-
USJuneteenthAfter2022,
|
108
|
-
]
|
109
|
-
),
|
110
|
-
),
|
111
|
-
(
|
112
|
-
time(8, 15),
|
113
|
-
AbstractHolidayCalendar(
|
114
|
-
rules=[
|
115
|
-
GoodFriday2010,
|
116
|
-
GoodFriday2012,
|
117
|
-
GoodFriday2015,
|
118
|
-
GoodFriday2021,
|
119
|
-
GoodFridayAfter2022,
|
120
|
-
]
|
121
|
-
),
|
122
|
-
),
|
123
|
-
]
|
1
|
+
from datetime import time
|
2
|
+
|
3
|
+
from pandas.tseries.holiday import AbstractHolidayCalendar
|
4
|
+
from pytz import timezone
|
5
|
+
|
6
|
+
from pandas_market_calendars.holidays.cme import (
|
7
|
+
USMartinLutherKingJrAfter1998Before2015,
|
8
|
+
USMartinLutherKingJrAfter2015,
|
9
|
+
USPresidentsDayBefore2015,
|
10
|
+
USPresidentsDayAfter2015,
|
11
|
+
GoodFridayBefore2021NotEarlyClose,
|
12
|
+
GoodFriday2010,
|
13
|
+
GoodFriday2012,
|
14
|
+
GoodFriday2015,
|
15
|
+
GoodFriday2021,
|
16
|
+
GoodFriday2022,
|
17
|
+
GoodFridayAfter2022,
|
18
|
+
USMemorialDay2013AndPrior,
|
19
|
+
USMemorialDayAfter2013,
|
20
|
+
USIndependenceDayBefore2022PreviousDay,
|
21
|
+
USIndependenceDayBefore2014,
|
22
|
+
USIndependenceDayAfter2014,
|
23
|
+
USLaborDayStarting1887Before2014,
|
24
|
+
USLaborDayStarting1887After2014,
|
25
|
+
USThanksgivingBefore2014,
|
26
|
+
USThanksgivingAfter2014,
|
27
|
+
USThanksgivingFriday,
|
28
|
+
)
|
29
|
+
from pandas_market_calendars.holidays.us import (
|
30
|
+
USNewYearsDay,
|
31
|
+
ChristmasEveInOrAfter1993,
|
32
|
+
Christmas,
|
33
|
+
USJuneteenthAfter2022,
|
34
|
+
)
|
35
|
+
from .cme_globex_base import CMEGlobexBaseExchangeCalendar
|
36
|
+
|
37
|
+
|
38
|
+
class CMEGlobexEquitiesExchangeCalendar(CMEGlobexBaseExchangeCalendar):
|
39
|
+
aliases = ["CME Globex Equity"]
|
40
|
+
|
41
|
+
regular_market_times = {
|
42
|
+
"market_open": ((None, time(17), -1),), # offset by -1 day
|
43
|
+
"market_close": ((None, time(16)),),
|
44
|
+
}
|
45
|
+
|
46
|
+
@property
|
47
|
+
def tz(self):
|
48
|
+
return timezone("America/Chicago")
|
49
|
+
|
50
|
+
@property
|
51
|
+
def name(self):
|
52
|
+
"""
|
53
|
+
Name of the market
|
54
|
+
|
55
|
+
:return: string name
|
56
|
+
"""
|
57
|
+
return "CME Globex Equities"
|
58
|
+
|
59
|
+
@property
|
60
|
+
def regular_holidays(self):
|
61
|
+
return AbstractHolidayCalendar(
|
62
|
+
rules=[
|
63
|
+
USNewYearsDay,
|
64
|
+
GoodFridayBefore2021NotEarlyClose,
|
65
|
+
GoodFriday2022,
|
66
|
+
Christmas,
|
67
|
+
]
|
68
|
+
)
|
69
|
+
|
70
|
+
@property
|
71
|
+
def special_closes(self):
|
72
|
+
# Source https://www.cmegroup.com/tools-information/holiday-calendar.html
|
73
|
+
return [
|
74
|
+
(
|
75
|
+
time(10, 30),
|
76
|
+
AbstractHolidayCalendar(
|
77
|
+
rules=[
|
78
|
+
USMartinLutherKingJrAfter1998Before2015,
|
79
|
+
USPresidentsDayBefore2015,
|
80
|
+
USMemorialDay2013AndPrior,
|
81
|
+
USIndependenceDayBefore2014,
|
82
|
+
USLaborDayStarting1887Before2014,
|
83
|
+
USThanksgivingBefore2014,
|
84
|
+
]
|
85
|
+
),
|
86
|
+
),
|
87
|
+
(
|
88
|
+
time(12, 15),
|
89
|
+
AbstractHolidayCalendar(
|
90
|
+
rules=[
|
91
|
+
USIndependenceDayBefore2022PreviousDay,
|
92
|
+
USThanksgivingFriday,
|
93
|
+
ChristmasEveInOrAfter1993,
|
94
|
+
]
|
95
|
+
),
|
96
|
+
),
|
97
|
+
(
|
98
|
+
time(12),
|
99
|
+
AbstractHolidayCalendar(
|
100
|
+
rules=[
|
101
|
+
USMartinLutherKingJrAfter2015,
|
102
|
+
USPresidentsDayAfter2015,
|
103
|
+
USMemorialDayAfter2013,
|
104
|
+
USIndependenceDayAfter2014,
|
105
|
+
USLaborDayStarting1887After2014,
|
106
|
+
USThanksgivingAfter2014,
|
107
|
+
USJuneteenthAfter2022,
|
108
|
+
]
|
109
|
+
),
|
110
|
+
),
|
111
|
+
(
|
112
|
+
time(8, 15),
|
113
|
+
AbstractHolidayCalendar(
|
114
|
+
rules=[
|
115
|
+
GoodFriday2010,
|
116
|
+
GoodFriday2012,
|
117
|
+
GoodFriday2015,
|
118
|
+
GoodFriday2021,
|
119
|
+
GoodFridayAfter2022,
|
120
|
+
]
|
121
|
+
),
|
122
|
+
),
|
123
|
+
]
|