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.
Files changed (48) hide show
  1. pandas_market_calendars/__init__.py +39 -39
  2. pandas_market_calendars/calendar_registry.py +57 -57
  3. pandas_market_calendars/calendar_utils.py +1151 -1151
  4. pandas_market_calendars/calendars/asx.py +77 -70
  5. pandas_market_calendars/calendars/bmf.py +226 -219
  6. pandas_market_calendars/calendars/bse.py +432 -425
  7. pandas_market_calendars/calendars/cboe.py +156 -149
  8. pandas_market_calendars/calendars/cme.py +412 -405
  9. pandas_market_calendars/calendars/cme_globex_agriculture.py +172 -172
  10. pandas_market_calendars/calendars/cme_globex_base.py +126 -119
  11. pandas_market_calendars/calendars/cme_globex_crypto.py +165 -158
  12. pandas_market_calendars/calendars/cme_globex_energy_and_metals.py +223 -216
  13. pandas_market_calendars/calendars/cme_globex_equities.py +130 -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 +138 -131
  17. pandas_market_calendars/calendars/eurex_fixed_income.py +105 -98
  18. pandas_market_calendars/calendars/hkex.py +438 -431
  19. pandas_market_calendars/calendars/ice.py +88 -81
  20. pandas_market_calendars/calendars/iex.py +162 -155
  21. pandas_market_calendars/calendars/jpx.py +124 -117
  22. pandas_market_calendars/calendars/lse.py +125 -118
  23. pandas_market_calendars/calendars/mirror.py +144 -144
  24. pandas_market_calendars/calendars/nyse.py +1472 -1466
  25. pandas_market_calendars/calendars/ose.py +125 -118
  26. pandas_market_calendars/calendars/sifma.py +390 -383
  27. pandas_market_calendars/calendars/six.py +143 -136
  28. pandas_market_calendars/calendars/sse.py +322 -315
  29. pandas_market_calendars/calendars/tase.py +231 -224
  30. pandas_market_calendars/calendars/tsx.py +192 -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 +63 -63
  39. pandas_market_calendars/holidays/sifma.py +350 -350
  40. pandas_market_calendars/holidays/us.py +376 -376
  41. pandas_market_calendars/market_calendar.py +1008 -1008
  42. {pandas_market_calendars-5.1.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/METADATA +3 -1
  43. pandas_market_calendars-5.1.1.dist-info/RECORD +50 -0
  44. {pandas_market_calendars-5.1.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/WHEEL +1 -1
  45. pandas_market_calendars-5.1.0.dist-info/RECORD +0 -50
  46. {pandas_market_calendars-5.1.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/licenses/LICENSE +0 -0
  47. {pandas_market_calendars-5.1.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/licenses/NOTICE +0 -0
  48. {pandas_market_calendars-5.1.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/top_level.txt +0 -0
@@ -1,149 +1,156 @@
1
- from datetime import time
2
- from itertools import chain
3
-
4
- import pandas as pd
5
- from pandas.tseries.holiday import (
6
- AbstractHolidayCalendar,
7
- GoodFriday,
8
- USLaborDay,
9
- USPresidentsDay,
10
- USThanksgivingDay,
11
- Holiday,
12
- )
13
- from zoneinfo import ZoneInfo
14
-
15
- from pandas_market_calendars.holidays.us import (
16
- Christmas,
17
- USBlackFridayInOrAfter1993,
18
- USIndependenceDay,
19
- USMartinLutherKingJrAfter1998,
20
- USMemorialDay,
21
- USNewYearsDay,
22
- HurricaneSandyClosings,
23
- USNationalDaysofMourning,
24
- USJuneteenthAfter2022,
25
- )
26
- from pandas_market_calendars.market_calendar import MarketCalendar
27
-
28
-
29
- def good_friday_unless_christmas_nye_friday(dt):
30
- """
31
- Good Friday is a valid trading day if Christmas Day or New Years Day fall
32
- on a Friday.
33
- """
34
- if isinstance(dt, pd.DatetimeIndex):
35
- # Pandas < 2.1.0 will call with an index and fall-back to element by element
36
- # Pandas == 2.1.0 will only call element by element
37
- raise NotImplementedError()
38
-
39
- year = dt.year
40
- christmas_weekday = Christmas.observance(
41
- pd.Timestamp(year=year, month=12, day=25)
42
- ).weekday()
43
- nyd_weekday = USNewYearsDay.observance(
44
- pd.Timestamp(year=year, month=1, day=1)
45
- ).weekday()
46
- if christmas_weekday != 4 and nyd_weekday != 4:
47
- return GoodFriday.dates(
48
- pd.Timestamp(year=year, month=1, day=1),
49
- pd.Timestamp(year=year, month=12, day=31),
50
- )[0]
51
- else:
52
- # Not a holiday so use NaT to ensure it gets removed
53
- return pd.NaT
54
-
55
-
56
- GoodFridayUnlessChristmasNYEFriday = Holiday(
57
- name="Good Friday CFE",
58
- month=1,
59
- day=1,
60
- observance=good_friday_unless_christmas_nye_friday,
61
- )
62
-
63
-
64
- class CFEExchangeCalendar(MarketCalendar):
65
- """
66
- Exchange calendar for the CBOE Futures Exchange (CFE).
67
-
68
- http://cfe.cboe.com/aboutcfe/expirationcalendar.aspx
69
-
70
- Open Time: 8:30am, America/Chicago
71
- Close Time: 3:15pm, America/Chicago
72
-
73
- (We are ignoring extended trading hours for now)
74
- """
75
-
76
- aliases = ["CFE", "CBOE_Futures"]
77
- regular_market_times = {
78
- "market_open": ((None, time(8, 30)),),
79
- "market_close": ((None, time(15, 15)),),
80
- }
81
-
82
- @property
83
- def name(self):
84
- return "CFE"
85
-
86
- @property
87
- def full_name(self):
88
- return "CBOE Futures Exchange"
89
-
90
- @property
91
- def tz(self):
92
- return ZoneInfo("America/Chicago")
93
-
94
- @property
95
- def regular_holidays(self):
96
- return AbstractHolidayCalendar(
97
- rules=[
98
- USNewYearsDay,
99
- USMartinLutherKingJrAfter1998,
100
- USPresidentsDay,
101
- GoodFridayUnlessChristmasNYEFriday,
102
- USJuneteenthAfter2022,
103
- USIndependenceDay,
104
- USMemorialDay,
105
- USLaborDay,
106
- USThanksgivingDay,
107
- Christmas,
108
- ]
109
- )
110
-
111
- @property
112
- def special_closes(self):
113
- return [
114
- (
115
- time(12, 15),
116
- AbstractHolidayCalendar(
117
- rules=[
118
- USBlackFridayInOrAfter1993,
119
- ]
120
- ),
121
- )
122
- ]
123
-
124
- @property
125
- def adhoc_holidays(self):
126
- return list(
127
- chain(
128
- HurricaneSandyClosings,
129
- USNationalDaysofMourning,
130
- )
131
- )
132
-
133
-
134
- class CBOEEquityOptionsExchangeCalendar(CFEExchangeCalendar):
135
- name = "CBOE_Equity_Options"
136
- aliases = [name]
137
- regular_market_times = {
138
- "market_open": ((None, time(8, 30)),),
139
- "market_close": ((None, time(15)),),
140
- }
141
-
142
-
143
- class CBOEIndexOptionsExchangeCalendar(CFEExchangeCalendar):
144
- name = "CBOE_Index_Options"
145
- aliases = [name]
146
- regular_market_times = {
147
- "market_open": ((None, time(8, 30)),),
148
- "market_close": ((None, time(15, 15)),),
149
- }
1
+ from datetime import time
2
+ from itertools import chain
3
+
4
+ import pandas as pd
5
+ from pandas.tseries.holiday import (
6
+ AbstractHolidayCalendar,
7
+ GoodFriday,
8
+ USLaborDay,
9
+ USPresidentsDay,
10
+ USThanksgivingDay,
11
+ Holiday,
12
+ )
13
+ import sys
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
+ USBlackFridayInOrAfter1993,
25
+ USIndependenceDay,
26
+ USMartinLutherKingJrAfter1998,
27
+ USMemorialDay,
28
+ USNewYearsDay,
29
+ HurricaneSandyClosings,
30
+ USNationalDaysofMourning,
31
+ USJuneteenthAfter2022,
32
+ )
33
+ from pandas_market_calendars.market_calendar import MarketCalendar
34
+
35
+
36
+ def good_friday_unless_christmas_nye_friday(dt):
37
+ """
38
+ Good Friday is a valid trading day if Christmas Day or New Years Day fall
39
+ on a Friday.
40
+ """
41
+ if isinstance(dt, pd.DatetimeIndex):
42
+ # Pandas < 2.1.0 will call with an index and fall-back to element by element
43
+ # Pandas == 2.1.0 will only call element by element
44
+ raise NotImplementedError()
45
+
46
+ year = dt.year
47
+ christmas_weekday = Christmas.observance(
48
+ pd.Timestamp(year=year, month=12, day=25)
49
+ ).weekday()
50
+ nyd_weekday = USNewYearsDay.observance(
51
+ pd.Timestamp(year=year, month=1, day=1)
52
+ ).weekday()
53
+ if christmas_weekday != 4 and nyd_weekday != 4:
54
+ return GoodFriday.dates(
55
+ pd.Timestamp(year=year, month=1, day=1),
56
+ pd.Timestamp(year=year, month=12, day=31),
57
+ )[0]
58
+ else:
59
+ # Not a holiday so use NaT to ensure it gets removed
60
+ return pd.NaT
61
+
62
+
63
+ GoodFridayUnlessChristmasNYEFriday = Holiday(
64
+ name="Good Friday CFE",
65
+ month=1,
66
+ day=1,
67
+ observance=good_friday_unless_christmas_nye_friday,
68
+ )
69
+
70
+
71
+ class CFEExchangeCalendar(MarketCalendar):
72
+ """
73
+ Exchange calendar for the CBOE Futures Exchange (CFE).
74
+
75
+ http://cfe.cboe.com/aboutcfe/expirationcalendar.aspx
76
+
77
+ Open Time: 8:30am, America/Chicago
78
+ Close Time: 3:15pm, America/Chicago
79
+
80
+ (We are ignoring extended trading hours for now)
81
+ """
82
+
83
+ aliases = ["CFE", "CBOE_Futures"]
84
+ regular_market_times = {
85
+ "market_open": ((None, time(8, 30)),),
86
+ "market_close": ((None, time(15, 15)),),
87
+ }
88
+
89
+ @property
90
+ def name(self):
91
+ return "CFE"
92
+
93
+ @property
94
+ def full_name(self):
95
+ return "CBOE Futures Exchange"
96
+
97
+ @property
98
+ def tz(self):
99
+ return ZoneInfo("America/Chicago")
100
+
101
+ @property
102
+ def regular_holidays(self):
103
+ return AbstractHolidayCalendar(
104
+ rules=[
105
+ USNewYearsDay,
106
+ USMartinLutherKingJrAfter1998,
107
+ USPresidentsDay,
108
+ GoodFridayUnlessChristmasNYEFriday,
109
+ USJuneteenthAfter2022,
110
+ USIndependenceDay,
111
+ USMemorialDay,
112
+ USLaborDay,
113
+ USThanksgivingDay,
114
+ Christmas,
115
+ ]
116
+ )
117
+
118
+ @property
119
+ def special_closes(self):
120
+ return [
121
+ (
122
+ time(12, 15),
123
+ AbstractHolidayCalendar(
124
+ rules=[
125
+ USBlackFridayInOrAfter1993,
126
+ ]
127
+ ),
128
+ )
129
+ ]
130
+
131
+ @property
132
+ def adhoc_holidays(self):
133
+ return list(
134
+ chain(
135
+ HurricaneSandyClosings,
136
+ USNationalDaysofMourning,
137
+ )
138
+ )
139
+
140
+
141
+ class CBOEEquityOptionsExchangeCalendar(CFEExchangeCalendar):
142
+ name = "CBOE_Equity_Options"
143
+ aliases = [name]
144
+ regular_market_times = {
145
+ "market_open": ((None, time(8, 30)),),
146
+ "market_close": ((None, time(15)),),
147
+ }
148
+
149
+
150
+ class CBOEIndexOptionsExchangeCalendar(CFEExchangeCalendar):
151
+ name = "CBOE_Index_Options"
152
+ aliases = [name]
153
+ regular_market_times = {
154
+ "market_open": ((None, time(8, 30)),),
155
+ "market_close": ((None, time(15, 15)),),
156
+ }