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