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