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,144 +1,144 @@
1
- """
2
- Imported calendars from the exchange_calendars project
3
-
4
- GitHub: https://github.com/gerrymanoim/exchange_calendars
5
- """
6
-
7
- import exchange_calendars
8
-
9
- from pandas_market_calendars.market_calendar import MarketCalendar
10
-
11
- DAYMASKS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
12
-
13
-
14
- class TradingCalendar(MarketCalendar):
15
- """
16
- This class provides access to all the information on opens, breaks and closes that are available
17
- in the exchange_calendars package, it will receive the correctly formatted regular_market_times
18
- dictionary in the for-loop below.
19
-
20
- The initialization of calendars from exchange_calendars, is bypassed until the `.ec` property is used,
21
- which returns the initialized exchange_calendar calendar, which is only initialized the first time.
22
- """
23
-
24
- # flag indicating that offset still needs to be checked.
25
- # A class attribute so we only do this once per class and not per instance
26
- _FINALIZE_TRADING_CALENDAR = True
27
-
28
- def __new__(cls, *args, **kwargs):
29
- self = super().__new__(cls)
30
- self._ec = super().__new__(cls._ec_class)
31
- # flag indicating that mirrored class is not initialized yet, which we only want to do
32
- # once per instance, if and only if the public `.ec` property is used.
33
- self._EC_NOT_INITIALIZED = True
34
-
35
- # offsets of exchange_calendar_mirrors are only available through the instance
36
- if cls._FINALIZE_TRADING_CALENDAR:
37
- if self._ec.open_offset:
38
- cls.regular_market_times._set(
39
- "market_open",
40
- tuple(
41
- (t[0], t[1], self._ec.open_offset)
42
- for t in cls.regular_market_times["market_open"]
43
- ),
44
- )
45
-
46
- if self._ec.close_offset:
47
- cls.regular_market_times._set(
48
- "market_close",
49
- tuple((t[0], t[1], self._ec.close_offset) for t in cls.regular_market_times["market_close"]),
50
- )
51
- cls._FINALIZE_TRADING_CALENDAR = False
52
-
53
- self.__init__(*args, **kwargs)
54
- return self
55
-
56
- def __init__(self, open_time=None, close_time=None):
57
- super().__init__(open_time, close_time)
58
-
59
- @property
60
- def ec(self):
61
- if self._EC_NOT_INITIALIZED:
62
- self._ec.__init__()
63
- self._EC_NOT_INITIALIZED = False
64
-
65
- return self._ec
66
-
67
- @property
68
- def name(self):
69
- return self._ec.name
70
-
71
- @property
72
- def full_name(self):
73
- return self._ec.name
74
-
75
- @property
76
- def tz(self):
77
- return self._ec.tz
78
-
79
- @property
80
- def regular_holidays(self):
81
- return self._ec.regular_holidays
82
-
83
- @property
84
- def adhoc_holidays(self):
85
- return self._ec.adhoc_holidays
86
-
87
- @property
88
- def special_opens(self):
89
- return self._ec.special_opens
90
-
91
- @property
92
- def special_opens_adhoc(self):
93
- return self._ec.special_opens_adhoc
94
-
95
- @property
96
- def special_closes(self):
97
- return self._ec.special_closes
98
-
99
- @property
100
- def special_closes_adhoc(self):
101
- return self._ec.special_closes_adhoc
102
-
103
- @property
104
- def weekmask(self):
105
- if hasattr(self._ec, "weekmask"):
106
- if "1" in self._ec.weekmask or "0" in self._ec.weekmask:
107
- # Convert 1s & 0s to Day Abbreviations
108
- return " ".join([DAYMASKS[i] for i, val in enumerate(self._ec.weekmask) if val == "1"])
109
- else:
110
- return self._ec.weekmask
111
- else:
112
- return "Mon Tue Wed Thu Fri"
113
-
114
-
115
- calendars = exchange_calendars.calendar_utils._default_calendar_factories # noqa
116
-
117
- time_props = dict(
118
- open_times="market_open",
119
- close_times="market_close",
120
- break_start_times="break_start",
121
- break_end_times="break_end",
122
- )
123
-
124
- for exchange in calendars:
125
- cal = calendars[exchange]
126
-
127
- # this loop will set up the newly required regular_market_times dictionary
128
- regular_market_times = {}
129
- for prop, new in time_props.items():
130
- times = getattr(cal, prop)
131
- if times is None or isinstance(times, property):
132
- continue
133
- regular_market_times[new] = times
134
-
135
- cal = type(
136
- exchange,
137
- (TradingCalendar,),
138
- {
139
- "_ec_class": calendars[exchange],
140
- "alias": [exchange],
141
- "regular_market_times": regular_market_times,
142
- },
143
- )
144
- locals()[f"{exchange}ExchangeCalendar"] = cal
1
+ """
2
+ Imported calendars from the exchange_calendars project
3
+
4
+ GitHub: https://github.com/gerrymanoim/exchange_calendars
5
+ """
6
+
7
+ import exchange_calendars
8
+
9
+ from pandas_market_calendars.market_calendar import MarketCalendar
10
+
11
+ DAYMASKS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
12
+
13
+
14
+ class TradingCalendar(MarketCalendar):
15
+ """
16
+ This class provides access to all the information on opens, breaks and closes that are available
17
+ in the exchange_calendars package, it will receive the correctly formatted regular_market_times
18
+ dictionary in the for-loop below.
19
+
20
+ The initialization of calendars from exchange_calendars, is bypassed until the `.ec` property is used,
21
+ which returns the initialized exchange_calendar calendar, which is only initialized the first time.
22
+ """
23
+
24
+ # flag indicating that offset still needs to be checked.
25
+ # A class attribute so we only do this once per class and not per instance
26
+ _FINALIZE_TRADING_CALENDAR = True
27
+
28
+ def __new__(cls, *args, **kwargs):
29
+ self = super().__new__(cls)
30
+ self._ec = super().__new__(cls._ec_class)
31
+ # flag indicating that mirrored class is not initialized yet, which we only want to do
32
+ # once per instance, if and only if the public `.ec` property is used.
33
+ self._EC_NOT_INITIALIZED = True
34
+
35
+ # offsets of exchange_calendar_mirrors are only available through the instance
36
+ if cls._FINALIZE_TRADING_CALENDAR:
37
+ if self._ec.open_offset:
38
+ cls.regular_market_times._set(
39
+ "market_open",
40
+ tuple(
41
+ (t[0], t[1], self._ec.open_offset)
42
+ for t in cls.regular_market_times["market_open"]
43
+ ),
44
+ )
45
+
46
+ if self._ec.close_offset:
47
+ cls.regular_market_times._set(
48
+ "market_close",
49
+ tuple((t[0], t[1], self._ec.close_offset) for t in cls.regular_market_times["market_close"]),
50
+ )
51
+ cls._FINALIZE_TRADING_CALENDAR = False
52
+
53
+ self.__init__(*args, **kwargs)
54
+ return self
55
+
56
+ def __init__(self, open_time=None, close_time=None):
57
+ super().__init__(open_time, close_time)
58
+
59
+ @property
60
+ def ec(self):
61
+ if self._EC_NOT_INITIALIZED:
62
+ self._ec.__init__()
63
+ self._EC_NOT_INITIALIZED = False
64
+
65
+ return self._ec
66
+
67
+ @property
68
+ def name(self):
69
+ return self._ec.name
70
+
71
+ @property
72
+ def full_name(self):
73
+ return self._ec.name
74
+
75
+ @property
76
+ def tz(self):
77
+ return self._ec.tz
78
+
79
+ @property
80
+ def regular_holidays(self):
81
+ return self._ec.regular_holidays
82
+
83
+ @property
84
+ def adhoc_holidays(self):
85
+ return self._ec.adhoc_holidays
86
+
87
+ @property
88
+ def special_opens(self):
89
+ return self._ec.special_opens
90
+
91
+ @property
92
+ def special_opens_adhoc(self):
93
+ return self._ec.special_opens_adhoc
94
+
95
+ @property
96
+ def special_closes(self):
97
+ return self._ec.special_closes
98
+
99
+ @property
100
+ def special_closes_adhoc(self):
101
+ return self._ec.special_closes_adhoc
102
+
103
+ @property
104
+ def weekmask(self):
105
+ if hasattr(self._ec, "weekmask"):
106
+ if "1" in self._ec.weekmask or "0" in self._ec.weekmask:
107
+ # Convert 1s & 0s to Day Abbreviations
108
+ return " ".join([DAYMASKS[i] for i, val in enumerate(self._ec.weekmask) if val == "1"])
109
+ else:
110
+ return self._ec.weekmask
111
+ else:
112
+ return "Mon Tue Wed Thu Fri"
113
+
114
+
115
+ calendars = exchange_calendars.calendar_utils._default_calendar_factories # noqa
116
+
117
+ time_props = dict(
118
+ open_times="market_open",
119
+ close_times="market_close",
120
+ break_start_times="break_start",
121
+ break_end_times="break_end",
122
+ )
123
+
124
+ for exchange in calendars:
125
+ cal = calendars[exchange]
126
+
127
+ # this loop will set up the newly required regular_market_times dictionary
128
+ regular_market_times = {}
129
+ for prop, new in time_props.items():
130
+ times = getattr(cal, prop)
131
+ if times is None or isinstance(times, property):
132
+ continue
133
+ regular_market_times[new] = times
134
+
135
+ cal = type(
136
+ exchange,
137
+ (TradingCalendar,),
138
+ {
139
+ "_ec_class": calendars[exchange],
140
+ "alias": [exchange],
141
+ "regular_market_times": regular_market_times,
142
+ },
143
+ )
144
+ locals()[f"{exchange}ExchangeCalendar"] = cal