pandas-market-calendars 4.3.2__py3-none-any.whl → 4.3.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 (46) hide show
  1. pandas_market_calendars/__init__.py +38 -38
  2. pandas_market_calendars/calendar_registry.py +53 -52
  3. pandas_market_calendars/calendar_utils.py +261 -261
  4. pandas_market_calendars/calendars/asx.py +66 -66
  5. pandas_market_calendars/calendars/bmf.py +206 -206
  6. pandas_market_calendars/calendars/bse.py +407 -407
  7. pandas_market_calendars/calendars/cboe.py +145 -145
  8. pandas_market_calendars/calendars/cme.py +402 -402
  9. pandas_market_calendars/calendars/cme_globex_agriculture.py +126 -127
  10. pandas_market_calendars/calendars/cme_globex_base.py +119 -119
  11. pandas_market_calendars/calendars/cme_globex_crypto.py +160 -147
  12. pandas_market_calendars/calendars/cme_globex_energy_and_metals.py +216 -216
  13. pandas_market_calendars/calendars/cme_globex_equities.py +123 -121
  14. pandas_market_calendars/calendars/cme_globex_fixed_income.py +136 -134
  15. pandas_market_calendars/calendars/cme_globex_fx.py +101 -92
  16. pandas_market_calendars/calendars/eurex.py +139 -139
  17. pandas_market_calendars/calendars/eurex_fixed_income.py +98 -0
  18. pandas_market_calendars/calendars/hkex.py +426 -426
  19. pandas_market_calendars/calendars/ice.py +81 -81
  20. pandas_market_calendars/calendars/iex.py +112 -111
  21. pandas_market_calendars/calendars/jpx.py +109 -109
  22. pandas_market_calendars/calendars/lse.py +114 -114
  23. pandas_market_calendars/calendars/mirror.py +130 -129
  24. pandas_market_calendars/calendars/nyse.py +1324 -1324
  25. pandas_market_calendars/calendars/ose.py +116 -116
  26. pandas_market_calendars/calendars/sifma.py +350 -335
  27. pandas_market_calendars/calendars/six.py +132 -132
  28. pandas_market_calendars/calendars/sse.py +311 -311
  29. pandas_market_calendars/calendars/tase.py +197 -195
  30. pandas_market_calendars/calendars/tsx.py +181 -181
  31. pandas_market_calendars/holidays/cme.py +385 -372
  32. pandas_market_calendars/holidays/cme_globex.py +214 -223
  33. pandas_market_calendars/holidays/cn.py +1455 -1455
  34. pandas_market_calendars/holidays/jp.py +398 -394
  35. pandas_market_calendars/holidays/nyse.py +1531 -1539
  36. pandas_market_calendars/holidays/oz.py +63 -65
  37. pandas_market_calendars/holidays/sifma.py +338 -350
  38. pandas_market_calendars/holidays/us.py +376 -377
  39. pandas_market_calendars/market_calendar.py +895 -895
  40. {pandas_market_calendars-4.3.2.dist-info → pandas_market_calendars-4.3.3.dist-info}/METADATA +3 -3
  41. pandas_market_calendars-4.3.3.dist-info/RECORD +50 -0
  42. pandas_market_calendars-4.3.2.dist-info/RECORD +0 -49
  43. {pandas_market_calendars-4.3.2.dist-info → pandas_market_calendars-4.3.3.dist-info}/LICENSE +0 -0
  44. {pandas_market_calendars-4.3.2.dist-info → pandas_market_calendars-4.3.3.dist-info}/NOTICE +0 -0
  45. {pandas_market_calendars-4.3.2.dist-info → pandas_market_calendars-4.3.3.dist-info}/WHEEL +0 -0
  46. {pandas_market_calendars-4.3.2.dist-info → pandas_market_calendars-4.3.3.dist-info}/top_level.txt +0 -0
@@ -1,145 +1,145 @@
1
- from datetime import time
2
-
3
- from pandas.tseries.holiday import (
4
- AbstractHolidayCalendar,
5
- GoodFriday,
6
- USLaborDay,
7
- USPresidentsDay,
8
- USThanksgivingDay,
9
- Holiday,
10
- )
11
- from pytz import timezone
12
- from itertools import chain
13
- import pandas as pd
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 tz(self):
88
- return timezone("America/Chicago")
89
-
90
- @property
91
- def regular_holidays(self):
92
- return AbstractHolidayCalendar(
93
- rules=[
94
- USNewYearsDay,
95
- USMartinLutherKingJrAfter1998,
96
- USPresidentsDay,
97
- GoodFridayUnlessChristmasNYEFriday,
98
- USJuneteenthAfter2022,
99
- USIndependenceDay,
100
- USMemorialDay,
101
- USLaborDay,
102
- USThanksgivingDay,
103
- Christmas,
104
- ]
105
- )
106
-
107
- @property
108
- def special_closes(self):
109
- return [
110
- (
111
- time(12, 15),
112
- AbstractHolidayCalendar(
113
- rules=[
114
- USBlackFridayInOrAfter1993,
115
- ]
116
- ),
117
- )
118
- ]
119
-
120
- @property
121
- def adhoc_holidays(self):
122
- return list(
123
- chain(
124
- HurricaneSandyClosings,
125
- USNationalDaysofMourning,
126
- )
127
- )
128
-
129
-
130
- class CBOEEquityOptionsExchangeCalendar(CFEExchangeCalendar):
131
- name = "CBOE_Equity_Options"
132
- aliases = [name]
133
- regular_market_times = {
134
- "market_open": ((None, time(8, 30)),),
135
- "market_close": ((None, time(15)),),
136
- }
137
-
138
-
139
- class CBOEIndexOptionsExchangeCalendar(CFEExchangeCalendar):
140
- name = "CBOE_Index_Options"
141
- aliases = [name]
142
- regular_market_times = {
143
- "market_open": ((None, time(8, 30)),),
144
- "market_close": ((None, time(15, 15)),),
145
- }
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 pytz import timezone
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 tz(self):
88
+ return timezone("America/Chicago")
89
+
90
+ @property
91
+ def regular_holidays(self):
92
+ return AbstractHolidayCalendar(
93
+ rules=[
94
+ USNewYearsDay,
95
+ USMartinLutherKingJrAfter1998,
96
+ USPresidentsDay,
97
+ GoodFridayUnlessChristmasNYEFriday,
98
+ USJuneteenthAfter2022,
99
+ USIndependenceDay,
100
+ USMemorialDay,
101
+ USLaborDay,
102
+ USThanksgivingDay,
103
+ Christmas,
104
+ ]
105
+ )
106
+
107
+ @property
108
+ def special_closes(self):
109
+ return [
110
+ (
111
+ time(12, 15),
112
+ AbstractHolidayCalendar(
113
+ rules=[
114
+ USBlackFridayInOrAfter1993,
115
+ ]
116
+ ),
117
+ )
118
+ ]
119
+
120
+ @property
121
+ def adhoc_holidays(self):
122
+ return list(
123
+ chain(
124
+ HurricaneSandyClosings,
125
+ USNationalDaysofMourning,
126
+ )
127
+ )
128
+
129
+
130
+ class CBOEEquityOptionsExchangeCalendar(CFEExchangeCalendar):
131
+ name = "CBOE_Equity_Options"
132
+ aliases = [name]
133
+ regular_market_times = {
134
+ "market_open": ((None, time(8, 30)),),
135
+ "market_close": ((None, time(15)),),
136
+ }
137
+
138
+
139
+ class CBOEIndexOptionsExchangeCalendar(CFEExchangeCalendar):
140
+ name = "CBOE_Index_Options"
141
+ aliases = [name]
142
+ regular_market_times = {
143
+ "market_open": ((None, time(8, 30)),),
144
+ "market_close": ((None, time(15, 15)),),
145
+ }