pandas-market-calendars 5.0.0__py3-none-any.whl → 5.1.1__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/__init__.py +39 -39
- pandas_market_calendars/calendar_registry.py +57 -57
- pandas_market_calendars/calendar_utils.py +1151 -1147
- pandas_market_calendars/calendars/asx.py +77 -70
- pandas_market_calendars/calendars/bmf.py +226 -219
- pandas_market_calendars/calendars/bse.py +432 -425
- pandas_market_calendars/calendars/cboe.py +156 -149
- pandas_market_calendars/calendars/cme.py +412 -405
- pandas_market_calendars/calendars/cme_globex_agriculture.py +172 -172
- pandas_market_calendars/calendars/cme_globex_base.py +126 -119
- pandas_market_calendars/calendars/cme_globex_crypto.py +165 -158
- pandas_market_calendars/calendars/cme_globex_energy_and_metals.py +223 -216
- pandas_market_calendars/calendars/cme_globex_equities.py +130 -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 +138 -131
- pandas_market_calendars/calendars/eurex_fixed_income.py +105 -98
- pandas_market_calendars/calendars/hkex.py +438 -431
- pandas_market_calendars/calendars/ice.py +88 -81
- pandas_market_calendars/calendars/iex.py +162 -155
- pandas_market_calendars/calendars/jpx.py +124 -117
- pandas_market_calendars/calendars/lse.py +125 -118
- pandas_market_calendars/calendars/mirror.py +144 -144
- pandas_market_calendars/calendars/nyse.py +1472 -1466
- pandas_market_calendars/calendars/ose.py +125 -118
- pandas_market_calendars/calendars/sifma.py +390 -356
- pandas_market_calendars/calendars/six.py +143 -136
- pandas_market_calendars/calendars/sse.py +322 -315
- pandas_market_calendars/calendars/tase.py +231 -224
- pandas_market_calendars/calendars/tsx.py +192 -185
- pandas_market_calendars/class_registry.py +115 -115
- pandas_market_calendars/holidays/cme.py +385 -385
- pandas_market_calendars/holidays/cme_globex.py +214 -214
- pandas_market_calendars/holidays/cn.py +1476 -1476
- pandas_market_calendars/holidays/jp.py +401 -401
- pandas_market_calendars/holidays/jpx_equinox.py +506 -506
- pandas_market_calendars/holidays/nyse.py +1536 -1536
- pandas_market_calendars/holidays/oz.py +63 -63
- pandas_market_calendars/holidays/sifma.py +350 -350
- pandas_market_calendars/holidays/us.py +376 -376
- pandas_market_calendars/market_calendar.py +1008 -1008
- {pandas_market_calendars-5.0.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/METADATA +3 -1
- pandas_market_calendars-5.1.1.dist-info/RECORD +50 -0
- {pandas_market_calendars-5.0.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/WHEEL +1 -1
- pandas_market_calendars-5.0.0.dist-info/RECORD +0 -50
- {pandas_market_calendars-5.0.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/licenses/LICENSE +0 -0
- {pandas_market_calendars-5.0.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/licenses/NOTICE +0 -0
- {pandas_market_calendars-5.0.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/top_level.txt +0 -0
@@ -1,101 +1,101 @@
|
|
1
|
-
from datetime import time
|
2
|
-
|
3
|
-
from pandas.tseries.holiday import AbstractHolidayCalendar
|
4
|
-
|
5
|
-
from pandas_market_calendars.calendars.cme_globex_base import (
|
6
|
-
CMEGlobexBaseExchangeCalendar,
|
7
|
-
)
|
8
|
-
from pandas_market_calendars.holidays.cme import (
|
9
|
-
USMartinLutherKingJrAfter1998Before2022,
|
10
|
-
USPresidentsDayBefore2022,
|
11
|
-
GoodFridayBefore2021,
|
12
|
-
GoodFriday2021,
|
13
|
-
GoodFriday2022,
|
14
|
-
GoodFridayAfter2022,
|
15
|
-
USMemorialDay2021AndPrior,
|
16
|
-
USIndependenceDayBefore2022,
|
17
|
-
USLaborDayStarting1887Before2022,
|
18
|
-
USThanksgivingBefore2022,
|
19
|
-
USThanksgivingFriday,
|
20
|
-
)
|
21
|
-
from pandas_market_calendars.holidays.us import (
|
22
|
-
USNewYearsDay,
|
23
|
-
ChristmasEveInOrAfter1993,
|
24
|
-
Christmas,
|
25
|
-
)
|
26
|
-
|
27
|
-
_1015 = time(10, 15)
|
28
|
-
_1200 = time(12, 0)
|
29
|
-
_1215 = time(12, 15)
|
30
|
-
|
31
|
-
|
32
|
-
class CMEGlobexFXExchangeCalendar(CMEGlobexBaseExchangeCalendar):
|
33
|
-
aliases = ["CME_Currency"]
|
34
|
-
|
35
|
-
# Using CME Globex trading times eg AUD/USD, EUR/GBP, and BRL/USD
|
36
|
-
# https://www.cmegroup.com/markets/fx/g10/australian-dollar.contractSpecs.html
|
37
|
-
# https://www.cmegroup.com/markets/fx/cross-rates/euro-fx-british-pound.contractSpecs.html
|
38
|
-
# https://www.cmegroup.com/markets/fx/emerging-market/brazilian-real.contractSpecs.html
|
39
|
-
# CME "NZD spot" has its own holiday schedule; this is a niche product (via "FX Link") and is not handled in this
|
40
|
-
# class; however, its regular hours follow the same schedule (see
|
41
|
-
# https://www.cmegroup.com/trading/fx/files/fx-product-guide-2021-us.pdf)
|
42
|
-
regular_market_times = {
|
43
|
-
"market_open": ((None, time(17), -1),), # offset by -1 day
|
44
|
-
"market_close": ((None, time(16, 00)),),
|
45
|
-
}
|
46
|
-
|
47
|
-
aliases = ["CMEGlobex_FX", "CME_FX", "CME_Currency"]
|
48
|
-
|
49
|
-
@property
|
50
|
-
def name(self):
|
51
|
-
return "CMEGlobex_FX"
|
52
|
-
|
53
|
-
@property
|
54
|
-
def regular_holidays(self):
|
55
|
-
return AbstractHolidayCalendar(
|
56
|
-
rules=[
|
57
|
-
USNewYearsDay,
|
58
|
-
GoodFridayBefore2021,
|
59
|
-
GoodFriday2022,
|
60
|
-
Christmas,
|
61
|
-
]
|
62
|
-
)
|
63
|
-
|
64
|
-
@property
|
65
|
-
def special_closes(self):
|
66
|
-
"""
|
67
|
-
Accurate 2020-2022 inclusive
|
68
|
-
TODO - enhance/verify prior to 2020
|
69
|
-
TODO - Add 2023+ once known
|
70
|
-
"""
|
71
|
-
# Source https://www.cmegroup.com/tools-information/holiday-calendar.html
|
72
|
-
return [
|
73
|
-
(
|
74
|
-
_1015,
|
75
|
-
AbstractHolidayCalendar(
|
76
|
-
rules=[
|
77
|
-
GoodFriday2021,
|
78
|
-
GoodFridayAfter2022,
|
79
|
-
]
|
80
|
-
),
|
81
|
-
),
|
82
|
-
(
|
83
|
-
_1200,
|
84
|
-
AbstractHolidayCalendar(
|
85
|
-
rules=[
|
86
|
-
USMartinLutherKingJrAfter1998Before2022,
|
87
|
-
USPresidentsDayBefore2022,
|
88
|
-
USMemorialDay2021AndPrior,
|
89
|
-
USIndependenceDayBefore2022,
|
90
|
-
USLaborDayStarting1887Before2022,
|
91
|
-
USThanksgivingBefore2022,
|
92
|
-
]
|
93
|
-
),
|
94
|
-
),
|
95
|
-
(
|
96
|
-
_1215,
|
97
|
-
AbstractHolidayCalendar(
|
98
|
-
rules=[USThanksgivingFriday, ChristmasEveInOrAfter1993]
|
99
|
-
),
|
100
|
-
),
|
101
|
-
]
|
1
|
+
from datetime import time
|
2
|
+
|
3
|
+
from pandas.tseries.holiday import AbstractHolidayCalendar
|
4
|
+
|
5
|
+
from pandas_market_calendars.calendars.cme_globex_base import (
|
6
|
+
CMEGlobexBaseExchangeCalendar,
|
7
|
+
)
|
8
|
+
from pandas_market_calendars.holidays.cme import (
|
9
|
+
USMartinLutherKingJrAfter1998Before2022,
|
10
|
+
USPresidentsDayBefore2022,
|
11
|
+
GoodFridayBefore2021,
|
12
|
+
GoodFriday2021,
|
13
|
+
GoodFriday2022,
|
14
|
+
GoodFridayAfter2022,
|
15
|
+
USMemorialDay2021AndPrior,
|
16
|
+
USIndependenceDayBefore2022,
|
17
|
+
USLaborDayStarting1887Before2022,
|
18
|
+
USThanksgivingBefore2022,
|
19
|
+
USThanksgivingFriday,
|
20
|
+
)
|
21
|
+
from pandas_market_calendars.holidays.us import (
|
22
|
+
USNewYearsDay,
|
23
|
+
ChristmasEveInOrAfter1993,
|
24
|
+
Christmas,
|
25
|
+
)
|
26
|
+
|
27
|
+
_1015 = time(10, 15)
|
28
|
+
_1200 = time(12, 0)
|
29
|
+
_1215 = time(12, 15)
|
30
|
+
|
31
|
+
|
32
|
+
class CMEGlobexFXExchangeCalendar(CMEGlobexBaseExchangeCalendar):
|
33
|
+
aliases = ["CME_Currency"]
|
34
|
+
|
35
|
+
# Using CME Globex trading times eg AUD/USD, EUR/GBP, and BRL/USD
|
36
|
+
# https://www.cmegroup.com/markets/fx/g10/australian-dollar.contractSpecs.html
|
37
|
+
# https://www.cmegroup.com/markets/fx/cross-rates/euro-fx-british-pound.contractSpecs.html
|
38
|
+
# https://www.cmegroup.com/markets/fx/emerging-market/brazilian-real.contractSpecs.html
|
39
|
+
# CME "NZD spot" has its own holiday schedule; this is a niche product (via "FX Link") and is not handled in this
|
40
|
+
# class; however, its regular hours follow the same schedule (see
|
41
|
+
# https://www.cmegroup.com/trading/fx/files/fx-product-guide-2021-us.pdf)
|
42
|
+
regular_market_times = {
|
43
|
+
"market_open": ((None, time(17), -1),), # offset by -1 day
|
44
|
+
"market_close": ((None, time(16, 00)),),
|
45
|
+
}
|
46
|
+
|
47
|
+
aliases = ["CMEGlobex_FX", "CME_FX", "CME_Currency"]
|
48
|
+
|
49
|
+
@property
|
50
|
+
def name(self):
|
51
|
+
return "CMEGlobex_FX"
|
52
|
+
|
53
|
+
@property
|
54
|
+
def regular_holidays(self):
|
55
|
+
return AbstractHolidayCalendar(
|
56
|
+
rules=[
|
57
|
+
USNewYearsDay,
|
58
|
+
GoodFridayBefore2021,
|
59
|
+
GoodFriday2022,
|
60
|
+
Christmas,
|
61
|
+
]
|
62
|
+
)
|
63
|
+
|
64
|
+
@property
|
65
|
+
def special_closes(self):
|
66
|
+
"""
|
67
|
+
Accurate 2020-2022 inclusive
|
68
|
+
TODO - enhance/verify prior to 2020
|
69
|
+
TODO - Add 2023+ once known
|
70
|
+
"""
|
71
|
+
# Source https://www.cmegroup.com/tools-information/holiday-calendar.html
|
72
|
+
return [
|
73
|
+
(
|
74
|
+
_1015,
|
75
|
+
AbstractHolidayCalendar(
|
76
|
+
rules=[
|
77
|
+
GoodFriday2021,
|
78
|
+
GoodFridayAfter2022,
|
79
|
+
]
|
80
|
+
),
|
81
|
+
),
|
82
|
+
(
|
83
|
+
_1200,
|
84
|
+
AbstractHolidayCalendar(
|
85
|
+
rules=[
|
86
|
+
USMartinLutherKingJrAfter1998Before2022,
|
87
|
+
USPresidentsDayBefore2022,
|
88
|
+
USMemorialDay2021AndPrior,
|
89
|
+
USIndependenceDayBefore2022,
|
90
|
+
USLaborDayStarting1887Before2022,
|
91
|
+
USThanksgivingBefore2022,
|
92
|
+
]
|
93
|
+
),
|
94
|
+
),
|
95
|
+
(
|
96
|
+
_1215,
|
97
|
+
AbstractHolidayCalendar(
|
98
|
+
rules=[USThanksgivingFriday, ChristmasEveInOrAfter1993]
|
99
|
+
),
|
100
|
+
),
|
101
|
+
]
|
@@ -1,131 +1,138 @@
|
|
1
|
-
#
|
2
|
-
# kewlfft
|
3
|
-
#
|
4
|
-
|
5
|
-
from datetime import time
|
6
|
-
|
7
|
-
from pandas.tseries.holiday import (
|
8
|
-
AbstractHolidayCalendar,
|
9
|
-
EasterMonday,
|
10
|
-
GoodFriday,
|
11
|
-
Holiday,
|
12
|
-
previous_friday,
|
13
|
-
)
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
# New Year's
|
33
|
-
|
34
|
-
"New Year's
|
35
|
-
month=
|
36
|
-
day=
|
37
|
-
|
38
|
-
)
|
39
|
-
#
|
40
|
-
|
41
|
-
"
|
42
|
-
month=
|
43
|
-
day=1,
|
44
|
-
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
|
45
|
-
)
|
46
|
-
#
|
47
|
-
|
48
|
-
"
|
49
|
-
month=
|
50
|
-
day=
|
51
|
-
|
52
|
-
)
|
53
|
-
# Christmas
|
54
|
-
|
55
|
-
"Christmas",
|
56
|
-
month=12,
|
57
|
-
day=
|
58
|
-
|
59
|
-
)
|
60
|
-
#
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
#
|
69
|
-
|
70
|
-
"
|
71
|
-
month=12,
|
72
|
-
day=
|
73
|
-
)
|
74
|
-
|
75
|
-
#
|
76
|
-
|
77
|
-
"
|
78
|
-
month=12,
|
79
|
-
day=
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
1
|
+
#
|
2
|
+
# kewlfft
|
3
|
+
#
|
4
|
+
|
5
|
+
from datetime import time
|
6
|
+
|
7
|
+
from pandas.tseries.holiday import (
|
8
|
+
AbstractHolidayCalendar,
|
9
|
+
EasterMonday,
|
10
|
+
GoodFriday,
|
11
|
+
Holiday,
|
12
|
+
previous_friday,
|
13
|
+
)
|
14
|
+
import sys
|
15
|
+
# check python versiOn aNd import accordingly
|
16
|
+
if sys.version_info >= (3, 9):
|
17
|
+
# For Python 3.9 and later, import directly
|
18
|
+
from zoneinfo import ZoneInfo
|
19
|
+
else:
|
20
|
+
# For Python 3.8 and earlier, import from backports
|
21
|
+
from backports.zoneinfo import ZoneInfo
|
22
|
+
|
23
|
+
from pandas_market_calendars.market_calendar import (
|
24
|
+
FRIDAY,
|
25
|
+
MONDAY,
|
26
|
+
MarketCalendar,
|
27
|
+
THURSDAY,
|
28
|
+
TUESDAY,
|
29
|
+
WEDNESDAY,
|
30
|
+
)
|
31
|
+
|
32
|
+
# New Year's Eve
|
33
|
+
EUREXNewYearsEve = Holiday(
|
34
|
+
"New Year's Eve",
|
35
|
+
month=12,
|
36
|
+
day=31,
|
37
|
+
observance=previous_friday,
|
38
|
+
)
|
39
|
+
# New Year's Day
|
40
|
+
EUREXNewYearsDay = Holiday(
|
41
|
+
"New Year's Day",
|
42
|
+
month=1,
|
43
|
+
day=1,
|
44
|
+
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
|
45
|
+
)
|
46
|
+
# Early May bank holiday
|
47
|
+
MayBank = Holiday(
|
48
|
+
"Early May Bank Holiday",
|
49
|
+
month=5,
|
50
|
+
day=1,
|
51
|
+
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
|
52
|
+
)
|
53
|
+
# Christmas Eve
|
54
|
+
ChristmasEve = Holiday(
|
55
|
+
"Christmas Eve",
|
56
|
+
month=12,
|
57
|
+
day=24,
|
58
|
+
observance=previous_friday,
|
59
|
+
)
|
60
|
+
# Christmas
|
61
|
+
Christmas = Holiday(
|
62
|
+
"Christmas",
|
63
|
+
month=12,
|
64
|
+
day=25,
|
65
|
+
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
|
66
|
+
)
|
67
|
+
# If christmas day is Saturday Monday 27th is a holiday
|
68
|
+
# If christmas day is sunday the Tuesday 27th is a holiday
|
69
|
+
WeekendChristmas = Holiday(
|
70
|
+
"Weekend Christmas",
|
71
|
+
month=12,
|
72
|
+
day=27,
|
73
|
+
days_of_week=(MONDAY, TUESDAY),
|
74
|
+
)
|
75
|
+
# Boxing day
|
76
|
+
BoxingDay = Holiday(
|
77
|
+
"Boxing Day",
|
78
|
+
month=12,
|
79
|
+
day=26,
|
80
|
+
)
|
81
|
+
# If boxing day is saturday then Monday 28th is a holiday
|
82
|
+
# If boxing day is sunday then Tuesday 28th is a holiday
|
83
|
+
WeekendBoxingDay = Holiday(
|
84
|
+
"Weekend Boxing Day",
|
85
|
+
month=12,
|
86
|
+
day=28,
|
87
|
+
days_of_week=(MONDAY, TUESDAY),
|
88
|
+
)
|
89
|
+
|
90
|
+
|
91
|
+
class EUREXExchangeCalendar(MarketCalendar):
|
92
|
+
"""
|
93
|
+
Exchange calendar for EUREX
|
94
|
+
|
95
|
+
"""
|
96
|
+
|
97
|
+
aliases = ["EUREX"]
|
98
|
+
regular_market_times = {
|
99
|
+
"market_open": ((None, time(9)),),
|
100
|
+
"market_close": ((None, time(17, 30)),),
|
101
|
+
}
|
102
|
+
|
103
|
+
@property
|
104
|
+
def name(self):
|
105
|
+
return "EUREX"
|
106
|
+
|
107
|
+
@property
|
108
|
+
def tz(self):
|
109
|
+
return ZoneInfo("Europe/Berlin")
|
110
|
+
|
111
|
+
@property
|
112
|
+
def regular_holidays(self):
|
113
|
+
return AbstractHolidayCalendar(
|
114
|
+
rules=[
|
115
|
+
EUREXNewYearsDay,
|
116
|
+
GoodFriday,
|
117
|
+
EasterMonday,
|
118
|
+
MayBank,
|
119
|
+
Christmas,
|
120
|
+
WeekendChristmas,
|
121
|
+
BoxingDay,
|
122
|
+
WeekendBoxingDay,
|
123
|
+
]
|
124
|
+
)
|
125
|
+
|
126
|
+
@property
|
127
|
+
def special_closes(self):
|
128
|
+
return [
|
129
|
+
(
|
130
|
+
time(12, 30),
|
131
|
+
AbstractHolidayCalendar(
|
132
|
+
rules=[
|
133
|
+
ChristmasEve,
|
134
|
+
EUREXNewYearsEve,
|
135
|
+
]
|
136
|
+
),
|
137
|
+
)
|
138
|
+
]
|
@@ -1,98 +1,105 @@
|
|
1
|
-
from datetime import time
|
2
|
-
|
3
|
-
from pandas.tseries.holiday import (
|
4
|
-
AbstractHolidayCalendar,
|
5
|
-
EasterMonday,
|
6
|
-
GoodFriday,
|
7
|
-
Holiday,
|
8
|
-
)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
#
|
28
|
-
|
29
|
-
"
|
30
|
-
month=
|
31
|
-
day=1,
|
32
|
-
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
|
33
|
-
)
|
34
|
-
#
|
35
|
-
|
36
|
-
"
|
37
|
-
month=
|
38
|
-
day=
|
39
|
-
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
|
40
|
-
)
|
41
|
-
# Christmas
|
42
|
-
|
43
|
-
"Christmas",
|
44
|
-
month=12,
|
45
|
-
day=
|
46
|
-
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
|
47
|
-
)
|
48
|
-
#
|
49
|
-
|
50
|
-
"
|
51
|
-
month=12,
|
52
|
-
day=
|
53
|
-
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
|
54
|
-
)
|
55
|
-
#
|
56
|
-
|
57
|
-
"
|
58
|
-
month=12,
|
59
|
-
day=
|
60
|
-
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
|
61
|
-
)
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
1
|
+
from datetime import time
|
2
|
+
|
3
|
+
from pandas.tseries.holiday import (
|
4
|
+
AbstractHolidayCalendar,
|
5
|
+
EasterMonday,
|
6
|
+
GoodFriday,
|
7
|
+
Holiday,
|
8
|
+
)
|
9
|
+
import sys
|
10
|
+
# check python versiOn aNd import accordingly
|
11
|
+
if sys.version_info >= (3, 9):
|
12
|
+
# For Python 3.9 and later, import directly
|
13
|
+
from zoneinfo import ZoneInfo
|
14
|
+
else:
|
15
|
+
# For Python 3.8 and earlier, import from backports
|
16
|
+
from backports.zoneinfo import ZoneInfo
|
17
|
+
|
18
|
+
from pandas_market_calendars.market_calendar import (
|
19
|
+
FRIDAY,
|
20
|
+
MONDAY,
|
21
|
+
MarketCalendar,
|
22
|
+
THURSDAY,
|
23
|
+
TUESDAY,
|
24
|
+
WEDNESDAY,
|
25
|
+
)
|
26
|
+
|
27
|
+
# New Year's Day
|
28
|
+
EUREXNewYearsDay = Holiday(
|
29
|
+
"New Year's Day",
|
30
|
+
month=1,
|
31
|
+
day=1,
|
32
|
+
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
|
33
|
+
)
|
34
|
+
# Early May bank holiday
|
35
|
+
MayBank = Holiday(
|
36
|
+
"Early May Bank Holiday",
|
37
|
+
month=5,
|
38
|
+
day=1,
|
39
|
+
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
|
40
|
+
)
|
41
|
+
# Christmas Eve
|
42
|
+
ChristmasEve = Holiday(
|
43
|
+
"Christmas Eve",
|
44
|
+
month=12,
|
45
|
+
day=24,
|
46
|
+
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
|
47
|
+
)
|
48
|
+
# Christmas
|
49
|
+
Christmas = Holiday(
|
50
|
+
"Christmas",
|
51
|
+
month=12,
|
52
|
+
day=25,
|
53
|
+
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
|
54
|
+
)
|
55
|
+
# Boxing day
|
56
|
+
BoxingDay = Holiday(
|
57
|
+
"Boxing Day",
|
58
|
+
month=12,
|
59
|
+
day=26,
|
60
|
+
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
|
61
|
+
)
|
62
|
+
# New Year's Eve
|
63
|
+
NewYearsEve = Holiday(
|
64
|
+
"New Year's Eve",
|
65
|
+
month=12,
|
66
|
+
day=31,
|
67
|
+
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
|
68
|
+
)
|
69
|
+
|
70
|
+
|
71
|
+
class EUREXFixedIncomeCalendar(MarketCalendar):
|
72
|
+
"""
|
73
|
+
Trading calendar available here:
|
74
|
+
https://www.eurex.com/resource/blob/3378814/910cf372738890f691bc1bfbccfd3aef/data/tradingcalendar_2023_en.pdf
|
75
|
+
"""
|
76
|
+
|
77
|
+
aliases = ["EUREX_Bond"]
|
78
|
+
|
79
|
+
regular_market_times = {
|
80
|
+
"market_open": ((None, time(1, 10)), ("2018-12-10", time(8, 0))),
|
81
|
+
"market_close": ((None, time(22)),),
|
82
|
+
}
|
83
|
+
|
84
|
+
@property
|
85
|
+
def name(self):
|
86
|
+
return "EUREX_Bond"
|
87
|
+
|
88
|
+
@property
|
89
|
+
def tz(self):
|
90
|
+
return ZoneInfo("Europe/Berlin")
|
91
|
+
|
92
|
+
@property
|
93
|
+
def regular_holidays(self):
|
94
|
+
return AbstractHolidayCalendar(
|
95
|
+
rules=[
|
96
|
+
EUREXNewYearsDay,
|
97
|
+
GoodFriday,
|
98
|
+
EasterMonday,
|
99
|
+
MayBank,
|
100
|
+
ChristmasEve,
|
101
|
+
Christmas,
|
102
|
+
BoxingDay,
|
103
|
+
NewYearsEve,
|
104
|
+
]
|
105
|
+
)
|