pandas-market-calendars 4.3.0__py3-none-any.whl → 4.3.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.
- pandas_market_calendars/calendars/__init__.py +0 -0
- pandas_market_calendars/calendars/asx.py +63 -0
- pandas_market_calendars/calendars/bmf.py +227 -0
- pandas_market_calendars/calendars/bse.py +409 -0
- pandas_market_calendars/calendars/cboe.py +115 -0
- pandas_market_calendars/calendars/cme.py +240 -0
- pandas_market_calendars/calendars/cme_globex_agriculture.py +103 -0
- pandas_market_calendars/calendars/cme_globex_base.py +103 -0
- pandas_market_calendars/calendars/cme_globex_crypto.py +147 -0
- pandas_market_calendars/calendars/cme_globex_energy_and_metals.py +138 -0
- pandas_market_calendars/calendars/cme_globex_equities.py +104 -0
- pandas_market_calendars/calendars/cme_globex_fixed_income.py +113 -0
- pandas_market_calendars/calendars/cme_globex_fx.py +78 -0
- pandas_market_calendars/calendars/eurex.py +119 -0
- pandas_market_calendars/calendars/hkex.py +408 -0
- pandas_market_calendars/calendars/ice.py +65 -0
- pandas_market_calendars/calendars/iex.py +98 -0
- pandas_market_calendars/calendars/jpx.py +103 -0
- pandas_market_calendars/calendars/lse.py +91 -0
- pandas_market_calendars/calendars/mirror.py +114 -0
- pandas_market_calendars/calendars/nyse.py +1127 -0
- pandas_market_calendars/calendars/ose.py +150 -0
- pandas_market_calendars/calendars/sifma.py +297 -0
- pandas_market_calendars/calendars/six.py +114 -0
- pandas_market_calendars/calendars/sse.py +290 -0
- pandas_market_calendars/calendars/tase.py +195 -0
- pandas_market_calendars/calendars/tsx.py +159 -0
- pandas_market_calendars/holidays/__init__.py +0 -0
- pandas_market_calendars/holidays/cme.py +340 -0
- pandas_market_calendars/holidays/cme_globex.py +198 -0
- pandas_market_calendars/holidays/cn.py +1436 -0
- pandas_market_calendars/holidays/jp.py +396 -0
- pandas_market_calendars/holidays/jpx_equinox.py +147 -0
- pandas_market_calendars/holidays/nyse.py +1472 -0
- pandas_market_calendars/holidays/oz.py +65 -0
- pandas_market_calendars/holidays/sifma.py +321 -0
- pandas_market_calendars/holidays/uk.py +180 -0
- pandas_market_calendars/holidays/us.py +360 -0
- {pandas_market_calendars-4.3.0.dist-info → pandas_market_calendars-4.3.1.dist-info}/METADATA +1 -1
- pandas_market_calendars-4.3.1.dist-info/RECORD +49 -0
- pandas_market_calendars-4.3.0.dist-info/RECORD +0 -11
- {pandas_market_calendars-4.3.0.dist-info → pandas_market_calendars-4.3.1.dist-info}/LICENSE +0 -0
- {pandas_market_calendars-4.3.0.dist-info → pandas_market_calendars-4.3.1.dist-info}/NOTICE +0 -0
- {pandas_market_calendars-4.3.0.dist-info → pandas_market_calendars-4.3.1.dist-info}/WHEEL +0 -0
- {pandas_market_calendars-4.3.0.dist-info → pandas_market_calendars-4.3.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,290 @@
|
|
1
|
+
from datetime import time, timedelta
|
2
|
+
from functools import partial
|
3
|
+
|
4
|
+
from pandas.tseries.holiday import AbstractHolidayCalendar, Holiday, next_monday
|
5
|
+
from pytz import timezone
|
6
|
+
|
7
|
+
from pandas_market_calendars.holidays.cn import *
|
8
|
+
from pandas_market_calendars.market_calendar import MarketCalendar
|
9
|
+
|
10
|
+
|
11
|
+
class SSEExchangeCalendar(MarketCalendar):
|
12
|
+
"""
|
13
|
+
Exchange calendar for Shanghai Stock Exchange
|
14
|
+
|
15
|
+
Open Time: 9:30 AM, Asia/Shanghai
|
16
|
+
LUNCH BREAK :facepalm: : 11:30 AM - 1:00 PM Asia/Shanghai
|
17
|
+
Close Time: 3:00 PM, Asia/Shanghai
|
18
|
+
"""
|
19
|
+
aliases = ['SSE']
|
20
|
+
regular_market_times = {
|
21
|
+
"market_open": ((None, time(9, 30)),),
|
22
|
+
"market_close": ((None, time(15)),),
|
23
|
+
"break_start": ((None, time(11,30)),),
|
24
|
+
"break_end": ((None, time(13)),)
|
25
|
+
}
|
26
|
+
|
27
|
+
@property
|
28
|
+
def name(self):
|
29
|
+
return "SSE"
|
30
|
+
|
31
|
+
@property
|
32
|
+
def tz(self):
|
33
|
+
return timezone('Asia/Shanghai')
|
34
|
+
|
35
|
+
@property
|
36
|
+
def regular_holidays(self):
|
37
|
+
"""
|
38
|
+
Rules are guesses based on observations of recent year.
|
39
|
+
Rectify accordingly once the next year's holidays arrangement is published by the government.
|
40
|
+
"""
|
41
|
+
# Since all past holidays are adhoc, start_year should always be a year in the future.
|
42
|
+
# For example: Holiday arrangements for 2022 are now included,
|
43
|
+
# then our guesswork starts from the next year so start_year = 2023
|
44
|
+
start_year = 2024
|
45
|
+
|
46
|
+
return AbstractHolidayCalendar(rules=[
|
47
|
+
Holiday(
|
48
|
+
name="New Year's Day",
|
49
|
+
month=1,
|
50
|
+
day=1,
|
51
|
+
observance=next_monday,
|
52
|
+
start_date=Timestamp(start_year, 1, 1),
|
53
|
+
),
|
54
|
+
Holiday(
|
55
|
+
name="New Year's Day",
|
56
|
+
month=1,
|
57
|
+
day=2,
|
58
|
+
observance=partial(second_day_in_lieu),
|
59
|
+
start_date=Timestamp(start_year, 1, 2),
|
60
|
+
),
|
61
|
+
Holiday(
|
62
|
+
name="New Year's Day",
|
63
|
+
month=1,
|
64
|
+
day=3,
|
65
|
+
observance=partial(third_day_in_lieu),
|
66
|
+
start_date=Timestamp(start_year, 1, 3),
|
67
|
+
),
|
68
|
+
Holiday(
|
69
|
+
name="Spring Festival",
|
70
|
+
month=1,
|
71
|
+
day=20,
|
72
|
+
observance=partial(lunisolar, mapping=sf_mapping, delta=-1),
|
73
|
+
start_date=Timestamp(start_year, 1, 20),
|
74
|
+
),
|
75
|
+
Holiday(
|
76
|
+
name="Spring Festival",
|
77
|
+
month=1,
|
78
|
+
day=21,
|
79
|
+
observance=partial(lunisolar, mapping=sf_mapping, delta=0),
|
80
|
+
start_date=Timestamp(start_year, 1, 21),
|
81
|
+
),
|
82
|
+
Holiday(
|
83
|
+
name="Spring Festival",
|
84
|
+
month=1,
|
85
|
+
day=21,
|
86
|
+
observance=partial(lunisolar, mapping=sf_mapping, delta=1),
|
87
|
+
start_date=Timestamp(start_year, 1, 22),
|
88
|
+
),
|
89
|
+
Holiday(
|
90
|
+
name="Spring Festival",
|
91
|
+
month=1,
|
92
|
+
day=21,
|
93
|
+
observance=partial(lunisolar, mapping=sf_mapping, delta=2),
|
94
|
+
start_date=Timestamp(start_year, 1, 23),
|
95
|
+
),
|
96
|
+
Holiday(
|
97
|
+
name="Spring Festival",
|
98
|
+
month=1,
|
99
|
+
day=21,
|
100
|
+
observance=partial(lunisolar, mapping=sf_mapping, delta=3),
|
101
|
+
start_date=Timestamp(start_year, 1, 24),
|
102
|
+
),
|
103
|
+
Holiday(
|
104
|
+
name="Spring Festival",
|
105
|
+
month=1,
|
106
|
+
day=21,
|
107
|
+
observance=partial(lunisolar, mapping=sf_mapping, delta=4),
|
108
|
+
start_date=Timestamp(start_year, 1, 25),
|
109
|
+
),
|
110
|
+
Holiday(
|
111
|
+
name="Spring Festival",
|
112
|
+
month=1,
|
113
|
+
day=21,
|
114
|
+
observance=partial(lunisolar, mapping=sf_mapping, delta=5),
|
115
|
+
start_date=Timestamp(start_year, 1, 26),
|
116
|
+
),
|
117
|
+
Holiday(
|
118
|
+
name="Labour Day",
|
119
|
+
month=5,
|
120
|
+
day=1,
|
121
|
+
observance=next_monday,
|
122
|
+
start_date=Timestamp(start_year, 5, 1),
|
123
|
+
),
|
124
|
+
Holiday(
|
125
|
+
name="Labour Day",
|
126
|
+
month=5,
|
127
|
+
day=2,
|
128
|
+
observance=second_day_in_lieu,
|
129
|
+
start_date=Timestamp(start_year, 5, 2),
|
130
|
+
),
|
131
|
+
Holiday(
|
132
|
+
name="Labour Day",
|
133
|
+
month=5,
|
134
|
+
day=3,
|
135
|
+
observance=third_day_in_lieu,
|
136
|
+
start_date=Timestamp(start_year, 5, 3),
|
137
|
+
),
|
138
|
+
Holiday(
|
139
|
+
name="Tomb-sweeping Day",
|
140
|
+
month=4,
|
141
|
+
day=4,
|
142
|
+
observance=partial(lunisolar, mapping=tsd_mapping, func=next_monday),
|
143
|
+
start_date=Timestamp(start_year, 4, 4),
|
144
|
+
),
|
145
|
+
Holiday(
|
146
|
+
name="Tomb-sweeping Day",
|
147
|
+
month=4,
|
148
|
+
day=5,
|
149
|
+
observance=partial(lunisolar, mapping=tsd_mapping, func=second_day_in_lieu, delta=1),
|
150
|
+
start_date=Timestamp(start_year, 4, 4),
|
151
|
+
),
|
152
|
+
Holiday(
|
153
|
+
name="Tomb-sweeping Day",
|
154
|
+
month=4,
|
155
|
+
day=6,
|
156
|
+
observance=partial(lunisolar, mapping=tsd_mapping, func=third_day_in_lieu, delta=2),
|
157
|
+
start_date=Timestamp(start_year, 4, 4),
|
158
|
+
),
|
159
|
+
Holiday(
|
160
|
+
name="Dragon Boat Festival",
|
161
|
+
month=5,
|
162
|
+
day=27,
|
163
|
+
observance=partial(lunisolar, mapping=dbf_mapping, func=next_monday),
|
164
|
+
start_date=Timestamp(start_year, 5, 27),
|
165
|
+
),
|
166
|
+
Holiday(
|
167
|
+
name="Dragon Boat Festival",
|
168
|
+
month=5,
|
169
|
+
day=28,
|
170
|
+
observance=partial(lunisolar, mapping=dbf_mapping, func=second_day_in_lieu, delta=1),
|
171
|
+
start_date=Timestamp(start_year, 5, 27),
|
172
|
+
),
|
173
|
+
Holiday(
|
174
|
+
name="Dragon Boat Festival",
|
175
|
+
month=5,
|
176
|
+
day=29,
|
177
|
+
observance=partial(lunisolar, mapping=dbf_mapping, func=third_day_in_lieu, delta=2),
|
178
|
+
start_date=Timestamp(start_year, 5, 27),
|
179
|
+
),
|
180
|
+
Holiday(
|
181
|
+
name="Mid-autumn Festival",
|
182
|
+
month=9,
|
183
|
+
day=7,
|
184
|
+
observance=partial(lunisolar, mapping=maf_mapping, func=next_monday),
|
185
|
+
start_date=Timestamp(start_year, 9, 7),
|
186
|
+
),
|
187
|
+
Holiday(
|
188
|
+
name="Mid-autumn Festival",
|
189
|
+
month=9,
|
190
|
+
day=8,
|
191
|
+
observance=partial(lunisolar, mapping=maf_mapping, func=second_day_in_lieu, delta=1),
|
192
|
+
start_date=Timestamp(start_year, 9, 7),
|
193
|
+
),
|
194
|
+
Holiday(
|
195
|
+
name="Mid-autumn Festival",
|
196
|
+
month=9,
|
197
|
+
day=9,
|
198
|
+
observance=partial(lunisolar, mapping=maf_mapping, func=third_day_in_lieu, delta=2),
|
199
|
+
start_date=Timestamp(start_year, 9, 7),
|
200
|
+
),
|
201
|
+
Holiday(
|
202
|
+
name="National Day",
|
203
|
+
month=10,
|
204
|
+
day=1,
|
205
|
+
start_date=Timestamp(start_year, 10, 1),
|
206
|
+
),
|
207
|
+
Holiday(
|
208
|
+
name="National Day",
|
209
|
+
month=10,
|
210
|
+
day=2,
|
211
|
+
start_date=Timestamp(start_year, 10, 2),
|
212
|
+
),
|
213
|
+
Holiday(
|
214
|
+
name="National Day",
|
215
|
+
month=10,
|
216
|
+
day=3,
|
217
|
+
start_date=Timestamp(start_year, 10, 3),
|
218
|
+
),
|
219
|
+
Holiday(
|
220
|
+
name="National Day",
|
221
|
+
month=10,
|
222
|
+
day=4,
|
223
|
+
start_date=Timestamp(start_year, 10, 4),
|
224
|
+
),
|
225
|
+
Holiday(
|
226
|
+
name="National Day",
|
227
|
+
month=10,
|
228
|
+
day=5,
|
229
|
+
start_date=Timestamp(start_year, 10, 5),
|
230
|
+
),
|
231
|
+
Holiday(
|
232
|
+
name="National Day",
|
233
|
+
month=10,
|
234
|
+
day=6,
|
235
|
+
start_date=Timestamp(start_year, 10, 6),
|
236
|
+
),
|
237
|
+
Holiday(
|
238
|
+
name="National Day",
|
239
|
+
month=10,
|
240
|
+
day=7,
|
241
|
+
start_date=Timestamp(start_year, 10, 7),
|
242
|
+
),
|
243
|
+
])
|
244
|
+
|
245
|
+
@property
|
246
|
+
def adhoc_holidays(self):
|
247
|
+
return all_holidays
|
248
|
+
|
249
|
+
|
250
|
+
def second_day_in_lieu(dt):
|
251
|
+
dow = dt.weekday()
|
252
|
+
if dow == 0: # Holiday is Sunday, use Saturday
|
253
|
+
return dt - timedelta(2)
|
254
|
+
elif dow == 1: # Holiday is Monday, use Saturday
|
255
|
+
return dt - timedelta(3)
|
256
|
+
elif dow == 2: # Holiday is Tuesday, use Sunday
|
257
|
+
return dt - timedelta(3)
|
258
|
+
elif dow == 3: # Holiday is Wednesday, use Saturday
|
259
|
+
return dt - timedelta(5)
|
260
|
+
|
261
|
+
return dt
|
262
|
+
|
263
|
+
|
264
|
+
def third_day_in_lieu(dt):
|
265
|
+
dow = dt.weekday()
|
266
|
+
if dow == 0: # Holiday is Saturday, use Sunday
|
267
|
+
return dt - timedelta(1)
|
268
|
+
elif dow == 1: # Holiday is Sunday, use Sunday
|
269
|
+
return dt - timedelta(2)
|
270
|
+
elif dow == 2: # Holiday is Monday, use Sunday
|
271
|
+
return dt - timedelta(3)
|
272
|
+
elif dow == 3: # Holiday is Tuesday, use Monday
|
273
|
+
return dt - timedelta(3)
|
274
|
+
elif dow == 4: # Holiday is Wednesday, use Sunday
|
275
|
+
return dt - timedelta(5)
|
276
|
+
|
277
|
+
return dt
|
278
|
+
|
279
|
+
|
280
|
+
def lunisolar(dt, mapping, func=None, delta=None):
|
281
|
+
if mapping and (dt.year in mapping):
|
282
|
+
new_dt = mapping[dt.year]
|
283
|
+
else:
|
284
|
+
new_dt = dt
|
285
|
+
if delta:
|
286
|
+
new_dt = new_dt + timedelta(delta)
|
287
|
+
if func:
|
288
|
+
return func(new_dt)
|
289
|
+
else:
|
290
|
+
return new_dt
|
@@ -0,0 +1,195 @@
|
|
1
|
+
from datetime import time
|
2
|
+
from pandas import Timestamp
|
3
|
+
from pytz import timezone
|
4
|
+
from pandas_market_calendars.market_calendar import MarketCalendar
|
5
|
+
|
6
|
+
TASEClosedDay = [
|
7
|
+
# 2019
|
8
|
+
Timestamp('2019-03-21', tz='Asia/Jerusalem'),
|
9
|
+
Timestamp('2019-04-09', tz='Asia/Jerusalem'),
|
10
|
+
Timestamp('2019-04-25', tz='Asia/Jerusalem'),
|
11
|
+
Timestamp('2019-04-26', tz='Asia/Jerusalem'),
|
12
|
+
Timestamp('2019-05-08', tz='Asia/Jerusalem'),
|
13
|
+
Timestamp('2019-05-09', tz='Asia/Jerusalem'),
|
14
|
+
Timestamp('2019-06-09', tz='Asia/Jerusalem'),
|
15
|
+
Timestamp('2019-08-11', tz='Asia/Jerusalem'),
|
16
|
+
Timestamp('2019-09-17', tz='Asia/Jerusalem'),
|
17
|
+
Timestamp('2019-09-29', tz='Asia/Jerusalem'),
|
18
|
+
Timestamp('2019-09-30', tz='Asia/Jerusalem'),
|
19
|
+
Timestamp('2019-10-01', tz='Asia/Jerusalem'),
|
20
|
+
Timestamp('2019-10-08', tz='Asia/Jerusalem'),
|
21
|
+
Timestamp('2019-10-09', tz='Asia/Jerusalem'),
|
22
|
+
Timestamp('2019-10-13', tz='Asia/Jerusalem'),
|
23
|
+
Timestamp('2019-10-14', tz='Asia/Jerusalem'),
|
24
|
+
Timestamp('2019-10-20', tz='Asia/Jerusalem'),
|
25
|
+
Timestamp('2019-10-21', tz='Asia/Jerusalem'),
|
26
|
+
# 2020
|
27
|
+
Timestamp('2020-03-02', tz='Asia/Jerusalem'),
|
28
|
+
Timestamp('2020-03-10', tz='Asia/Jerusalem'),
|
29
|
+
Timestamp('2020-04-08', tz='Asia/Jerusalem'),
|
30
|
+
Timestamp('2020-04-09', tz='Asia/Jerusalem'),
|
31
|
+
Timestamp('2020-04-14', tz='Asia/Jerusalem'),
|
32
|
+
Timestamp('2020-04-15', tz='Asia/Jerusalem'),
|
33
|
+
Timestamp('2020-04-28', tz='Asia/Jerusalem'),
|
34
|
+
Timestamp('2020-04-29', tz='Asia/Jerusalem'),
|
35
|
+
Timestamp('2020-05-28', tz='Asia/Jerusalem'),
|
36
|
+
Timestamp('2020-05-29', tz='Asia/Jerusalem'),
|
37
|
+
Timestamp('2020-07-30', tz='Asia/Jerusalem'),
|
38
|
+
Timestamp('2020-09-20', tz='Asia/Jerusalem'),
|
39
|
+
Timestamp('2020-09-27', tz='Asia/Jerusalem'),
|
40
|
+
Timestamp('2020-09-28', tz='Asia/Jerusalem'),
|
41
|
+
# 2021
|
42
|
+
Timestamp('2021-02-26', tz='Asia/Jerusalem'),
|
43
|
+
Timestamp('2021-03-28', tz='Asia/Jerusalem'),
|
44
|
+
Timestamp('2021-04-02', tz='Asia/Jerusalem'),
|
45
|
+
Timestamp('2021-04-14', tz='Asia/Jerusalem'),
|
46
|
+
Timestamp('2021-04-15', tz='Asia/Jerusalem'),
|
47
|
+
Timestamp('2021-05-16', tz='Asia/Jerusalem'),
|
48
|
+
Timestamp('2021-05-17', tz='Asia/Jerusalem'),
|
49
|
+
Timestamp('2021-07-18', tz='Asia/Jerusalem'),
|
50
|
+
Timestamp('2021-09-06', tz='Asia/Jerusalem'),
|
51
|
+
Timestamp('2021-09-07', tz='Asia/Jerusalem'),
|
52
|
+
Timestamp('2021-09-08', tz='Asia/Jerusalem'),
|
53
|
+
Timestamp('2021-09-15', tz='Asia/Jerusalem'),
|
54
|
+
Timestamp('2021-09-16', tz='Asia/Jerusalem'),
|
55
|
+
Timestamp('2021-09-20', tz='Asia/Jerusalem'),
|
56
|
+
Timestamp('2021-09-21', tz='Asia/Jerusalem'),
|
57
|
+
Timestamp('2021-09-27', tz='Asia/Jerusalem'),
|
58
|
+
Timestamp('2021-09-28', tz='Asia/Jerusalem'),
|
59
|
+
#2022
|
60
|
+
Timestamp('2022-03-17', tz='Asia/Jerusalem'),
|
61
|
+
Timestamp('2022-03-18', tz='Asia/Jerusalem'),
|
62
|
+
Timestamp('2022-04-15', tz='Asia/Jerusalem'),
|
63
|
+
Timestamp('2022-04-21', tz='Asia/Jerusalem'),
|
64
|
+
Timestamp('2022-04-22', tz='Asia/Jerusalem'),
|
65
|
+
Timestamp('2022-05-05', tz='Asia/Jerusalem'),
|
66
|
+
Timestamp('2022-06-05', tz='Asia/Jerusalem'),
|
67
|
+
Timestamp('2022-08-07', tz='Asia/Jerusalem'),
|
68
|
+
Timestamp('2022-09-25', tz='Asia/Jerusalem'),
|
69
|
+
Timestamp('2022-09-26', tz='Asia/Jerusalem'),
|
70
|
+
Timestamp('2022-09-27', tz='Asia/Jerusalem'),
|
71
|
+
Timestamp('2022-10-04', tz='Asia/Jerusalem'),
|
72
|
+
Timestamp('2022-10-05', tz='Asia/Jerusalem'),
|
73
|
+
Timestamp('2022-10-09', tz='Asia/Jerusalem'),
|
74
|
+
Timestamp('2022-10-10', tz='Asia/Jerusalem'),
|
75
|
+
Timestamp('2022-10-16', tz='Asia/Jerusalem'),
|
76
|
+
Timestamp('2022-10-17', tz='Asia/Jerusalem'),
|
77
|
+
Timestamp('2022-11-01', tz='Asia/Jerusalem'),
|
78
|
+
#2023
|
79
|
+
Timestamp('2023-03-07', tz='Asia/Jerusalem'),
|
80
|
+
Timestamp('2023-03-08', tz='Asia/Jerusalem'),
|
81
|
+
Timestamp('2023-04-05', tz='Asia/Jerusalem'),
|
82
|
+
Timestamp('2023-04-06', tz='Asia/Jerusalem'),
|
83
|
+
Timestamp('2023-04-11', tz='Asia/Jerusalem'),
|
84
|
+
Timestamp('2023-04-12', tz='Asia/Jerusalem'),
|
85
|
+
Timestamp('2023-04-25', tz='Asia/Jerusalem'),
|
86
|
+
Timestamp('2023-04-26', tz='Asia/Jerusalem'),
|
87
|
+
Timestamp('2023-05-25', tz='Asia/Jerusalem'),
|
88
|
+
Timestamp('2023-05-26', tz='Asia/Jerusalem'),
|
89
|
+
Timestamp('2023-07-27', tz='Asia/Jerusalem'),
|
90
|
+
Timestamp('2023-09-15', tz='Asia/Jerusalem'),
|
91
|
+
Timestamp('2023-09-17', tz='Asia/Jerusalem'),
|
92
|
+
Timestamp('2023-09-24', tz='Asia/Jerusalem'),
|
93
|
+
Timestamp('2023-09-25', tz='Asia/Jerusalem'),
|
94
|
+
Timestamp('2023-09-29', tz='Asia/Jerusalem'),
|
95
|
+
Timestamp('2023-10-06', tz='Asia/Jerusalem'),
|
96
|
+
Timestamp('2023-10-31', tz='Asia/Jerusalem'),
|
97
|
+
#2024
|
98
|
+
Timestamp('2024-03-24', tz='Asia/Jerusalem'),
|
99
|
+
Timestamp('2024-03-25', tz='Asia/Jerusalem'),
|
100
|
+
Timestamp('2024-04-22', tz='Asia/Jerusalem'),
|
101
|
+
Timestamp('2024-04-23', tz='Asia/Jerusalem'),
|
102
|
+
Timestamp('2024-04-28', tz='Asia/Jerusalem'),
|
103
|
+
Timestamp('2024-04-29', tz='Asia/Jerusalem'),
|
104
|
+
Timestamp('2024-05-13', tz='Asia/Jerusalem'),
|
105
|
+
Timestamp('2024-05-14', tz='Asia/Jerusalem'),
|
106
|
+
Timestamp('2024-06-11', tz='Asia/Jerusalem'),
|
107
|
+
Timestamp('2024-06-12', tz='Asia/Jerusalem'),
|
108
|
+
Timestamp('2024-08-13', tz='Asia/Jerusalem'),
|
109
|
+
Timestamp('2024-10-02', tz='Asia/Jerusalem'),
|
110
|
+
Timestamp('2024-10-03', tz='Asia/Jerusalem'),
|
111
|
+
Timestamp('2024-10-04', tz='Asia/Jerusalem'),
|
112
|
+
Timestamp('2024-10-11', tz='Asia/Jerusalem'),
|
113
|
+
Timestamp('2024-10-16', tz='Asia/Jerusalem'),
|
114
|
+
Timestamp('2024-10-17', tz='Asia/Jerusalem'),
|
115
|
+
Timestamp('2024-10-23', tz='Asia/Jerusalem'),
|
116
|
+
Timestamp('2024-10-24', tz='Asia/Jerusalem'),
|
117
|
+
#2025
|
118
|
+
Timestamp('2025-03-14', tz='Asia/Jerusalem'),
|
119
|
+
Timestamp('2025-04-13', tz='Asia/Jerusalem'),
|
120
|
+
Timestamp('2025-04-18', tz='Asia/Jerusalem'),
|
121
|
+
Timestamp('2025-04-30', tz='Asia/Jerusalem'),
|
122
|
+
Timestamp('2025-05-01', tz='Asia/Jerusalem'),
|
123
|
+
Timestamp('2025-06-01', tz='Asia/Jerusalem'),
|
124
|
+
Timestamp('2025-06-02', tz='Asia/Jerusalem'),
|
125
|
+
Timestamp('2025-08-03', tz='Asia/Jerusalem'),
|
126
|
+
Timestamp('2025-09-22', tz='Asia/Jerusalem'),
|
127
|
+
Timestamp('2025-09-23', tz='Asia/Jerusalem'),
|
128
|
+
Timestamp('2025-09-24', tz='Asia/Jerusalem'),
|
129
|
+
Timestamp('2025-10-01', tz='Asia/Jerusalem'),
|
130
|
+
Timestamp('2025-10-02', tz='Asia/Jerusalem'),
|
131
|
+
Timestamp('2025-10-06', tz='Asia/Jerusalem'),
|
132
|
+
Timestamp('2025-10-07', tz='Asia/Jerusalem'),
|
133
|
+
Timestamp('2025-10-13', tz='Asia/Jerusalem'),
|
134
|
+
Timestamp('2025-10-14', tz='Asia/Jerusalem')
|
135
|
+
]
|
136
|
+
|
137
|
+
|
138
|
+
class TASEExchangeCalendar(MarketCalendar):
|
139
|
+
"""
|
140
|
+
Exchange calendar for TASE Stock Exchange
|
141
|
+
|
142
|
+
Note these dates are only checked against 2020 and 2021
|
143
|
+
https://info.tase.co.il/Eng/about_tase/corporate/Pages/vacation_schedule.aspx
|
144
|
+
|
145
|
+
Opening times for the regular trading of equities (not including closing auction call)
|
146
|
+
Open Time: 10:00 AM Asia/Jerusalem
|
147
|
+
Close Time: 3:59 PM Asia/Jerusalem
|
148
|
+
|
149
|
+
Daylight Saving Time in Israel comes into effect on the Friday before the last Sunday in March, and lasts until the
|
150
|
+
last Sunday in October.
|
151
|
+
During the Daylight Saving time period the clock will be UTC+3, and for the rest of the year UTC+2.
|
152
|
+
|
153
|
+
Regularly-Observed Holidays (not necessarily in order):
|
154
|
+
- Purim
|
155
|
+
- Passover_I_Eve
|
156
|
+
- Passover_I
|
157
|
+
- Passover_II_Eve
|
158
|
+
- Passover_II
|
159
|
+
- Independence_Day
|
160
|
+
- Yom_HaZikaron
|
161
|
+
- Shavuot_Eve
|
162
|
+
- Shavuot
|
163
|
+
- Tisha_beAv
|
164
|
+
- Jewish_New_Year_Eve
|
165
|
+
- Jewish_New_Year_I
|
166
|
+
- Jewish_New_Year_II
|
167
|
+
- Yom_Kippur_Eve
|
168
|
+
- Yom_Kippur
|
169
|
+
- Sukkoth_Eve
|
170
|
+
- Sukkoth
|
171
|
+
- Simchat_Tora_Eve
|
172
|
+
- Simchat_Tora
|
173
|
+
"""
|
174
|
+
|
175
|
+
aliases = ['TASE']
|
176
|
+
regular_market_times = {
|
177
|
+
"market_open": ((None, time(10)),),
|
178
|
+
"market_close": ((None, time(15,59)),)
|
179
|
+
}
|
180
|
+
|
181
|
+
@property
|
182
|
+
def name(self):
|
183
|
+
return "TASE"
|
184
|
+
|
185
|
+
@property
|
186
|
+
def tz(self):
|
187
|
+
return timezone("Asia/Jerusalem")
|
188
|
+
|
189
|
+
@property
|
190
|
+
def adhoc_holidays(self):
|
191
|
+
return TASEClosedDay
|
192
|
+
|
193
|
+
@property
|
194
|
+
def weekmask(self):
|
195
|
+
return "Sun Mon Tue Wed Thu"
|
@@ -0,0 +1,159 @@
|
|
1
|
+
from datetime import time
|
2
|
+
|
3
|
+
import pandas as pd
|
4
|
+
from pandas.tseries.holiday import AbstractHolidayCalendar, DateOffset, GoodFriday, Holiday, MO, weekend_to_monday
|
5
|
+
from pytz import timezone
|
6
|
+
from itertools import chain
|
7
|
+
|
8
|
+
from pandas_market_calendars.holidays.uk import BoxingDay, WeekendBoxingDay, WeekendChristmas
|
9
|
+
from pandas_market_calendars.market_calendar import MarketCalendar, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY
|
10
|
+
|
11
|
+
# New Year's Day
|
12
|
+
TSXNewYearsDay = Holiday(
|
13
|
+
"New Year's Day",
|
14
|
+
month=1,
|
15
|
+
day=1,
|
16
|
+
observance=weekend_to_monday,
|
17
|
+
)
|
18
|
+
# Ontario Family Day
|
19
|
+
FamilyDay = Holiday(
|
20
|
+
"Family Day",
|
21
|
+
month=2,
|
22
|
+
day=1,
|
23
|
+
offset=DateOffset(weekday=MO(3)),
|
24
|
+
start_date='2008-01-01',
|
25
|
+
)
|
26
|
+
# Victoria Day
|
27
|
+
# https://www.timeanddate.com/holidays/canada/victoria-day
|
28
|
+
VictoriaDay = Holiday(
|
29
|
+
'Victoria Day',
|
30
|
+
month=5,
|
31
|
+
day=24,
|
32
|
+
offset=DateOffset(weekday=MO(-1)),
|
33
|
+
)
|
34
|
+
# Canada Day
|
35
|
+
CanadaDay = Holiday(
|
36
|
+
'Canada Day',
|
37
|
+
month=7,
|
38
|
+
day=1,
|
39
|
+
observance=weekend_to_monday,
|
40
|
+
)
|
41
|
+
# Civic Holiday
|
42
|
+
CivicHoliday = Holiday(
|
43
|
+
'Civic Holiday',
|
44
|
+
month=8,
|
45
|
+
day=1,
|
46
|
+
offset=DateOffset(weekday=MO(1)),
|
47
|
+
)
|
48
|
+
# Labor Day
|
49
|
+
LaborDay = Holiday(
|
50
|
+
'Labor Day',
|
51
|
+
month=9,
|
52
|
+
day=1,
|
53
|
+
offset=DateOffset(weekday=MO(1)),
|
54
|
+
)
|
55
|
+
# Thanksgiving
|
56
|
+
Thanksgiving = Holiday(
|
57
|
+
'Thanksgiving',
|
58
|
+
month=10,
|
59
|
+
day=1,
|
60
|
+
offset=DateOffset(weekday=MO(2)),
|
61
|
+
)
|
62
|
+
|
63
|
+
Christmas = Holiday(
|
64
|
+
'Christmas',
|
65
|
+
month=12,
|
66
|
+
day=25,
|
67
|
+
)
|
68
|
+
|
69
|
+
ChristmasEveEarlyClose2010Onwards = Holiday(
|
70
|
+
"Christmas Eve Early Close",
|
71
|
+
month=12,
|
72
|
+
day=24,
|
73
|
+
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
|
74
|
+
start_date=pd.Timestamp("2010-01-01"),
|
75
|
+
)
|
76
|
+
|
77
|
+
September11Closings2001 = [
|
78
|
+
pd.Timestamp("2001-09-11", tz='UTC'),
|
79
|
+
pd.Timestamp("2001-09-12", tz='UTC'),
|
80
|
+
]
|
81
|
+
|
82
|
+
|
83
|
+
class TSXExchangeCalendar(MarketCalendar):
|
84
|
+
"""
|
85
|
+
Exchange calendar for the Toronto Stock Exchange
|
86
|
+
|
87
|
+
Open Time: 9:30 AM, EST
|
88
|
+
Close Time: 4:00 PM, EST
|
89
|
+
|
90
|
+
Regularly-Observed Holidays:
|
91
|
+
- New Years Day (observed on first business day on/after)
|
92
|
+
- Family Day (Third Monday in February, starting in 2008)
|
93
|
+
- Good Friday
|
94
|
+
- Victoria Day (Monday before May 25th)
|
95
|
+
- Canada Day (July 1st, observed first business day after)
|
96
|
+
- Civic Holiday (First Monday in August)
|
97
|
+
- Labor Day (First Monday in September)
|
98
|
+
- Thanksgiving (Second Monday in October)
|
99
|
+
- Christmas Day
|
100
|
+
- Dec. 26th if Christmas is on a Sunday
|
101
|
+
- Dec. 27th if Christmas is on a weekend
|
102
|
+
- Boxing Day
|
103
|
+
- Dec. 27th if Christmas is on a Sunday
|
104
|
+
- Dec. 28th if Boxing Day is on a weekend
|
105
|
+
|
106
|
+
Early closes:
|
107
|
+
- Starting in 2010, if Christmas Eve falls on a weekday, the market
|
108
|
+
closes at 1:00 pm that day. If it falls on a weekend, there is no
|
109
|
+
early close.
|
110
|
+
"""
|
111
|
+
aliases = ['TSX', 'TSXV']
|
112
|
+
|
113
|
+
regular_market_times = {
|
114
|
+
"market_open": ((None, time(9, 30)),),
|
115
|
+
"market_close": ((None, time(16)),)
|
116
|
+
}
|
117
|
+
|
118
|
+
|
119
|
+
@property
|
120
|
+
def name(self):
|
121
|
+
return "TSX"
|
122
|
+
|
123
|
+
@property
|
124
|
+
def tz(self):
|
125
|
+
return timezone('Canada/Eastern')
|
126
|
+
|
127
|
+
regular_early_close = time(13)
|
128
|
+
|
129
|
+
@property
|
130
|
+
def regular_holidays(self):
|
131
|
+
return AbstractHolidayCalendar(rules=[
|
132
|
+
TSXNewYearsDay,
|
133
|
+
FamilyDay,
|
134
|
+
GoodFriday,
|
135
|
+
VictoriaDay,
|
136
|
+
CanadaDay,
|
137
|
+
CivicHoliday,
|
138
|
+
LaborDay,
|
139
|
+
Thanksgiving,
|
140
|
+
Christmas,
|
141
|
+
WeekendChristmas,
|
142
|
+
BoxingDay,
|
143
|
+
WeekendBoxingDay
|
144
|
+
])
|
145
|
+
|
146
|
+
@property
|
147
|
+
def adhoc_holidays(self):
|
148
|
+
return list(chain(
|
149
|
+
September11Closings2001,
|
150
|
+
))
|
151
|
+
|
152
|
+
@property
|
153
|
+
def special_closes(self):
|
154
|
+
return [
|
155
|
+
(
|
156
|
+
self.regular_early_close,
|
157
|
+
AbstractHolidayCalendar([ChristmasEveEarlyClose2010Onwards]),
|
158
|
+
)
|
159
|
+
]
|
File without changes
|