pandas-market-calendars 4.3.0__py3-none-any.whl → 4.3.1__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- pandas_market_calendars/calendars/__init__.py +0 -0
- pandas_market_calendars/calendars/asx.py +63 -0
- pandas_market_calendars/calendars/bmf.py +227 -0
- pandas_market_calendars/calendars/bse.py +409 -0
- pandas_market_calendars/calendars/cboe.py +115 -0
- pandas_market_calendars/calendars/cme.py +240 -0
- pandas_market_calendars/calendars/cme_globex_agriculture.py +103 -0
- pandas_market_calendars/calendars/cme_globex_base.py +103 -0
- pandas_market_calendars/calendars/cme_globex_crypto.py +147 -0
- pandas_market_calendars/calendars/cme_globex_energy_and_metals.py +138 -0
- pandas_market_calendars/calendars/cme_globex_equities.py +104 -0
- pandas_market_calendars/calendars/cme_globex_fixed_income.py +113 -0
- pandas_market_calendars/calendars/cme_globex_fx.py +78 -0
- pandas_market_calendars/calendars/eurex.py +119 -0
- pandas_market_calendars/calendars/hkex.py +408 -0
- pandas_market_calendars/calendars/ice.py +65 -0
- pandas_market_calendars/calendars/iex.py +98 -0
- pandas_market_calendars/calendars/jpx.py +103 -0
- pandas_market_calendars/calendars/lse.py +91 -0
- pandas_market_calendars/calendars/mirror.py +114 -0
- pandas_market_calendars/calendars/nyse.py +1127 -0
- pandas_market_calendars/calendars/ose.py +150 -0
- pandas_market_calendars/calendars/sifma.py +297 -0
- pandas_market_calendars/calendars/six.py +114 -0
- pandas_market_calendars/calendars/sse.py +290 -0
- pandas_market_calendars/calendars/tase.py +195 -0
- pandas_market_calendars/calendars/tsx.py +159 -0
- pandas_market_calendars/holidays/__init__.py +0 -0
- pandas_market_calendars/holidays/cme.py +340 -0
- pandas_market_calendars/holidays/cme_globex.py +198 -0
- pandas_market_calendars/holidays/cn.py +1436 -0
- pandas_market_calendars/holidays/jp.py +396 -0
- pandas_market_calendars/holidays/jpx_equinox.py +147 -0
- pandas_market_calendars/holidays/nyse.py +1472 -0
- pandas_market_calendars/holidays/oz.py +65 -0
- pandas_market_calendars/holidays/sifma.py +321 -0
- pandas_market_calendars/holidays/uk.py +180 -0
- pandas_market_calendars/holidays/us.py +360 -0
- {pandas_market_calendars-4.3.0.dist-info → pandas_market_calendars-4.3.1.dist-info}/METADATA +1 -1
- pandas_market_calendars-4.3.1.dist-info/RECORD +49 -0
- pandas_market_calendars-4.3.0.dist-info/RECORD +0 -11
- {pandas_market_calendars-4.3.0.dist-info → pandas_market_calendars-4.3.1.dist-info}/LICENSE +0 -0
- {pandas_market_calendars-4.3.0.dist-info → pandas_market_calendars-4.3.1.dist-info}/NOTICE +0 -0
- {pandas_market_calendars-4.3.0.dist-info → pandas_market_calendars-4.3.1.dist-info}/WHEEL +0 -0
- {pandas_market_calendars-4.3.0.dist-info → pandas_market_calendars-4.3.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,138 @@
|
|
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 .cme_globex_base import CMEGlobexBaseExchangeCalendar
|
17
|
+
|
18
|
+
from datetime import time
|
19
|
+
|
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, USJuneteenthAfter2022,
|
25
|
+
# USNationalDaysofMourning, USNewYearsDay)
|
26
|
+
|
27
|
+
from pandas_market_calendars.holidays.cme_globex import (USMartinLutherKingJrFrom2022, USMartinLutherKingJrPre2022, USNewYearsDay,
|
28
|
+
USPresidentsDayFrom2022, USPresidentsDayPre2022,
|
29
|
+
GoodFriday,
|
30
|
+
USMemorialDayFrom2022, USMemorialDayPre2022,
|
31
|
+
USJuneteenthFrom2022,
|
32
|
+
USIndependenceDayFrom2022, USIndependenceDayPre2022,
|
33
|
+
USLaborDay,
|
34
|
+
USThanksgivingDayFrom2022, USThanksgivingDayPre2022, FridayAfterThanksgiving,
|
35
|
+
ChristmasCME)
|
36
|
+
|
37
|
+
|
38
|
+
class CMEGlobexEnergyAndMetalsExchangeCalendar(CMEGlobexBaseExchangeCalendar):
|
39
|
+
"""
|
40
|
+
Exchange calendar for CME for Energy and Metals products
|
41
|
+
|
42
|
+
Both follow the same trading/holiday schedule
|
43
|
+
|
44
|
+
NOT IMPLEMENTED: Dubai Mercantile Exchange (DME) follows this schedule but with holiday exceptions.
|
45
|
+
|
46
|
+
Energy Products:
|
47
|
+
Crude and Refined: https://www.cmegroup.com/trading/energy/crude-and-refined-products.html
|
48
|
+
- HO NY Harbor ULSD Futures
|
49
|
+
- CL Crude Oil Futures
|
50
|
+
- RB RBOB Gasoline Futures
|
51
|
+
- MCL Micro WTI Crude Oil Futures
|
52
|
+
Natural Gas
|
53
|
+
- NG Henry Hub Natural Gas Futures
|
54
|
+
- TTF Dutch TTF Natural Gas Calendar Month Futures
|
55
|
+
- NN Henry Hub Natural Gas Last Day Financial Futures
|
56
|
+
Voluntary Carbon Emissions Offset Futures
|
57
|
+
- CGO CBL Core Global Emmissions Offset (C-GEO) Futures
|
58
|
+
- NGO CBL Nature-based Global Emissionns Offset Futures
|
59
|
+
- GEO CBL Global Emissions Offset Futures
|
60
|
+
|
61
|
+
Metals Products: https://www.cmegroup.com/markets/metals.html
|
62
|
+
Precious Metals
|
63
|
+
- GC Gold Futures
|
64
|
+
- SI Silver Futures
|
65
|
+
- PL Platinum Futures
|
66
|
+
Base Metals
|
67
|
+
- HG Copper Futures
|
68
|
+
- ALI Aluminum Futures
|
69
|
+
- QC E-mini Copper Futures
|
70
|
+
Ferrous Metals
|
71
|
+
- HRC U.S. Midwest Domestic Hot-Rolled Coil Steel (CRU) Index Futures
|
72
|
+
- BUS U.S. Midwest Busheling Ferrous Scrap (AMM) Futures
|
73
|
+
- TIO Iron Ore 62% Fe, CFR China (Platts) Futures
|
74
|
+
|
75
|
+
Sample GLOBEX Trading Times
|
76
|
+
https://www.cmegroup.com/markets/energy/crude-oil/light-sweet-crude.contractSpecs.html
|
77
|
+
Sunday - Friday: 5:00pm - 4:00 pm CT
|
78
|
+
|
79
|
+
Calendar: http://www.cmegroup.com/tools-information/holiday-calendar.html
|
80
|
+
"""
|
81
|
+
|
82
|
+
aliases = [ 'CMEGlobex_EnergyAndMetals',
|
83
|
+
'CMEGlobex_Energy',
|
84
|
+
'CMEGlobex_CrudeAndRefined', 'CMEGlobex_NYHarbor', 'CMEGlobex_HO', 'HO', 'CMEGlobex_Crude', 'CMEGlobex_CL', 'CL', 'CMEGlobex_Gas', 'CMEGlobex_RB', 'RB', 'CMEGlobex_MicroCrude', 'CMEGlobex_MCL', 'MCL',
|
85
|
+
'CMEGlobex_NatGas', 'CMEGlobex_NG', 'NG', 'CMEGlobex_Dutch_NatGas', 'CMEGlobex_TTF', 'TTF', 'CMEGlobex_LastDay_NatGas', 'CMEGlobex_NN', 'NN',
|
86
|
+
'CMEGlobex_CarbonOffset', 'CMEGlobex_CGO', 'CGO', 'C-GEO', 'CMEGlobex_NGO', 'NGO', 'CMEGlobex_GEO', 'GEO',
|
87
|
+
'CMEGlobex_Metals',
|
88
|
+
'CMEGlobex_PreciousMetals', 'CMEGlobex_Gold', 'CMEGlobex_GC', 'GC', 'CMEGlobex_Silver' 'CMEGlobex_SI', 'SI', 'CMEGlobex_Platinum', 'CMEGlobex_PL', 'PL',
|
89
|
+
'CMEGlobex_BaseMetals', 'CMEGlobex_Copper', 'CMEGlobex_HG', 'HG', 'CMEGlobex_Aluminum', 'CMEGlobex_ALI', 'ALI', 'CMEGlobex_Copper', 'CMEGlobex_QC', 'QC',
|
90
|
+
'CMEGlobex_FerrousMetals', 'CMEGlobex_HRC', 'HRC', 'CMEGlobex_BUS', 'BUS', 'CMEGlobex_TIO', 'TIO' ]
|
91
|
+
|
92
|
+
regular_market_times = {
|
93
|
+
"market_open": ((None, time(17), -1),), #Sunday offset. Central Timezone (CT)
|
94
|
+
"market_close": ((None, time(16)),)
|
95
|
+
}
|
96
|
+
|
97
|
+
@property
|
98
|
+
def name(self):
|
99
|
+
return "CMEGlobex_EnergyAndMetals"
|
100
|
+
|
101
|
+
|
102
|
+
@property
|
103
|
+
def regular_holidays(self):
|
104
|
+
return AbstractHolidayCalendar(rules=[
|
105
|
+
USNewYearsDay,
|
106
|
+
GoodFriday,
|
107
|
+
ChristmasCME,
|
108
|
+
])
|
109
|
+
|
110
|
+
# @property
|
111
|
+
# def adhoc_holidays(self):
|
112
|
+
# return USNationalDaysofMourning
|
113
|
+
|
114
|
+
@property
|
115
|
+
def special_closes(self):
|
116
|
+
return [
|
117
|
+
(time(12, tzinfo=timezone('America/Chicago')), AbstractHolidayCalendar(rules=[
|
118
|
+
USMartinLutherKingJrPre2022,
|
119
|
+
USPresidentsDayPre2022,
|
120
|
+
USMemorialDayPre2022,
|
121
|
+
USIndependenceDayPre2022,
|
122
|
+
USLaborDay,
|
123
|
+
USThanksgivingDayPre2022,
|
124
|
+
])),
|
125
|
+
(time(12, 45, tzinfo=timezone('America/Chicago')), AbstractHolidayCalendar(rules=[
|
126
|
+
FridayAfterThanksgiving,
|
127
|
+
])),
|
128
|
+
(time(13, 30, tzinfo=timezone('America/Chicago')), AbstractHolidayCalendar(rules=[
|
129
|
+
USMartinLutherKingJrFrom2022,
|
130
|
+
USPresidentsDayFrom2022,
|
131
|
+
USMemorialDayFrom2022,
|
132
|
+
USJuneteenthFrom2022,
|
133
|
+
USIndependenceDayFrom2022,
|
134
|
+
USThanksgivingDayFrom2022,
|
135
|
+
])),
|
136
|
+
]
|
137
|
+
|
138
|
+
|
@@ -0,0 +1,104 @@
|
|
1
|
+
from .cme_globex_base import CMEGlobexBaseExchangeCalendar
|
2
|
+
|
3
|
+
from datetime import time
|
4
|
+
from pandas.tseries.holiday import AbstractHolidayCalendar
|
5
|
+
from pytz import timezone
|
6
|
+
|
7
|
+
from pandas_market_calendars.holidays.cme import (
|
8
|
+
USMartinLutherKingJrAfter1998Before2015,
|
9
|
+
USMartinLutherKingJrAfter2015,
|
10
|
+
USPresidentsDayBefore2015,
|
11
|
+
USPresidentsDayAfter2015,
|
12
|
+
GoodFridayBefore2021NotEarlyClose,
|
13
|
+
GoodFridayAfter2021,
|
14
|
+
GoodFriday2010,
|
15
|
+
GoodFriday2012,
|
16
|
+
GoodFriday2015,
|
17
|
+
GoodFriday2021,
|
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
|
+
|
36
|
+
class CMEGlobexEquitiesExchangeCalendar(CMEGlobexBaseExchangeCalendar):
|
37
|
+
|
38
|
+
aliases = ["CME Globex Equity"]
|
39
|
+
|
40
|
+
regular_market_times = {
|
41
|
+
"market_open": ((None, time(17), -1),), # offset by -1 day
|
42
|
+
"market_close": ((None, time(16)),),
|
43
|
+
}
|
44
|
+
|
45
|
+
@property
|
46
|
+
def tz(self): return timezone("America/Chicago")
|
47
|
+
|
48
|
+
@property
|
49
|
+
def name(self):
|
50
|
+
"""
|
51
|
+
Name of the market
|
52
|
+
|
53
|
+
:return: string name
|
54
|
+
"""
|
55
|
+
return "CME Globex Equities"
|
56
|
+
|
57
|
+
@property
|
58
|
+
def regular_holidays(self):
|
59
|
+
return AbstractHolidayCalendar(rules=[
|
60
|
+
USNewYearsDay,
|
61
|
+
GoodFridayBefore2021NotEarlyClose,
|
62
|
+
GoodFridayAfter2021,
|
63
|
+
Christmas,
|
64
|
+
])
|
65
|
+
|
66
|
+
@property
|
67
|
+
def special_closes(self):
|
68
|
+
# Source https://www.cmegroup.com/tools-information/holiday-calendar.html
|
69
|
+
return [
|
70
|
+
(time(10, 30), AbstractHolidayCalendar(rules=[
|
71
|
+
USMartinLutherKingJrAfter1998Before2015,
|
72
|
+
USPresidentsDayBefore2015,
|
73
|
+
USMemorialDay2013AndPrior,
|
74
|
+
USIndependenceDayBefore2014,
|
75
|
+
USLaborDayStarting1887Before2014,
|
76
|
+
USThanksgivingBefore2014,
|
77
|
+
])),
|
78
|
+
|
79
|
+
(time(12,15), AbstractHolidayCalendar(rules= [
|
80
|
+
USIndependenceDayBefore2022PreviousDay,
|
81
|
+
USThanksgivingFriday,
|
82
|
+
ChristmasEveInOrAfter1993,
|
83
|
+
])),
|
84
|
+
|
85
|
+
(time(12), AbstractHolidayCalendar(rules=[
|
86
|
+
USMartinLutherKingJrAfter2015,
|
87
|
+
USPresidentsDayAfter2015,
|
88
|
+
USMemorialDayAfter2013,
|
89
|
+
USIndependenceDayAfter2014,
|
90
|
+
USLaborDayStarting1887After2014,
|
91
|
+
USThanksgivingAfter2014,
|
92
|
+
USJuneteenthAfter2022
|
93
|
+
|
94
|
+
])),
|
95
|
+
(time(8,15), AbstractHolidayCalendar(rules=[
|
96
|
+
GoodFriday2010,
|
97
|
+
GoodFriday2012,
|
98
|
+
GoodFriday2015,
|
99
|
+
GoodFriday2021,
|
100
|
+
])),
|
101
|
+
|
102
|
+
]
|
103
|
+
|
104
|
+
|
@@ -0,0 +1,113 @@
|
|
1
|
+
from .cme_globex_base import CMEGlobexBaseExchangeCalendar
|
2
|
+
|
3
|
+
from datetime import time
|
4
|
+
from pandas.tseries.holiday import AbstractHolidayCalendar
|
5
|
+
|
6
|
+
from pandas_market_calendars.holidays.cme import (
|
7
|
+
USMartinLutherKingJrAfter1998Before2015,
|
8
|
+
USMartinLutherKingJrAfter1998Before2016FridayBefore,
|
9
|
+
USMartinLutherKingJrAfter2015,
|
10
|
+
USPresidentsDayBefore2016FridayBefore,
|
11
|
+
USPresidentsDayBefore2015,
|
12
|
+
USPresidentsDayAfter2015,
|
13
|
+
GoodFridayBefore2021NotEarlyClose,
|
14
|
+
GoodFridayAfter2021,
|
15
|
+
GoodFriday2009,
|
16
|
+
GoodFriday2010,
|
17
|
+
GoodFriday2012,
|
18
|
+
GoodFriday2015,
|
19
|
+
GoodFriday2021,
|
20
|
+
USMemorialDay2013AndPrior,
|
21
|
+
USMemorialDayAfter2013,
|
22
|
+
USMemorialDay2015AndPriorFridayBefore,
|
23
|
+
USIndependenceDayBefore2014,
|
24
|
+
USIndependenceDayAfter2014,
|
25
|
+
USLaborDayStarting1887Before2014,
|
26
|
+
USLaborDayStarting1887Before2015FridayBefore,
|
27
|
+
USLaborDayStarting1887After2014,
|
28
|
+
USThanksgivingBefore2014,
|
29
|
+
USThanksgivingAfter2014,
|
30
|
+
USThanksgivingFriday,
|
31
|
+
)
|
32
|
+
from pandas_market_calendars.holidays.us import (
|
33
|
+
USNewYearsDay,
|
34
|
+
ChristmasEveInOrAfter1993,
|
35
|
+
Christmas,
|
36
|
+
USJuneteenthAfter2022
|
37
|
+
)
|
38
|
+
|
39
|
+
|
40
|
+
class CMEGlobexFixedIncomeCalendar(CMEGlobexBaseExchangeCalendar):
|
41
|
+
aliases = ["CME Globex Fixed Income", "CME Globex Interest Rate Products"]
|
42
|
+
|
43
|
+
regular_market_times = {
|
44
|
+
"market_open": ((None, time(18), -1),),
|
45
|
+
"market_close": ((None, time(17)),),
|
46
|
+
}
|
47
|
+
|
48
|
+
"""
|
49
|
+
Not yet implemented:
|
50
|
+
Christmas/New_Years
|
51
|
+
5am special open for a couple years (see tests)
|
52
|
+
|
53
|
+
regular market_open/market_close changed from 17/16 to 18/17?
|
54
|
+
"""
|
55
|
+
|
56
|
+
@property
|
57
|
+
def name(self): return "CME Globex Fixed Income"
|
58
|
+
|
59
|
+
@property
|
60
|
+
def regular_holidays(self):
|
61
|
+
return AbstractHolidayCalendar(rules=[
|
62
|
+
USNewYearsDay,
|
63
|
+
GoodFridayBefore2021NotEarlyClose,
|
64
|
+
GoodFridayAfter2021,
|
65
|
+
Christmas,
|
66
|
+
])
|
67
|
+
|
68
|
+
@property
|
69
|
+
def special_closes_adhoc(self):
|
70
|
+
return [(time(15,15), ["2010-07-02", "2011-07-01"]),
|
71
|
+
(time(12,15), ["2010-12-31"])]
|
72
|
+
|
73
|
+
@property
|
74
|
+
def special_closes(self):
|
75
|
+
# Source https://www.cmegroup.com/tools-information/holiday-calendar.html
|
76
|
+
return [
|
77
|
+
(time(12), AbstractHolidayCalendar(rules=[
|
78
|
+
USMartinLutherKingJrAfter1998Before2015,
|
79
|
+
USMartinLutherKingJrAfter2015,
|
80
|
+
USPresidentsDayBefore2015,
|
81
|
+
USPresidentsDayAfter2015,
|
82
|
+
USMemorialDay2013AndPrior,
|
83
|
+
USMemorialDayAfter2013,
|
84
|
+
USIndependenceDayBefore2014,
|
85
|
+
USIndependenceDayAfter2014,
|
86
|
+
USLaborDayStarting1887Before2014,
|
87
|
+
USLaborDayStarting1887After2014,
|
88
|
+
USThanksgivingBefore2014,
|
89
|
+
USThanksgivingAfter2014,
|
90
|
+
USJuneteenthAfter2022,
|
91
|
+
])),
|
92
|
+
|
93
|
+
(time(15,15), AbstractHolidayCalendar(rules=[
|
94
|
+
USMartinLutherKingJrAfter1998Before2016FridayBefore,
|
95
|
+
USPresidentsDayBefore2016FridayBefore,
|
96
|
+
GoodFriday2009,
|
97
|
+
USMemorialDay2015AndPriorFridayBefore,
|
98
|
+
USLaborDayStarting1887Before2015FridayBefore
|
99
|
+
])),
|
100
|
+
|
101
|
+
(time(12,15), AbstractHolidayCalendar(rules= [
|
102
|
+
USThanksgivingFriday,
|
103
|
+
ChristmasEveInOrAfter1993,
|
104
|
+
])),
|
105
|
+
|
106
|
+
(time(10,15), AbstractHolidayCalendar(rules=[
|
107
|
+
GoodFriday2010,
|
108
|
+
GoodFriday2012,
|
109
|
+
GoodFriday2015,
|
110
|
+
GoodFriday2021,
|
111
|
+
])),
|
112
|
+
|
113
|
+
]
|
@@ -0,0 +1,78 @@
|
|
1
|
+
from datetime import time
|
2
|
+
|
3
|
+
from pandas.tseries.holiday import AbstractHolidayCalendar
|
4
|
+
|
5
|
+
from pandas_market_calendars.calendars.cme_globex_base import CMEGlobexBaseExchangeCalendar
|
6
|
+
from pandas_market_calendars.holidays.cme import (
|
7
|
+
USMartinLutherKingJrAfter1998Before2022,
|
8
|
+
USPresidentsDayBefore2022,
|
9
|
+
GoodFridayBefore2021,
|
10
|
+
GoodFriday2021,
|
11
|
+
GoodFridayAfter2021,
|
12
|
+
USMemorialDay2021AndPrior,
|
13
|
+
USIndependenceDayBefore2022,
|
14
|
+
USLaborDayStarting1887Before2022,
|
15
|
+
USThanksgivingBefore2022,
|
16
|
+
USThanksgivingFriday,
|
17
|
+
)
|
18
|
+
from pandas_market_calendars.holidays.us import (
|
19
|
+
USNewYearsDay,
|
20
|
+
ChristmasEveInOrAfter1993,
|
21
|
+
Christmas,
|
22
|
+
)
|
23
|
+
|
24
|
+
_1015 = time(10, 15)
|
25
|
+
_1200 = time(12, 0)
|
26
|
+
_1215 = time(12, 15)
|
27
|
+
|
28
|
+
|
29
|
+
class CMEGlobexFXExchangeCalendar(CMEGlobexBaseExchangeCalendar):
|
30
|
+
aliases = ['CME_Currency']
|
31
|
+
|
32
|
+
# Using CME Globex trading times eg AUD/USD, EUR/GBP, and BRL/USD
|
33
|
+
# https://www.cmegroup.com/markets/fx/g10/australian-dollar.contractSpecs.html
|
34
|
+
# https://www.cmegroup.com/markets/fx/cross-rates/euro-fx-british-pound.contractSpecs.html
|
35
|
+
# https://www.cmegroup.com/markets/fx/emerging-market/brazilian-real.contractSpecs.html
|
36
|
+
# CME "NZD spot" has its own holiday schedule; this is a niche product (via "FX Link") and is not handled in this
|
37
|
+
# class; however, its regular hours follow the same schedule (see
|
38
|
+
# https://www.cmegroup.com/trading/fx/files/fx-product-guide-2021-us.pdf)
|
39
|
+
regular_market_times = {
|
40
|
+
"market_open": ((None, time(17), -1),), # offset by -1 day
|
41
|
+
"market_close": ((None, time(16, 00)),)
|
42
|
+
}
|
43
|
+
|
44
|
+
aliases = ['CMEGlobex_FX', 'CME_FX', 'CME_Currency']
|
45
|
+
|
46
|
+
@property
|
47
|
+
def name(self):
|
48
|
+
return "CMEGlobex_FX"
|
49
|
+
|
50
|
+
@property
|
51
|
+
def regular_holidays(self):
|
52
|
+
return AbstractHolidayCalendar(rules=[
|
53
|
+
USNewYearsDay,
|
54
|
+
GoodFridayBefore2021,
|
55
|
+
GoodFridayAfter2021,
|
56
|
+
Christmas,
|
57
|
+
])
|
58
|
+
|
59
|
+
@property
|
60
|
+
def special_closes(self):
|
61
|
+
"""
|
62
|
+
Accurate 2020-2022 inclusive
|
63
|
+
TODO - enhance/verify prior to 2020
|
64
|
+
TODO - Add 2023+ once known
|
65
|
+
"""
|
66
|
+
# Source https://www.cmegroup.com/tools-information/holiday-calendar.html
|
67
|
+
return [
|
68
|
+
(_1015, AbstractHolidayCalendar(rules=[GoodFriday2021])),
|
69
|
+
(_1200, AbstractHolidayCalendar(rules=[
|
70
|
+
USMartinLutherKingJrAfter1998Before2022,
|
71
|
+
USPresidentsDayBefore2022,
|
72
|
+
USMemorialDay2021AndPrior,
|
73
|
+
USIndependenceDayBefore2022,
|
74
|
+
USLaborDayStarting1887Before2022,
|
75
|
+
USThanksgivingBefore2022,
|
76
|
+
])),
|
77
|
+
(_1215, AbstractHolidayCalendar(rules=[USThanksgivingFriday, ChristmasEveInOrAfter1993])),
|
78
|
+
]
|
@@ -0,0 +1,119 @@
|
|
1
|
+
#
|
2
|
+
# kewlfft
|
3
|
+
#
|
4
|
+
|
5
|
+
from datetime import time
|
6
|
+
|
7
|
+
from pandas.tseries.holiday import AbstractHolidayCalendar, EasterMonday, GoodFriday, Holiday, previous_friday
|
8
|
+
from pytz import timezone
|
9
|
+
|
10
|
+
from pandas_market_calendars.market_calendar import (FRIDAY, MONDAY, MarketCalendar, THURSDAY, TUESDAY, WEDNESDAY)
|
11
|
+
|
12
|
+
# New Year's Eve
|
13
|
+
EUREXNewYearsEve = Holiday(
|
14
|
+
"New Year's Eve",
|
15
|
+
month=12,
|
16
|
+
day=31,
|
17
|
+
observance=previous_friday,
|
18
|
+
)
|
19
|
+
# New Year's Day
|
20
|
+
EUREXNewYearsDay = Holiday(
|
21
|
+
"New Year's Day",
|
22
|
+
month=1,
|
23
|
+
day=1,
|
24
|
+
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
|
25
|
+
)
|
26
|
+
# Early May bank holiday
|
27
|
+
MayBank = Holiday(
|
28
|
+
"Early May Bank Holiday",
|
29
|
+
month=5,
|
30
|
+
day=1,
|
31
|
+
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
|
32
|
+
)
|
33
|
+
# German National Holiday (Tag der Deutschen Einheit)
|
34
|
+
GermanNationalDay = Holiday(
|
35
|
+
'Tag der Deutschen Einheit',
|
36
|
+
month=10,
|
37
|
+
day=3,
|
38
|
+
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
|
39
|
+
)
|
40
|
+
# Christmas Eve
|
41
|
+
ChristmasEve = Holiday(
|
42
|
+
'Christmas Eve',
|
43
|
+
month=12,
|
44
|
+
day=24,
|
45
|
+
observance=previous_friday,
|
46
|
+
)
|
47
|
+
# Christmas
|
48
|
+
Christmas = Holiday(
|
49
|
+
"Christmas",
|
50
|
+
month=12,
|
51
|
+
day=25,
|
52
|
+
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
|
53
|
+
)
|
54
|
+
# If christmas day is Saturday Monday 27th is a holiday
|
55
|
+
# If christmas day is sunday the Tuesday 27th is a holiday
|
56
|
+
WeekendChristmas = Holiday(
|
57
|
+
"Weekend Christmas",
|
58
|
+
month=12,
|
59
|
+
day=27,
|
60
|
+
days_of_week=(MONDAY, TUESDAY),
|
61
|
+
)
|
62
|
+
# Boxing day
|
63
|
+
BoxingDay = Holiday(
|
64
|
+
"Boxing Day",
|
65
|
+
month=12,
|
66
|
+
day=26,
|
67
|
+
)
|
68
|
+
# If boxing day is saturday then Monday 28th is a holiday
|
69
|
+
# If boxing day is sunday then Tuesday 28th is a holiday
|
70
|
+
WeekendBoxingDay = Holiday(
|
71
|
+
"Weekend Boxing Day",
|
72
|
+
month=12,
|
73
|
+
day=28,
|
74
|
+
days_of_week=(MONDAY, TUESDAY),
|
75
|
+
)
|
76
|
+
|
77
|
+
|
78
|
+
class EUREXExchangeCalendar(MarketCalendar):
|
79
|
+
"""
|
80
|
+
Exchange calendar for EUREX
|
81
|
+
|
82
|
+
"""
|
83
|
+
aliases = ['EUREX']
|
84
|
+
regular_market_times = {
|
85
|
+
"market_open": ((None, time(9)),),
|
86
|
+
"market_close": ((None, time(17,30)),)
|
87
|
+
}
|
88
|
+
|
89
|
+
@property
|
90
|
+
def name(self):
|
91
|
+
return "EUREX"
|
92
|
+
|
93
|
+
@property
|
94
|
+
def tz(self):
|
95
|
+
return timezone('Europe/Berlin')
|
96
|
+
|
97
|
+
@property
|
98
|
+
def regular_holidays(self):
|
99
|
+
return AbstractHolidayCalendar(rules=[
|
100
|
+
EUREXNewYearsDay,
|
101
|
+
GoodFriday,
|
102
|
+
EasterMonday,
|
103
|
+
MayBank,
|
104
|
+
GermanNationalDay,
|
105
|
+
Christmas,
|
106
|
+
WeekendChristmas,
|
107
|
+
BoxingDay,
|
108
|
+
WeekendBoxingDay
|
109
|
+
])
|
110
|
+
|
111
|
+
@property
|
112
|
+
def special_closes(self):
|
113
|
+
return [(
|
114
|
+
time(12, 30),
|
115
|
+
AbstractHolidayCalendar(rules=[
|
116
|
+
ChristmasEve,
|
117
|
+
EUREXNewYearsEve,
|
118
|
+
])
|
119
|
+
)]
|