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.
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 -1147
  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 -356
  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.0.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.0.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/WHEEL +1 -1
  45. pandas_market_calendars-5.0.0.dist-info/RECORD +0 -50
  46. {pandas_market_calendars-5.0.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/licenses/LICENSE +0 -0
  47. {pandas_market_calendars-5.0.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/licenses/NOTICE +0 -0
  48. {pandas_market_calendars-5.0.0.dist-info → pandas_market_calendars-5.1.1.dist-info}/top_level.txt +0 -0
@@ -1,158 +1,165 @@
1
- import datetime as dt
2
-
3
- from zoneinfo import ZoneInfo
4
- from pandas.tseries.holiday import AbstractHolidayCalendar
5
-
6
- from pandas_market_calendars.holidays.cme import (
7
- GoodFriday2021,
8
- GoodFriday2022,
9
- GoodFridayAfter2022,
10
- GoodFridayBefore2021,
11
- USIndependenceDayBefore2022PreviousDay,
12
- )
13
- from pandas_market_calendars.holidays.cme_globex import (
14
- ChristmasCME,
15
- USMartinLutherKingJrFrom2022,
16
- USMartinLutherKingJrPre2022,
17
- USPresidentsDayFrom2022,
18
- USPresidentsDayPre2022,
19
- USMemorialDayFrom2022,
20
- USMemorialDayPre2022,
21
- USJuneteenthFrom2022,
22
- USIndependenceDayFrom2022,
23
- USIndependenceDayPre2022,
24
- USLaborDayFrom2022,
25
- USLaborDayPre2022,
26
- USThanksgivingDayFrom2022,
27
- USThanksgivingDayPre2022,
28
- USThanksgivingFridayFrom2021,
29
- USThanksgivingFridayPre2021,
30
- )
31
- from pandas_market_calendars.holidays.us import (
32
- ChristmasEveInOrAfter1993,
33
- USNewYearsDay,
34
- )
35
- from .cme_globex_base import CMEGlobexBaseExchangeCalendar
36
-
37
-
38
- # https://github.com/rsheftel/pandas_market_calendars/blob/master/docs/new_market.rst
39
- class CMEGlobexCryptoExchangeCalendar(CMEGlobexBaseExchangeCalendar):
40
- # The label you fetch the exchange with in mcal.get_calendar('CME Globex ...')
41
- aliases = ["CME Globex Cryptocurrencies", "CME Globex Crypto"]
42
-
43
- # https://www.cmegroup.com/markets/cryptocurrencies/bitcoin/bitcoin.contractSpecs.html
44
- regular_market_times = {
45
- # Tuple[Tuple[first date used, time, offset], ...]
46
- # -1 offset indicates that the open is on the previous day
47
- # None for first date used marks the start, subsequent market times must have an actual timestamp
48
- "market_open": ((None, dt.time(17, tzinfo=ZoneInfo("America/Chicago")), -1),),
49
- "market_close": (
50
- (
51
- None,
52
- dt.time(16, tzinfo=ZoneInfo("America/Chicago")),
53
- ),
54
- ),
55
- "break_start": (
56
- (
57
- None,
58
- dt.time(16, tzinfo=ZoneInfo("America/Chicago")),
59
- ),
60
- ),
61
- "break_end": (
62
- (
63
- None,
64
- dt.time(17, tzinfo=ZoneInfo("America/Chicago")),
65
- ),
66
- ),
67
- }
68
-
69
- @property
70
- def tz(self):
71
- # Central Time
72
- return ZoneInfo("America/Chicago")
73
-
74
- @property
75
- def name(self):
76
- return "CME Globex Crypto"
77
-
78
- # Check the .zip files at the bottom of this page
79
- # https://www.cmegroup.com/tools-information/holiday-calendar.html?redirect=/tools-information/holiday-calendar/#cmeGlobex
80
- # Note: many of the holiday objects (ie. GoodFridayBefore2021) were originally made for equities and other markets
81
- # and hence have a start_date starting before crypto is actually available
82
-
83
- @property
84
- def regular_holidays(self):
85
- # Days where the market is fully closed
86
- return AbstractHolidayCalendar(
87
- rules=[
88
- GoodFridayBefore2021,
89
- GoodFriday2022,
90
- ChristmasCME,
91
- USNewYearsDay,
92
- ]
93
- )
94
-
95
- @property
96
- def special_closes(self):
97
- # Days where the market closes early
98
- # list[Tuple[time, AbstractHolidayCalendar]]
99
- return [
100
- (
101
- dt.time(8, 15, tzinfo=ZoneInfo("America/Chicago")),
102
- AbstractHolidayCalendar(
103
- rules=[
104
- GoodFriday2021,
105
- ]
106
- ),
107
- ),
108
- (
109
- dt.time(10, 15, tzinfo=ZoneInfo("America/Chicago")),
110
- AbstractHolidayCalendar(
111
- rules=[
112
- GoodFridayAfter2022,
113
- ]
114
- ),
115
- ),
116
- (
117
- dt.time(12, tzinfo=ZoneInfo("America/Chicago")),
118
- AbstractHolidayCalendar(
119
- rules=[
120
- USMartinLutherKingJrPre2022,
121
- USPresidentsDayPre2022,
122
- USMemorialDayPre2022,
123
- USIndependenceDayPre2022,
124
- USLaborDayPre2022,
125
- USThanksgivingDayPre2022,
126
- ]
127
- ),
128
- ),
129
- (
130
- dt.time(12, 15, tzinfo=ZoneInfo("America/Chicago")),
131
- AbstractHolidayCalendar(
132
- rules=[
133
- ChristmasEveInOrAfter1993,
134
- USIndependenceDayBefore2022PreviousDay,
135
- USThanksgivingFridayPre2021,
136
- ]
137
- ),
138
- ),
139
- (
140
- dt.time(12, 45, tzinfo=ZoneInfo("America/Chicago")),
141
- AbstractHolidayCalendar(rules=[USThanksgivingFridayFrom2021]),
142
- ),
143
- # TODO: this market already closes at 1600 normally, do we need these holidays?
144
- (
145
- dt.time(16, tzinfo=ZoneInfo("America/Chicago")),
146
- AbstractHolidayCalendar(
147
- rules=[
148
- USMartinLutherKingJrFrom2022,
149
- USPresidentsDayFrom2022,
150
- USMemorialDayFrom2022,
151
- USJuneteenthFrom2022,
152
- USIndependenceDayFrom2022,
153
- USLaborDayFrom2022,
154
- USThanksgivingDayFrom2022,
155
- ]
156
- ),
157
- ),
158
- ]
1
+ import datetime as dt
2
+
3
+ import sys
4
+ # check python versiOn aNd import accordingly
5
+ if sys.version_info >= (3, 9):
6
+ # For Python 3.9 and later, import directly
7
+ from zoneinfo import ZoneInfo
8
+ else:
9
+ # For Python 3.8 and earlier, import from backports
10
+ from backports.zoneinfo import ZoneInfo
11
+ from pandas.tseries.holiday import AbstractHolidayCalendar
12
+
13
+ from pandas_market_calendars.holidays.cme import (
14
+ GoodFriday2021,
15
+ GoodFriday2022,
16
+ GoodFridayAfter2022,
17
+ GoodFridayBefore2021,
18
+ USIndependenceDayBefore2022PreviousDay,
19
+ )
20
+ from pandas_market_calendars.holidays.cme_globex import (
21
+ ChristmasCME,
22
+ USMartinLutherKingJrFrom2022,
23
+ USMartinLutherKingJrPre2022,
24
+ USPresidentsDayFrom2022,
25
+ USPresidentsDayPre2022,
26
+ USMemorialDayFrom2022,
27
+ USMemorialDayPre2022,
28
+ USJuneteenthFrom2022,
29
+ USIndependenceDayFrom2022,
30
+ USIndependenceDayPre2022,
31
+ USLaborDayFrom2022,
32
+ USLaborDayPre2022,
33
+ USThanksgivingDayFrom2022,
34
+ USThanksgivingDayPre2022,
35
+ USThanksgivingFridayFrom2021,
36
+ USThanksgivingFridayPre2021,
37
+ )
38
+ from pandas_market_calendars.holidays.us import (
39
+ ChristmasEveInOrAfter1993,
40
+ USNewYearsDay,
41
+ )
42
+ from .cme_globex_base import CMEGlobexBaseExchangeCalendar
43
+
44
+
45
+ # https://github.com/rsheftel/pandas_market_calendars/blob/master/docs/new_market.rst
46
+ class CMEGlobexCryptoExchangeCalendar(CMEGlobexBaseExchangeCalendar):
47
+ # The label you fetch the exchange with in mcal.get_calendar('CME Globex ...')
48
+ aliases = ["CME Globex Cryptocurrencies", "CME Globex Crypto"]
49
+
50
+ # https://www.cmegroup.com/markets/cryptocurrencies/bitcoin/bitcoin.contractSpecs.html
51
+ regular_market_times = {
52
+ # Tuple[Tuple[first date used, time, offset], ...]
53
+ # -1 offset indicates that the open is on the previous day
54
+ # None for first date used marks the start, subsequent market times must have an actual timestamp
55
+ "market_open": ((None, dt.time(17, tzinfo=ZoneInfo("America/Chicago")), -1),),
56
+ "market_close": (
57
+ (
58
+ None,
59
+ dt.time(16, tzinfo=ZoneInfo("America/Chicago")),
60
+ ),
61
+ ),
62
+ "break_start": (
63
+ (
64
+ None,
65
+ dt.time(16, tzinfo=ZoneInfo("America/Chicago")),
66
+ ),
67
+ ),
68
+ "break_end": (
69
+ (
70
+ None,
71
+ dt.time(17, tzinfo=ZoneInfo("America/Chicago")),
72
+ ),
73
+ ),
74
+ }
75
+
76
+ @property
77
+ def tz(self):
78
+ # Central Time
79
+ return ZoneInfo("America/Chicago")
80
+
81
+ @property
82
+ def name(self):
83
+ return "CME Globex Crypto"
84
+
85
+ # Check the .zip files at the bottom of this page
86
+ # https://www.cmegroup.com/tools-information/holiday-calendar.html?redirect=/tools-information/holiday-calendar/#cmeGlobex
87
+ # Note: many of the holiday objects (ie. GoodFridayBefore2021) were originally made for equities and other markets
88
+ # and hence have a start_date starting before crypto is actually available
89
+
90
+ @property
91
+ def regular_holidays(self):
92
+ # Days where the market is fully closed
93
+ return AbstractHolidayCalendar(
94
+ rules=[
95
+ GoodFridayBefore2021,
96
+ GoodFriday2022,
97
+ ChristmasCME,
98
+ USNewYearsDay,
99
+ ]
100
+ )
101
+
102
+ @property
103
+ def special_closes(self):
104
+ # Days where the market closes early
105
+ # list[Tuple[time, AbstractHolidayCalendar]]
106
+ return [
107
+ (
108
+ dt.time(8, 15, tzinfo=ZoneInfo("America/Chicago")),
109
+ AbstractHolidayCalendar(
110
+ rules=[
111
+ GoodFriday2021,
112
+ ]
113
+ ),
114
+ ),
115
+ (
116
+ dt.time(10, 15, tzinfo=ZoneInfo("America/Chicago")),
117
+ AbstractHolidayCalendar(
118
+ rules=[
119
+ GoodFridayAfter2022,
120
+ ]
121
+ ),
122
+ ),
123
+ (
124
+ dt.time(12, tzinfo=ZoneInfo("America/Chicago")),
125
+ AbstractHolidayCalendar(
126
+ rules=[
127
+ USMartinLutherKingJrPre2022,
128
+ USPresidentsDayPre2022,
129
+ USMemorialDayPre2022,
130
+ USIndependenceDayPre2022,
131
+ USLaborDayPre2022,
132
+ USThanksgivingDayPre2022,
133
+ ]
134
+ ),
135
+ ),
136
+ (
137
+ dt.time(12, 15, tzinfo=ZoneInfo("America/Chicago")),
138
+ AbstractHolidayCalendar(
139
+ rules=[
140
+ ChristmasEveInOrAfter1993,
141
+ USIndependenceDayBefore2022PreviousDay,
142
+ USThanksgivingFridayPre2021,
143
+ ]
144
+ ),
145
+ ),
146
+ (
147
+ dt.time(12, 45, tzinfo=ZoneInfo("America/Chicago")),
148
+ AbstractHolidayCalendar(rules=[USThanksgivingFridayFrom2021]),
149
+ ),
150
+ # TODO: this market already closes at 1600 normally, do we need these holidays?
151
+ (
152
+ dt.time(16, tzinfo=ZoneInfo("America/Chicago")),
153
+ AbstractHolidayCalendar(
154
+ rules=[
155
+ USMartinLutherKingJrFrom2022,
156
+ USPresidentsDayFrom2022,
157
+ USMemorialDayFrom2022,
158
+ USJuneteenthFrom2022,
159
+ USIndependenceDayFrom2022,
160
+ USLaborDayFrom2022,
161
+ USThanksgivingDayFrom2022,
162
+ ]
163
+ ),
164
+ ),
165
+ ]