pandas-market-calendars 4.1.3__py3-none-any.whl → 4.2.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-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,146 +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
|
-
import pandas as pd
|
23
|
-
from pandas import Timestamp
|
24
|
-
from pandas.tseries.holiday import AbstractHolidayCalendar #, GoodFriday, USLaborDay, USPresidentsDay, USThanksgivingDay
|
25
|
-
from pytz import timezone
|
26
|
-
|
27
|
-
#from .holidays_us import (Christmas, ChristmasEveBefore1993, ChristmasEveInOrAfter1993, USBlackFridayInOrAfter1993,
|
28
|
-
# USIndependenceDay, USMartinLutherKingJrAfter1998, USMemorialDay, USJuneteenthAfter2022,
|
29
|
-
# USNationalDaysofMourning, USNewYearsDay)
|
30
|
-
|
31
|
-
from .holidays_cme_globex import ( USNewYearsDay,
|
32
|
-
USMartinLutherKingJrFrom2022, USMartinLutherKingJrPre2022, USNewYearsDay,
|
33
|
-
USPresidentsDayFrom2022, USPresidentsDayPre2022,
|
34
|
-
GoodFriday,
|
35
|
-
USMemorialDayFrom2022, USMemorialDayPre2022,
|
36
|
-
USJuneteenthFrom2022,
|
37
|
-
USIndependenceDayFrom2022, USIndependenceDayPre2022,
|
38
|
-
USLaborDay,
|
39
|
-
USThanksgivingDayFrom2022, USThanksgivingDayPre2022, FridayAfterThanksgiving,
|
40
|
-
ChristmasCME)
|
41
|
-
from .market_calendar import MarketCalendar
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
class CMEGlobexEnergyAndMetalsExchangeCalendar(CMEGlobexBaseExchangeCalendar):
|
47
|
-
"""
|
48
|
-
Exchange calendar for CME for Energy and Metals products
|
49
|
-
|
50
|
-
Both follow the same trading/holiday schedule
|
51
|
-
|
52
|
-
NOT IMPLEMENTED: Dubai Mercantile Exchange (DME) follows this schedule but with holiday exceptions.
|
53
|
-
|
54
|
-
Energy Products:
|
55
|
-
Crude and Refined: https://www.cmegroup.com/trading/energy/crude-and-refined-products.html
|
56
|
-
- HO NY Harbor ULSD Futures
|
57
|
-
- CL Crude Oil Futures
|
58
|
-
- RB RBOB Gasoline Futures
|
59
|
-
- MCL Micro WTI Crude Oil Futures
|
60
|
-
Natural Gas
|
61
|
-
- NG Henry Hub Natural Gas Futures
|
62
|
-
- TTF Dutch TTF Natural Gas Calendar Month Futures
|
63
|
-
- NN Henry Hub Natural Gas Last Day Financial Futures
|
64
|
-
Voluntary Carbon Emissions Offset Futures
|
65
|
-
- CGO CBL Core Global Emmissions Offset (C-GEO) Futures
|
66
|
-
- NGO CBL Nature-based Global Emissionns Offset Futures
|
67
|
-
- GEO CBL Global Emissions Offset Futures
|
68
|
-
|
69
|
-
Metals Products: https://www.cmegroup.com/markets/metals.html
|
70
|
-
Precious Metals
|
71
|
-
- GC Gold Futures
|
72
|
-
- SI Silver Futures
|
73
|
-
- PL Platinum Futures
|
74
|
-
Base Metals
|
75
|
-
- HG Copper Futures
|
76
|
-
- ALI Aluminum Futures
|
77
|
-
- QC E-mini Copper Futures
|
78
|
-
Ferrous Metals
|
79
|
-
- HRC U.S. Midwest Domestic Hot-Rolled Coil Steel (CRU) Index Futures
|
80
|
-
- BUS U.S. Midwest Busheling Ferrous Scrap (AMM) Futures
|
81
|
-
- TIO Iron Ore 62% Fe, CFR China (Platts) Futures
|
82
|
-
|
83
|
-
Sample GLOBEX Trading Times
|
84
|
-
https://www.cmegroup.com/markets/energy/crude-oil/light-sweet-crude.contractSpecs.html
|
85
|
-
Sunday - Friday: 5:00pm - 4:00 pm CT
|
86
|
-
|
87
|
-
Calendar: http://www.cmegroup.com/tools-information/holiday-calendar.html
|
88
|
-
"""
|
89
|
-
|
90
|
-
aliases = [ 'CMEGlobex_EnergyAndMetals',
|
91
|
-
'CMEGlobex_Energy',
|
92
|
-
'CMEGlobex_CrudeAndRefined', 'CMEGlobex_NYHarbor', 'CMEGlobex_HO', 'HO', 'CMEGlobex_Crude', 'CMEGlobex_CL', 'CL', 'CMEGlobex_Gas', 'CMEGlobex_RB', 'RB', 'CMEGlobex_MicroCrude', 'CMEGlobex_MCL', 'MCL',
|
93
|
-
'CMEGlobex_NatGas', 'CMEGlobex_NG', 'NG', 'CMEGlobex_Dutch_NatGas', 'CMEGlobex_TTF', 'TTF', 'CMEGlobex_LastDay_NatGas', 'CMEGlobex_NN', 'NN',
|
94
|
-
'CMEGlobex_CarbonOffset', 'CMEGlobex_CGO', 'CGO', 'C-GEO', 'CMEGlobex_NGO', 'NGO', 'CMEGlobex_GEO', 'GEO',
|
95
|
-
'CMEGlobex_Metals',
|
96
|
-
'CMEGlobex_PreciousMetals', 'CMEGlobex_Gold', 'CMEGlobex_GC', 'GC', 'CMEGlobex_Silver' 'CMEGlobex_SI', 'SI', 'CMEGlobex_Platinum', 'CMEGlobex_PL', 'PL',
|
97
|
-
'CMEGlobex_BaseMetals', 'CMEGlobex_Copper', 'CMEGlobex_HG', 'HG', 'CMEGlobex_Aluminum', 'CMEGlobex_ALI', 'ALI', 'CMEGlobex_Copper', 'CMEGlobex_QC', 'QC',
|
98
|
-
'CMEGlobex_FerrousMetals', 'CMEGlobex_HRC', 'HRC', 'CMEGlobex_BUS', 'BUS', 'CMEGlobex_TIO', 'TIO' ]
|
99
|
-
|
100
|
-
regular_market_times = {
|
101
|
-
"market_open": ((None, time(17), -1),), #Sunday offset. Central Timezone (CT)
|
102
|
-
"market_close": ((None, time(16)),)
|
103
|
-
}
|
104
|
-
|
105
|
-
@property
|
106
|
-
def name(self):
|
107
|
-
return "CMEGlobex_EnergyAndMetals"
|
108
|
-
|
109
|
-
|
110
|
-
@property
|
111
|
-
def regular_holidays(self):
|
112
|
-
return AbstractHolidayCalendar(rules=[
|
113
|
-
USNewYearsDay,
|
114
|
-
GoodFriday,
|
115
|
-
ChristmasCME,
|
116
|
-
])
|
117
|
-
|
118
|
-
# @property
|
119
|
-
# def adhoc_holidays(self):
|
120
|
-
# return USNationalDaysofMourning
|
121
|
-
|
122
|
-
@property
|
123
|
-
def special_closes(self):
|
124
|
-
return [
|
125
|
-
(time(12, tzinfo=timezone('America/Chicago')), AbstractHolidayCalendar(rules=[
|
126
|
-
USMartinLutherKingJrPre2022,
|
127
|
-
USPresidentsDayPre2022,
|
128
|
-
USMemorialDayPre2022,
|
129
|
-
USIndependenceDayPre2022,
|
130
|
-
USLaborDay,
|
131
|
-
USThanksgivingDayPre2022,
|
132
|
-
])),
|
133
|
-
(time(12, 45, tzinfo=timezone('America/Chicago')), AbstractHolidayCalendar(rules=[
|
134
|
-
FridayAfterThanksgiving,
|
135
|
-
])),
|
136
|
-
(time(13, 30, tzinfo=timezone('America/Chicago')), AbstractHolidayCalendar(rules=[
|
137
|
-
USMartinLutherKingJrFrom2022,
|
138
|
-
USPresidentsDayFrom2022,
|
139
|
-
USMemorialDayFrom2022,
|
140
|
-
USJuneteenthFrom2022,
|
141
|
-
USIndependenceDayFrom2022,
|
142
|
-
USThanksgivingDayFrom2022,
|
143
|
-
])),
|
144
|
-
]
|
145
|
-
|
146
|
-
|
@@ -1,104 +0,0 @@
|
|
1
|
-
from .exchange_calendar_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
|
-
|
@@ -1,114 +0,0 @@
|
|
1
|
-
from .exchange_calendar_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
|
-
USMartinLutherKingJrAfter1998Before2016FridayBefore,
|
10
|
-
USMartinLutherKingJrAfter2015,
|
11
|
-
USPresidentsDayBefore2016FridayBefore,
|
12
|
-
USPresidentsDayBefore2015,
|
13
|
-
USPresidentsDayAfter2015,
|
14
|
-
GoodFridayBefore2021NotEarlyClose,
|
15
|
-
GoodFridayAfter2021,
|
16
|
-
GoodFriday2009,
|
17
|
-
GoodFriday2010,
|
18
|
-
GoodFriday2012,
|
19
|
-
GoodFriday2015,
|
20
|
-
GoodFriday2021,
|
21
|
-
USMemorialDay2013AndPrior,
|
22
|
-
USMemorialDayAfter2013,
|
23
|
-
USMemorialDay2015AndPriorFridayBefore,
|
24
|
-
USIndependenceDayBefore2014,
|
25
|
-
USIndependenceDayAfter2014,
|
26
|
-
USLaborDayStarting1887Before2014,
|
27
|
-
USLaborDayStarting1887Before2015FridayBefore,
|
28
|
-
USLaborDayStarting1887After2014,
|
29
|
-
USThanksgivingBefore2014,
|
30
|
-
USThanksgivingAfter2014,
|
31
|
-
USThanksgivingFriday,
|
32
|
-
)
|
33
|
-
from pandas_market_calendars.holidays_us import (
|
34
|
-
USNewYearsDay,
|
35
|
-
ChristmasEveInOrAfter1993,
|
36
|
-
Christmas,
|
37
|
-
USJuneteenthAfter2022
|
38
|
-
)
|
39
|
-
|
40
|
-
|
41
|
-
class CMEGlobexFixedIncomeCalendar(CMEGlobexBaseExchangeCalendar):
|
42
|
-
aliases = ["CME Globex Fixed Income", "CME Globex Interest Rate Products"]
|
43
|
-
|
44
|
-
regular_market_times = {
|
45
|
-
"market_open": ((None, time(18), -1),),
|
46
|
-
"market_close": ((None, time(17)),),
|
47
|
-
}
|
48
|
-
|
49
|
-
"""
|
50
|
-
Not yet implemented:
|
51
|
-
Christmas/New_Years
|
52
|
-
5am special open for a couple years (see tests)
|
53
|
-
|
54
|
-
regular market_open/market_close changed from 17/16 to 18/17?
|
55
|
-
"""
|
56
|
-
|
57
|
-
@property
|
58
|
-
def name(self): return "CME Globex Fixed Income"
|
59
|
-
|
60
|
-
@property
|
61
|
-
def regular_holidays(self):
|
62
|
-
return AbstractHolidayCalendar(rules=[
|
63
|
-
USNewYearsDay,
|
64
|
-
GoodFridayBefore2021NotEarlyClose,
|
65
|
-
GoodFridayAfter2021,
|
66
|
-
Christmas,
|
67
|
-
])
|
68
|
-
|
69
|
-
@property
|
70
|
-
def special_closes_adhoc(self):
|
71
|
-
return [(time(15,15), ["2010-07-02", "2011-07-01"]),
|
72
|
-
(time(12,15), ["2010-12-31"])]
|
73
|
-
|
74
|
-
@property
|
75
|
-
def special_closes(self):
|
76
|
-
# Source https://www.cmegroup.com/tools-information/holiday-calendar.html
|
77
|
-
return [
|
78
|
-
(time(12), AbstractHolidayCalendar(rules=[
|
79
|
-
USMartinLutherKingJrAfter1998Before2015,
|
80
|
-
USMartinLutherKingJrAfter2015,
|
81
|
-
USPresidentsDayBefore2015,
|
82
|
-
USPresidentsDayAfter2015,
|
83
|
-
USMemorialDay2013AndPrior,
|
84
|
-
USMemorialDayAfter2013,
|
85
|
-
USIndependenceDayBefore2014,
|
86
|
-
USIndependenceDayAfter2014,
|
87
|
-
USLaborDayStarting1887Before2014,
|
88
|
-
USLaborDayStarting1887After2014,
|
89
|
-
USThanksgivingBefore2014,
|
90
|
-
USThanksgivingAfter2014,
|
91
|
-
USJuneteenthAfter2022,
|
92
|
-
])),
|
93
|
-
|
94
|
-
(time(15,15), AbstractHolidayCalendar(rules=[
|
95
|
-
USMartinLutherKingJrAfter1998Before2016FridayBefore,
|
96
|
-
USPresidentsDayBefore2016FridayBefore,
|
97
|
-
GoodFriday2009,
|
98
|
-
USMemorialDay2015AndPriorFridayBefore,
|
99
|
-
USLaborDayStarting1887Before2015FridayBefore
|
100
|
-
])),
|
101
|
-
|
102
|
-
(time(12,15), AbstractHolidayCalendar(rules= [
|
103
|
-
USThanksgivingFriday,
|
104
|
-
ChristmasEveInOrAfter1993,
|
105
|
-
])),
|
106
|
-
|
107
|
-
(time(10,15), AbstractHolidayCalendar(rules=[
|
108
|
-
GoodFriday2010,
|
109
|
-
GoodFriday2012,
|
110
|
-
GoodFriday2015,
|
111
|
-
GoodFriday2021,
|
112
|
-
])),
|
113
|
-
|
114
|
-
]
|
@@ -1,78 +0,0 @@
|
|
1
|
-
from datetime import time
|
2
|
-
|
3
|
-
from pandas.tseries.holiday import AbstractHolidayCalendar
|
4
|
-
|
5
|
-
from pandas_market_calendars.exchange_calendar_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
|
-
]
|
@@ -1,119 +0,0 @@
|
|
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 .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
|
-
)]
|