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,114 +1,114 @@
1
- #
2
- # Copyright 2016 Quantopian, Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
-
16
- from datetime import time
17
-
18
- from pandas.tseries.holiday import AbstractHolidayCalendar, EasterMonday, GoodFriday
19
- from pytz import timezone
20
-
21
- from pandas_market_calendars.holidays.uk import (
22
- BoxingDay,
23
- Christmas,
24
- ChristmasEve,
25
- LSENewYearsDay,
26
- LSENewYearsEve,
27
- MayBank_pre_1995,
28
- MayBank_post_1995_pre_2020,
29
- MayBank_post_2020,
30
- SpringBank_pre_2002,
31
- SpringBank_post_2002_pre_2012,
32
- SpringBank_post_2012_pre_2022,
33
- SpringBank_post_2022,
34
- SummerBank,
35
- WeekendBoxingDay,
36
- WeekendChristmas,
37
- UniqueCloses,
38
- )
39
- from pandas_market_calendars.market_calendar import MarketCalendar
40
-
41
-
42
- class LSEExchangeCalendar(MarketCalendar):
43
- """
44
- Exchange calendar for the London Stock Exchange
45
-
46
- Open Time: 8:00 AM, GMT
47
- Close Time: 4:30 PM, GMT
48
-
49
- Regularly-Observed Holidays:
50
- - New Years Day (observed on first business day on/after)
51
- - Good Friday
52
- - Easter Monday
53
- - Early May Bank Holiday (first Monday in May)
54
- - Spring Bank Holiday (last Monday in May)
55
- - Summer Bank Holiday (last Monday in August)
56
- - Christmas Day
57
- - Dec. 27th (if Christmas is on a weekend)
58
- - Boxing Day
59
- - Dec. 28th (if Boxing Day is on a weekend)
60
- """
61
-
62
- aliases = ["LSE"]
63
- regular_market_times = {
64
- "market_open": ((None, time(8)),),
65
- "market_close": ((None, time(16, 30)),),
66
- }
67
-
68
- @property
69
- def name(self):
70
- return "LSE"
71
-
72
- @property
73
- def tz(self):
74
- return timezone("Europe/London")
75
-
76
- @property
77
- def regular_holidays(self):
78
- return AbstractHolidayCalendar(
79
- rules=[
80
- LSENewYearsDay,
81
- GoodFriday,
82
- EasterMonday,
83
- MayBank_pre_1995,
84
- MayBank_post_1995_pre_2020,
85
- MayBank_post_2020,
86
- SpringBank_pre_2002,
87
- SpringBank_post_2002_pre_2012,
88
- SpringBank_post_2012_pre_2022,
89
- SpringBank_post_2022,
90
- SummerBank,
91
- Christmas,
92
- WeekendChristmas,
93
- BoxingDay,
94
- WeekendBoxingDay,
95
- ]
96
- )
97
-
98
- @property
99
- def adhoc_holidays(self):
100
- return UniqueCloses
101
-
102
- @property
103
- def special_closes(self):
104
- return [
105
- (
106
- time(12, 30),
107
- AbstractHolidayCalendar(
108
- rules=[
109
- ChristmasEve,
110
- LSENewYearsEve,
111
- ]
112
- ),
113
- )
114
- ]
1
+ #
2
+ # Copyright 2016 Quantopian, Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ from datetime import time
17
+
18
+ from pandas.tseries.holiday import AbstractHolidayCalendar, EasterMonday, GoodFriday
19
+ from pytz import timezone
20
+
21
+ from pandas_market_calendars.holidays.uk import (
22
+ BoxingDay,
23
+ Christmas,
24
+ ChristmasEve,
25
+ LSENewYearsDay,
26
+ LSENewYearsEve,
27
+ MayBank_pre_1995,
28
+ MayBank_post_1995_pre_2020,
29
+ MayBank_post_2020,
30
+ SpringBank_pre_2002,
31
+ SpringBank_post_2002_pre_2012,
32
+ SpringBank_post_2012_pre_2022,
33
+ SpringBank_post_2022,
34
+ SummerBank,
35
+ WeekendBoxingDay,
36
+ WeekendChristmas,
37
+ UniqueCloses,
38
+ )
39
+ from pandas_market_calendars.market_calendar import MarketCalendar
40
+
41
+
42
+ class LSEExchangeCalendar(MarketCalendar):
43
+ """
44
+ Exchange calendar for the London Stock Exchange
45
+
46
+ Open Time: 8:00 AM, GMT
47
+ Close Time: 4:30 PM, GMT
48
+
49
+ Regularly-Observed Holidays:
50
+ - New Years Day (observed on first business day on/after)
51
+ - Good Friday
52
+ - Easter Monday
53
+ - Early May Bank Holiday (first Monday in May)
54
+ - Spring Bank Holiday (last Monday in May)
55
+ - Summer Bank Holiday (last Monday in August)
56
+ - Christmas Day
57
+ - Dec. 27th (if Christmas is on a weekend)
58
+ - Boxing Day
59
+ - Dec. 28th (if Boxing Day is on a weekend)
60
+ """
61
+
62
+ aliases = ["LSE"]
63
+ regular_market_times = {
64
+ "market_open": ((None, time(8)),),
65
+ "market_close": ((None, time(16, 30)),),
66
+ }
67
+
68
+ @property
69
+ def name(self):
70
+ return "LSE"
71
+
72
+ @property
73
+ def tz(self):
74
+ return timezone("Europe/London")
75
+
76
+ @property
77
+ def regular_holidays(self):
78
+ return AbstractHolidayCalendar(
79
+ rules=[
80
+ LSENewYearsDay,
81
+ GoodFriday,
82
+ EasterMonday,
83
+ MayBank_pre_1995,
84
+ MayBank_post_1995_pre_2020,
85
+ MayBank_post_2020,
86
+ SpringBank_pre_2002,
87
+ SpringBank_post_2002_pre_2012,
88
+ SpringBank_post_2012_pre_2022,
89
+ SpringBank_post_2022,
90
+ SummerBank,
91
+ Christmas,
92
+ WeekendChristmas,
93
+ BoxingDay,
94
+ WeekendBoxingDay,
95
+ ]
96
+ )
97
+
98
+ @property
99
+ def adhoc_holidays(self):
100
+ return UniqueCloses
101
+
102
+ @property
103
+ def special_closes(self):
104
+ return [
105
+ (
106
+ time(12, 30),
107
+ AbstractHolidayCalendar(
108
+ rules=[
109
+ ChristmasEve,
110
+ LSENewYearsEve,
111
+ ]
112
+ ),
113
+ )
114
+ ]
@@ -1,129 +1,130 @@
1
- """
2
- Imported calendars from the exchange_calendars project
3
-
4
- GitHub: https://github.com/gerrymanoim/exchange_calendars
5
- """
6
-
7
- from pandas_market_calendars.market_calendar import MarketCalendar
8
- import exchange_calendars
9
-
10
-
11
- class TradingCalendar(MarketCalendar):
12
- """
13
- This class provides access to all the information on opens, breaks and closes that are available
14
- in the exchange_calendars package, it will receive the correctly formatted regular_market_times
15
- dictionary in the for-loop below.
16
-
17
- The initialization of calendars from exchange_calendars, is bypassed until the `.ec` property is used,
18
- which returns the initialized exchange_calendar calendar, which is only initialized the first time.
19
- """
20
-
21
- # flag indicating that offset still needs to be checked.
22
- # A class attribute so we only do this once per class and not per instance
23
- _FINALIZE_TRADING_CALENDAR = True
24
-
25
- def __new__(cls, *args, **kwargs):
26
- self = super().__new__(cls)
27
- self._ec = super().__new__(cls._ec_class)
28
- # flag indicating that mirrored class is not initialized yet, which we only want to do
29
- # once per instance, if and only if the public `.ec` property is used.
30
- self._EC_NOT_INITIALIZED = True
31
-
32
- # offsets of exchange_calendar_mirrors are only available through the instance
33
- if cls._FINALIZE_TRADING_CALENDAR:
34
- if self._ec.open_offset:
35
- cls.regular_market_times._set(
36
- "market_open",
37
- tuple(
38
- (t[0], t[1], self._ec.open_offset)
39
- for t in cls.regular_market_times["market_open"]
40
- ),
41
- )
42
-
43
- if self._ec.close_offset:
44
- cls.regular_market_times._set(
45
- "market_close",
46
- tuple(
47
- (t[0], t[1], self._ec.close_offset)
48
- for t in cls.regular_market_times["market_close"]
49
- ),
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 tz(self):
73
- return self._ec.tz
74
-
75
- @property
76
- def regular_holidays(self):
77
- return self._ec.regular_holidays
78
-
79
- @property
80
- def adhoc_holidays(self):
81
- return self._ec.adhoc_holidays
82
-
83
- @property
84
- def special_opens(self):
85
- return self._ec.special_opens
86
-
87
- @property
88
- def special_opens_adhoc(self):
89
- return self._ec.special_opens_adhoc
90
-
91
- @property
92
- def special_closes(self):
93
- return self._ec.special_closes
94
-
95
- @property
96
- def special_closes_adhoc(self):
97
- return self._ec.special_closes_adhoc
98
-
99
-
100
- calendars = exchange_calendars.calendar_utils._default_calendar_factories # noqa
101
-
102
- time_props = dict(
103
- open_times="market_open",
104
- close_times="market_close",
105
- break_start_times="break_start",
106
- break_end_times="break_end",
107
- )
108
-
109
- for exchange in calendars:
110
- cal = calendars[exchange]
111
-
112
- # this loop will set up the newly required regular_market_times dictionary
113
- regular_market_times = {}
114
- for prop, new in time_props.items():
115
- times = getattr(cal, prop)
116
- if times is None or isinstance(times, property):
117
- continue
118
- regular_market_times[new] = times
119
-
120
- cal = type(
121
- exchange,
122
- (TradingCalendar,),
123
- {
124
- "_ec_class": calendars[exchange],
125
- "alias": [exchange],
126
- "regular_market_times": regular_market_times,
127
- },
128
- )
129
- 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
+
12
+ class TradingCalendar(MarketCalendar):
13
+ """
14
+ This class provides access to all the information on opens, breaks and closes that are available
15
+ in the exchange_calendars package, it will receive the correctly formatted regular_market_times
16
+ dictionary in the for-loop below.
17
+
18
+ The initialization of calendars from exchange_calendars, is bypassed until the `.ec` property is used,
19
+ which returns the initialized exchange_calendar calendar, which is only initialized the first time.
20
+ """
21
+
22
+ # flag indicating that offset still needs to be checked.
23
+ # A class attribute so we only do this once per class and not per instance
24
+ _FINALIZE_TRADING_CALENDAR = True
25
+
26
+ def __new__(cls, *args, **kwargs):
27
+ self = super().__new__(cls)
28
+ self._ec = super().__new__(cls._ec_class)
29
+ # flag indicating that mirrored class is not initialized yet, which we only want to do
30
+ # once per instance, if and only if the public `.ec` property is used.
31
+ self._EC_NOT_INITIALIZED = True
32
+
33
+ # offsets of exchange_calendar_mirrors are only available through the instance
34
+ if cls._FINALIZE_TRADING_CALENDAR:
35
+ if self._ec.open_offset:
36
+ cls.regular_market_times._set(
37
+ "market_open",
38
+ tuple(
39
+ (t[0], t[1], self._ec.open_offset)
40
+ for t in cls.regular_market_times["market_open"]
41
+ ),
42
+ )
43
+
44
+ if self._ec.close_offset:
45
+ cls.regular_market_times._set(
46
+ "market_close",
47
+ tuple(
48
+ (t[0], t[1], self._ec.close_offset)
49
+ for t in cls.regular_market_times["market_close"]
50
+ ),
51
+ )
52
+ cls._FINALIZE_TRADING_CALENDAR = False
53
+
54
+ self.__init__(*args, **kwargs)
55
+ return self
56
+
57
+ def __init__(self, open_time=None, close_time=None):
58
+ super().__init__(open_time, close_time)
59
+
60
+ @property
61
+ def ec(self):
62
+ if self._EC_NOT_INITIALIZED:
63
+ self._ec.__init__()
64
+ self._EC_NOT_INITIALIZED = False
65
+
66
+ return self._ec
67
+
68
+ @property
69
+ def name(self):
70
+ return self._ec.name
71
+
72
+ @property
73
+ def tz(self):
74
+ return self._ec.tz
75
+
76
+ @property
77
+ def regular_holidays(self):
78
+ return self._ec.regular_holidays
79
+
80
+ @property
81
+ def adhoc_holidays(self):
82
+ return self._ec.adhoc_holidays
83
+
84
+ @property
85
+ def special_opens(self):
86
+ return self._ec.special_opens
87
+
88
+ @property
89
+ def special_opens_adhoc(self):
90
+ return self._ec.special_opens_adhoc
91
+
92
+ @property
93
+ def special_closes(self):
94
+ return self._ec.special_closes
95
+
96
+ @property
97
+ def special_closes_adhoc(self):
98
+ return self._ec.special_closes_adhoc
99
+
100
+
101
+ calendars = exchange_calendars.calendar_utils._default_calendar_factories # noqa
102
+
103
+ time_props = dict(
104
+ open_times="market_open",
105
+ close_times="market_close",
106
+ break_start_times="break_start",
107
+ break_end_times="break_end",
108
+ )
109
+
110
+ for exchange in calendars:
111
+ cal = calendars[exchange]
112
+
113
+ # this loop will set up the newly required regular_market_times dictionary
114
+ regular_market_times = {}
115
+ for prop, new in time_props.items():
116
+ times = getattr(cal, prop)
117
+ if times is None or isinstance(times, property):
118
+ continue
119
+ regular_market_times[new] = times
120
+
121
+ cal = type(
122
+ exchange,
123
+ (TradingCalendar,),
124
+ {
125
+ "_ec_class": calendars[exchange],
126
+ "alias": [exchange],
127
+ "regular_market_times": regular_market_times,
128
+ },
129
+ )
130
+ locals()[f"{exchange}ExchangeCalendar"] = cal