pandas-market-calendars 5.1.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 -1151
- 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 -383
- 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.1.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.1.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/WHEEL +1 -1
- pandas_market_calendars-5.1.0.dist-info/RECORD +0 -50
- {pandas_market_calendars-5.1.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/licenses/LICENSE +0 -0
- {pandas_market_calendars-5.1.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/licenses/NOTICE +0 -0
- {pandas_market_calendars-5.1.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/top_level.txt +0 -0
@@ -1,81 +1,88 @@
|
|
1
|
-
from datetime import time
|
2
|
-
from itertools import chain
|
3
|
-
|
4
|
-
from pandas import Timestamp
|
5
|
-
from pandas.tseries.holiday import (
|
6
|
-
AbstractHolidayCalendar,
|
7
|
-
GoodFriday,
|
8
|
-
USLaborDay,
|
9
|
-
USPresidentsDay,
|
10
|
-
USThanksgivingDay,
|
11
|
-
)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
"""
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
1
|
+
from datetime import time
|
2
|
+
from itertools import chain
|
3
|
+
|
4
|
+
from pandas import Timestamp
|
5
|
+
from pandas.tseries.holiday import (
|
6
|
+
AbstractHolidayCalendar,
|
7
|
+
GoodFriday,
|
8
|
+
USLaborDay,
|
9
|
+
USPresidentsDay,
|
10
|
+
USThanksgivingDay,
|
11
|
+
)
|
12
|
+
import sys
|
13
|
+
# check python versiOn aNd import accordingly
|
14
|
+
if sys.version_info >= (3, 9):
|
15
|
+
# For Python 3.9 and later, import directly
|
16
|
+
from zoneinfo import ZoneInfo
|
17
|
+
else:
|
18
|
+
# For Python 3.8 and earlier, import from backports
|
19
|
+
from backports.zoneinfo import ZoneInfo
|
20
|
+
|
21
|
+
from pandas_market_calendars.holidays.us import (
|
22
|
+
Christmas,
|
23
|
+
USIndependenceDay,
|
24
|
+
USMartinLutherKingJrAfter1998,
|
25
|
+
USMemorialDay,
|
26
|
+
USNationalDaysofMourning,
|
27
|
+
USNewYearsDay,
|
28
|
+
)
|
29
|
+
from pandas_market_calendars.market_calendar import MarketCalendar
|
30
|
+
|
31
|
+
|
32
|
+
class ICEExchangeCalendar(MarketCalendar):
|
33
|
+
"""
|
34
|
+
Exchange calendar for ICE US.
|
35
|
+
|
36
|
+
Open Time: 8pm, US/Eastern
|
37
|
+
Close Time: 6pm, US/Eastern
|
38
|
+
|
39
|
+
https://www.theice.com/publicdocs/futures_us/ICE_Futures_US_Regular_Trading_Hours.pdf # noqa
|
40
|
+
"""
|
41
|
+
|
42
|
+
aliases = ["ICE", "ICEUS", "NYFE"]
|
43
|
+
regular_market_times = {
|
44
|
+
"market_open": ((None, time(20, 1), -1),), # offset by -1 day
|
45
|
+
"market_close": ((None, time(18)),),
|
46
|
+
}
|
47
|
+
|
48
|
+
@property
|
49
|
+
def name(self):
|
50
|
+
return "ICE"
|
51
|
+
|
52
|
+
@property
|
53
|
+
def tz(self):
|
54
|
+
return ZoneInfo("US/Eastern")
|
55
|
+
|
56
|
+
@property
|
57
|
+
def special_closes(self):
|
58
|
+
return [
|
59
|
+
(
|
60
|
+
time(13),
|
61
|
+
AbstractHolidayCalendar(
|
62
|
+
rules=[
|
63
|
+
USMartinLutherKingJrAfter1998,
|
64
|
+
USPresidentsDay,
|
65
|
+
USMemorialDay,
|
66
|
+
USIndependenceDay,
|
67
|
+
USLaborDay,
|
68
|
+
USThanksgivingDay,
|
69
|
+
]
|
70
|
+
),
|
71
|
+
)
|
72
|
+
]
|
73
|
+
|
74
|
+
@property
|
75
|
+
def adhoc_holidays(self):
|
76
|
+
return list(
|
77
|
+
chain(
|
78
|
+
USNationalDaysofMourning,
|
79
|
+
# ICE was only closed on the first day of the Hurricane Sandy
|
80
|
+
# closings (was not closed on 2012-10-30)
|
81
|
+
[Timestamp("2012-10-29", tz="UTC")],
|
82
|
+
)
|
83
|
+
)
|
84
|
+
|
85
|
+
@property
|
86
|
+
def regular_holidays(self):
|
87
|
+
# https://www.theice.com/publicdocs/futures_us/exchange_notices/NewExNot2016Holidays.pdf # noqa
|
88
|
+
return AbstractHolidayCalendar(rules=[USNewYearsDay, GoodFriday, Christmas])
|
@@ -1,155 +1,162 @@
|
|
1
|
-
from datetime import time
|
2
|
-
from itertools import chain
|
3
|
-
|
4
|
-
from pandas import Timestamp, DatetimeIndex, Timedelta
|
5
|
-
from pandas.tseries.holiday import AbstractHolidayCalendar
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
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
|
-
|
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
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
start,
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
1
|
+
from datetime import time
|
2
|
+
from itertools import chain
|
3
|
+
|
4
|
+
from pandas import Timestamp, DatetimeIndex, Timedelta
|
5
|
+
from pandas.tseries.holiday import AbstractHolidayCalendar
|
6
|
+
import sys
|
7
|
+
# check python versiOn aNd import accordingly
|
8
|
+
if sys.version_info >= (3, 9):
|
9
|
+
# For Python 3.9 and later, import directly
|
10
|
+
from zoneinfo import ZoneInfo
|
11
|
+
else:
|
12
|
+
# For Python 3.8 and earlier, import from backports
|
13
|
+
from backports.zoneinfo import ZoneInfo
|
14
|
+
|
15
|
+
from typing import Literal, Union
|
16
|
+
from pandas_market_calendars import calendar_utils as u
|
17
|
+
|
18
|
+
from pandas_market_calendars.holidays.nyse import (
|
19
|
+
USPresidentsDay,
|
20
|
+
GoodFriday,
|
21
|
+
USMemorialDay,
|
22
|
+
USJuneteenthAfter2022,
|
23
|
+
USIndependenceDay,
|
24
|
+
USThanksgivingDay,
|
25
|
+
ChristmasNYSE,
|
26
|
+
USMartinLutherKingJrAfter1998,
|
27
|
+
# Ad-Hoc
|
28
|
+
DayAfterThanksgiving1pmEarlyCloseInOrAfter1993,
|
29
|
+
DaysBeforeIndependenceDay1pmEarlyCloseAdhoc,
|
30
|
+
ChristmasEvesAdhoc,
|
31
|
+
)
|
32
|
+
from .nyse import NYSEExchangeCalendar
|
33
|
+
|
34
|
+
|
35
|
+
class IEXExchangeCalendar(NYSEExchangeCalendar):
|
36
|
+
"""
|
37
|
+
Exchange calendar for the Investor's Exchange (IEX).
|
38
|
+
|
39
|
+
IEX Exchange is a U.S. stock exchange focused on driving performance
|
40
|
+
for broker-dealers and investors through innovative design and technology.
|
41
|
+
|
42
|
+
Most of this class inherits from NYSEExchangeCalendar since
|
43
|
+
the holidays are the same. The only variation is (1) IEX began
|
44
|
+
operation in 2013, and (2) IEX has different hours of operation
|
45
|
+
|
46
|
+
References:
|
47
|
+
- https://exchange.iex.io/
|
48
|
+
- https://iexexchange.io/resources/trading/trading-hours-holidays/index.html
|
49
|
+
"""
|
50
|
+
|
51
|
+
regular_market_times = {
|
52
|
+
"pre": (("2013-03-25", time(8)),),
|
53
|
+
"market_open": ((None, time(9, 30)),),
|
54
|
+
"market_close": ((None, time(16)),),
|
55
|
+
"post": ((None, time(17)),),
|
56
|
+
}
|
57
|
+
|
58
|
+
aliases = ["IEX", "Investors_Exchange"]
|
59
|
+
|
60
|
+
@property
|
61
|
+
def name(self):
|
62
|
+
return "IEX"
|
63
|
+
|
64
|
+
@property
|
65
|
+
def full_name(self):
|
66
|
+
return "Investor's Exchange"
|
67
|
+
|
68
|
+
@property
|
69
|
+
def weekmask(self):
|
70
|
+
return "Mon Tue Wed Thu Fri"
|
71
|
+
|
72
|
+
@property
|
73
|
+
def regular_holidays(self):
|
74
|
+
return AbstractHolidayCalendar(
|
75
|
+
rules=[
|
76
|
+
USPresidentsDay,
|
77
|
+
GoodFriday,
|
78
|
+
USMemorialDay,
|
79
|
+
USJuneteenthAfter2022,
|
80
|
+
USIndependenceDay,
|
81
|
+
USThanksgivingDay,
|
82
|
+
ChristmasNYSE,
|
83
|
+
USMartinLutherKingJrAfter1998,
|
84
|
+
]
|
85
|
+
)
|
86
|
+
|
87
|
+
@property
|
88
|
+
def adhoc_holidays(self):
|
89
|
+
return list(
|
90
|
+
chain(
|
91
|
+
ChristmasEvesAdhoc,
|
92
|
+
)
|
93
|
+
)
|
94
|
+
|
95
|
+
@property
|
96
|
+
def special_closes(self):
|
97
|
+
return [
|
98
|
+
(
|
99
|
+
time(hour=13, tzinfo=ZoneInfo("America/New_York")),
|
100
|
+
AbstractHolidayCalendar(
|
101
|
+
rules=[
|
102
|
+
DayAfterThanksgiving1pmEarlyCloseInOrAfter1993,
|
103
|
+
]
|
104
|
+
),
|
105
|
+
)
|
106
|
+
]
|
107
|
+
|
108
|
+
"""Override NYSE calendar special cases"""
|
109
|
+
|
110
|
+
@property
|
111
|
+
def special_closes_adhoc(self):
|
112
|
+
return [
|
113
|
+
(
|
114
|
+
time(13, tzinfo=ZoneInfo("America/New_York")),
|
115
|
+
DaysBeforeIndependenceDay1pmEarlyCloseAdhoc,
|
116
|
+
)
|
117
|
+
]
|
118
|
+
|
119
|
+
@property
|
120
|
+
def special_opens(self):
|
121
|
+
return []
|
122
|
+
|
123
|
+
def valid_days(self, start_date, end_date, tz="UTC"):
|
124
|
+
start_date = Timestamp(start_date)
|
125
|
+
if start_date.tz is not None:
|
126
|
+
# Ensure valid Comparison to "2013-08-25" is possible
|
127
|
+
start_date.tz_convert(self.tz).tz_localize(None)
|
128
|
+
|
129
|
+
# Limit Start_date to the Exchange's Open
|
130
|
+
start_date = max(start_date, Timestamp("2013-08-25"))
|
131
|
+
return super().valid_days(start_date, end_date, tz=tz)
|
132
|
+
|
133
|
+
def date_range_htf(
|
134
|
+
self,
|
135
|
+
frequency: Union[str, Timedelta, int, float],
|
136
|
+
start: Union[str, Timestamp, int, float, None] = None,
|
137
|
+
end: Union[str, Timestamp, int, float, None] = None,
|
138
|
+
periods: Union[int, None] = None,
|
139
|
+
closed: Union[Literal["left", "right"], None] = "right",
|
140
|
+
*,
|
141
|
+
day_anchor: u.Day_Anchor = "SUN",
|
142
|
+
month_anchor: u.Month_Anchor = "JAN",
|
143
|
+
) -> DatetimeIndex:
|
144
|
+
|
145
|
+
start, end, periods = u._error_check_htf_range(start, end, periods)
|
146
|
+
|
147
|
+
# Cap Beginning and end dates to the opening date of IEX
|
148
|
+
if start is not None:
|
149
|
+
start = max(start, Timestamp("2013-08-25"))
|
150
|
+
if end is not None:
|
151
|
+
end = max(end, Timestamp("2013-08-25"))
|
152
|
+
|
153
|
+
return u.date_range_htf(
|
154
|
+
self.holidays(),
|
155
|
+
frequency,
|
156
|
+
start,
|
157
|
+
end,
|
158
|
+
periods,
|
159
|
+
closed,
|
160
|
+
day_anchor=day_anchor,
|
161
|
+
month_anchor=month_anchor,
|
162
|
+
)
|