pandas-market-calendars 4.3.1__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 (49) hide show
  1. pandas_market_calendars/__init__.py +38 -37
  2. pandas_market_calendars/calendar_registry.py +53 -48
  3. pandas_market_calendars/calendar_utils.py +261 -225
  4. pandas_market_calendars/calendars/asx.py +66 -63
  5. pandas_market_calendars/calendars/bmf.py +206 -227
  6. pandas_market_calendars/calendars/bse.py +407 -409
  7. pandas_market_calendars/calendars/cboe.py +145 -115
  8. pandas_market_calendars/calendars/cme.py +402 -240
  9. pandas_market_calendars/calendars/cme_globex_agriculture.py +126 -103
  10. pandas_market_calendars/calendars/cme_globex_base.py +119 -103
  11. pandas_market_calendars/calendars/cme_globex_crypto.py +160 -147
  12. pandas_market_calendars/calendars/cme_globex_energy_and_metals.py +216 -138
  13. pandas_market_calendars/calendars/cme_globex_equities.py +123 -104
  14. pandas_market_calendars/calendars/cme_globex_fixed_income.py +136 -113
  15. pandas_market_calendars/calendars/cme_globex_fx.py +101 -78
  16. pandas_market_calendars/calendars/eurex.py +139 -119
  17. pandas_market_calendars/calendars/eurex_fixed_income.py +98 -0
  18. pandas_market_calendars/calendars/hkex.py +426 -408
  19. pandas_market_calendars/calendars/ice.py +81 -65
  20. pandas_market_calendars/calendars/iex.py +112 -98
  21. pandas_market_calendars/calendars/jpx.py +109 -103
  22. pandas_market_calendars/calendars/lse.py +114 -91
  23. pandas_market_calendars/calendars/mirror.py +130 -114
  24. pandas_market_calendars/calendars/nyse.py +1324 -1127
  25. pandas_market_calendars/calendars/ose.py +116 -150
  26. pandas_market_calendars/calendars/sifma.py +350 -297
  27. pandas_market_calendars/calendars/six.py +132 -114
  28. pandas_market_calendars/calendars/sse.py +311 -290
  29. pandas_market_calendars/calendars/tase.py +197 -195
  30. pandas_market_calendars/calendars/tsx.py +181 -159
  31. pandas_market_calendars/class_registry.py +22 -16
  32. pandas_market_calendars/holidays/cme.py +385 -340
  33. pandas_market_calendars/holidays/cme_globex.py +214 -198
  34. pandas_market_calendars/holidays/cn.py +1455 -1436
  35. pandas_market_calendars/holidays/jp.py +398 -396
  36. pandas_market_calendars/holidays/jpx_equinox.py +453 -95
  37. pandas_market_calendars/holidays/nyse.py +1531 -1472
  38. pandas_market_calendars/holidays/oz.py +63 -65
  39. pandas_market_calendars/holidays/sifma.py +338 -321
  40. pandas_market_calendars/holidays/uk.py +32 -26
  41. pandas_market_calendars/holidays/us.py +376 -360
  42. pandas_market_calendars/market_calendar.py +895 -789
  43. {pandas_market_calendars-4.3.1.dist-info → pandas_market_calendars-4.3.3.dist-info}/METADATA +7 -5
  44. pandas_market_calendars-4.3.3.dist-info/RECORD +50 -0
  45. {pandas_market_calendars-4.3.1.dist-info → pandas_market_calendars-4.3.3.dist-info}/WHEEL +1 -1
  46. pandas_market_calendars-4.3.1.dist-info/RECORD +0 -49
  47. {pandas_market_calendars-4.3.1.dist-info → pandas_market_calendars-4.3.3.dist-info}/LICENSE +0 -0
  48. {pandas_market_calendars-4.3.1.dist-info → pandas_market_calendars-4.3.3.dist-info}/NOTICE +0 -0
  49. {pandas_market_calendars-4.3.1.dist-info → pandas_market_calendars-4.3.3.dist-info}/top_level.txt +0 -0
@@ -1,147 +1,160 @@
1
- import datetime as dt
2
-
3
- from pandas.tseries.holiday import AbstractHolidayCalendar
4
- import pytz
5
-
6
- from .cme_globex_base import CMEGlobexBaseExchangeCalendar
7
- from pandas_market_calendars.holidays.cme import (
8
- GoodFriday2021,
9
- GoodFridayAfter2021,
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
-
36
-
37
- # https://github.com/rsheftel/pandas_market_calendars/blob/master/docs/new_market.rst
38
- class CMEGlobexCryptoExchangeCalendar(CMEGlobexBaseExchangeCalendar):
39
- # The label you fetch the exchange with in mcal.get_calendar('CME Globex ...')
40
- aliases = ["CME Globex Cryptocurrencies", "CME Globex Crypto"]
41
-
42
- # https://www.cmegroup.com/markets/cryptocurrencies/bitcoin/bitcoin.contractSpecs.html
43
- regular_market_times = {
44
- # Tuple[Tuple[first date used, time, offset], ...]
45
- # -1 offset indicates that the open is on the previous day
46
- # None for first date used marks the start, subsequent market times must have an actual timestamp
47
- "market_open": (
48
- (None, dt.time(17, tzinfo=pytz.timezone("America/Chicago")), -1),
49
- ),
50
- "market_close": (
51
- (
52
- None,
53
- dt.time(16, tzinfo=pytz.timezone("America/Chicago")),
54
- ),
55
- ),
56
- "break_start": (
57
- (
58
- None,
59
- dt.time(16, tzinfo=pytz.timezone("America/Chicago")),
60
- ),
61
- ),
62
- "break_end": (
63
- (
64
- None,
65
- dt.time(17, tzinfo=pytz.timezone("America/Chicago")),
66
- ),
67
- ),
68
- }
69
-
70
- @property
71
- def tz(self):
72
- # Central Time
73
- return pytz.timezone("America/Chicago")
74
-
75
- @property
76
- def name(self):
77
- return "CME Globex Crypto"
78
-
79
- # Check the .zip files at the bottom of this page
80
- # https://www.cmegroup.com/tools-information/holiday-calendar.html?redirect=/tools-information/holiday-calendar/#cmeGlobex
81
- # Note: many of the holiday objects (ie. GoodFridayBefore2021) were originally made for equities and other markets
82
- # and hence have a start_date starting before crypto is actually available
83
-
84
- @property
85
- def regular_holidays(self):
86
- # Days where the market is fully closed
87
- return AbstractHolidayCalendar(
88
- rules=[
89
- GoodFridayBefore2021,
90
- GoodFridayAfter2021,
91
- ChristmasCME,
92
- USNewYearsDay,
93
- ]
94
- )
95
-
96
- @property
97
- def special_closes(self):
98
- # Days where the market closes early
99
- # list[Tuple[time, AbstractHolidayCalendar]]
100
- return [
101
- (
102
- dt.time(8, 15, tzinfo=pytz.timezone("America/Chicago")),
103
- AbstractHolidayCalendar(rules=[GoodFriday2021]),
104
- ),
105
- (
106
- dt.time(12, tzinfo=pytz.timezone("America/Chicago")),
107
- AbstractHolidayCalendar(
108
- rules=[
109
- USMartinLutherKingJrPre2022,
110
- USPresidentsDayPre2022,
111
- USMemorialDayPre2022,
112
- USIndependenceDayPre2022,
113
- USLaborDayPre2022,
114
- USThanksgivingDayPre2022,
115
- ]
116
- ),
117
- ),
118
- (
119
- dt.time(12, 15, tzinfo=pytz.timezone("America/Chicago")),
120
- AbstractHolidayCalendar(
121
- rules=[
122
- ChristmasEveInOrAfter1993,
123
- USIndependenceDayBefore2022PreviousDay,
124
- USThanksgivingFridayPre2021,
125
- ]
126
- ),
127
- ),
128
- (
129
- dt.time(12, 45, tzinfo=pytz.timezone("America/Chicago")),
130
- AbstractHolidayCalendar(rules=[USThanksgivingFridayFrom2021]),
131
- ),
132
- # TODO: this market already closes at 1600 normally, do we need these holidays?
133
- (
134
- dt.time(16, tzinfo=pytz.timezone("America/Chicago")),
135
- AbstractHolidayCalendar(
136
- rules=[
137
- USMartinLutherKingJrFrom2022,
138
- USPresidentsDayFrom2022,
139
- USMemorialDayFrom2022,
140
- USJuneteenthFrom2022,
141
- USIndependenceDayFrom2022,
142
- USLaborDayFrom2022,
143
- USThanksgivingDayFrom2022,
144
- ]
145
- ),
146
- ),
147
- ]
1
+ import datetime as dt
2
+
3
+ import pytz
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": (
49
+ (None, dt.time(17, tzinfo=pytz.timezone("America/Chicago")), -1),
50
+ ),
51
+ "market_close": (
52
+ (
53
+ None,
54
+ dt.time(16, tzinfo=pytz.timezone("America/Chicago")),
55
+ ),
56
+ ),
57
+ "break_start": (
58
+ (
59
+ None,
60
+ dt.time(16, tzinfo=pytz.timezone("America/Chicago")),
61
+ ),
62
+ ),
63
+ "break_end": (
64
+ (
65
+ None,
66
+ dt.time(17, tzinfo=pytz.timezone("America/Chicago")),
67
+ ),
68
+ ),
69
+ }
70
+
71
+ @property
72
+ def tz(self):
73
+ # Central Time
74
+ return pytz.timezone("America/Chicago")
75
+
76
+ @property
77
+ def name(self):
78
+ return "CME Globex Crypto"
79
+
80
+ # Check the .zip files at the bottom of this page
81
+ # https://www.cmegroup.com/tools-information/holiday-calendar.html?redirect=/tools-information/holiday-calendar/#cmeGlobex
82
+ # Note: many of the holiday objects (ie. GoodFridayBefore2021) were originally made for equities and other markets
83
+ # and hence have a start_date starting before crypto is actually available
84
+
85
+ @property
86
+ def regular_holidays(self):
87
+ # Days where the market is fully closed
88
+ return AbstractHolidayCalendar(
89
+ rules=[
90
+ GoodFridayBefore2021,
91
+ GoodFriday2022,
92
+ ChristmasCME,
93
+ USNewYearsDay,
94
+ ]
95
+ )
96
+
97
+ @property
98
+ def special_closes(self):
99
+ # Days where the market closes early
100
+ # list[Tuple[time, AbstractHolidayCalendar]]
101
+ return [
102
+ (
103
+ dt.time(8, 15, tzinfo=pytz.timezone("America/Chicago")),
104
+ AbstractHolidayCalendar(
105
+ rules=[
106
+ GoodFriday2021,
107
+ ]
108
+ ),
109
+ ),
110
+ (
111
+ dt.time(10, 15, tzinfo=pytz.timezone("America/Chicago")),
112
+ AbstractHolidayCalendar(
113
+ rules=[
114
+ GoodFridayAfter2022,
115
+ ]
116
+ ),
117
+ ),
118
+ (
119
+ dt.time(12, tzinfo=pytz.timezone("America/Chicago")),
120
+ AbstractHolidayCalendar(
121
+ rules=[
122
+ USMartinLutherKingJrPre2022,
123
+ USPresidentsDayPre2022,
124
+ USMemorialDayPre2022,
125
+ USIndependenceDayPre2022,
126
+ USLaborDayPre2022,
127
+ USThanksgivingDayPre2022,
128
+ ]
129
+ ),
130
+ ),
131
+ (
132
+ dt.time(12, 15, tzinfo=pytz.timezone("America/Chicago")),
133
+ AbstractHolidayCalendar(
134
+ rules=[
135
+ ChristmasEveInOrAfter1993,
136
+ USIndependenceDayBefore2022PreviousDay,
137
+ USThanksgivingFridayPre2021,
138
+ ]
139
+ ),
140
+ ),
141
+ (
142
+ dt.time(12, 45, tzinfo=pytz.timezone("America/Chicago")),
143
+ AbstractHolidayCalendar(rules=[USThanksgivingFridayFrom2021]),
144
+ ),
145
+ # TODO: this market already closes at 1600 normally, do we need these holidays?
146
+ (
147
+ dt.time(16, tzinfo=pytz.timezone("America/Chicago")),
148
+ AbstractHolidayCalendar(
149
+ rules=[
150
+ USMartinLutherKingJrFrom2022,
151
+ USPresidentsDayFrom2022,
152
+ USMemorialDayFrom2022,
153
+ USJuneteenthFrom2022,
154
+ USIndependenceDayFrom2022,
155
+ USLaborDayFrom2022,
156
+ USThanksgivingDayFrom2022,
157
+ ]
158
+ ),
159
+ ),
160
+ ]