pandas-market-calendars 4.1.3__py3-none-any.whl → 4.2.0__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 (47) hide show
  1. {pandas_market_calendars-4.1.3.dist-info → pandas_market_calendars-4.2.0.dist-info}/METADATA +200 -187
  2. pandas_market_calendars-4.2.0.dist-info/NOTICE +206 -0
  3. pandas_market_calendars-4.2.0.dist-info/RECORD +6 -0
  4. {pandas_market_calendars-4.1.3.dist-info → pandas_market_calendars-4.2.0.dist-info}/WHEEL +1 -1
  5. pandas_market_calendars/__init__.py +0 -37
  6. pandas_market_calendars/calendar_registry.py +0 -47
  7. pandas_market_calendars/calendar_utils.py +0 -225
  8. pandas_market_calendars/class_registry.py +0 -111
  9. pandas_market_calendars/exchange_calendar_asx.py +0 -63
  10. pandas_market_calendars/exchange_calendar_bmf.py +0 -227
  11. pandas_market_calendars/exchange_calendar_bse.py +0 -409
  12. pandas_market_calendars/exchange_calendar_cboe.py +0 -115
  13. pandas_market_calendars/exchange_calendar_cme.py +0 -240
  14. pandas_market_calendars/exchange_calendar_cme_globex_agriculture.py +0 -109
  15. pandas_market_calendars/exchange_calendar_cme_globex_base.py +0 -106
  16. pandas_market_calendars/exchange_calendar_cme_globex_energy_and_metals.py +0 -146
  17. pandas_market_calendars/exchange_calendar_cme_globex_equities.py +0 -104
  18. pandas_market_calendars/exchange_calendar_cme_globex_fixed_income.py +0 -114
  19. pandas_market_calendars/exchange_calendar_cme_globex_fx.py +0 -78
  20. pandas_market_calendars/exchange_calendar_eurex.py +0 -119
  21. pandas_market_calendars/exchange_calendar_hkex.py +0 -408
  22. pandas_market_calendars/exchange_calendar_ice.py +0 -65
  23. pandas_market_calendars/exchange_calendar_iex.py +0 -98
  24. pandas_market_calendars/exchange_calendar_jpx.py +0 -98
  25. pandas_market_calendars/exchange_calendar_lse.py +0 -91
  26. pandas_market_calendars/exchange_calendar_nyse.py +0 -1127
  27. pandas_market_calendars/exchange_calendar_ose.py +0 -150
  28. pandas_market_calendars/exchange_calendar_sifma.py +0 -300
  29. pandas_market_calendars/exchange_calendar_six.py +0 -114
  30. pandas_market_calendars/exchange_calendar_sse.py +0 -290
  31. pandas_market_calendars/exchange_calendar_tase.py +0 -119
  32. pandas_market_calendars/exchange_calendar_tsx.py +0 -159
  33. pandas_market_calendars/exchange_calendars_mirror.py +0 -114
  34. pandas_market_calendars/holidays_cme.py +0 -341
  35. pandas_market_calendars/holidays_cme_globex.py +0 -169
  36. pandas_market_calendars/holidays_cn.py +0 -1436
  37. pandas_market_calendars/holidays_jp.py +0 -362
  38. pandas_market_calendars/holidays_nyse.py +0 -1474
  39. pandas_market_calendars/holidays_oz.py +0 -65
  40. pandas_market_calendars/holidays_sifma.py +0 -321
  41. pandas_market_calendars/holidays_uk.py +0 -177
  42. pandas_market_calendars/holidays_us.py +0 -364
  43. pandas_market_calendars/jpx_equinox.py +0 -147
  44. pandas_market_calendars/market_calendar.py +0 -770
  45. pandas_market_calendars-4.1.3.dist-info/RECORD +0 -45
  46. {pandas_market_calendars-4.1.3.dist-info → pandas_market_calendars-4.2.0.dist-info}/LICENSE +0 -0
  47. {pandas_market_calendars-4.1.3.dist-info → pandas_market_calendars-4.2.0.dist-info}/top_level.txt +0 -0
@@ -1,341 +0,0 @@
1
- import datetime
2
-
3
- from dateutil.relativedelta import (MO, FR)
4
- from dateutil.relativedelta import (TH)
5
- from pandas import (DateOffset, Timestamp)
6
- from pandas.tseries.holiday import (Holiday, Easter)
7
- from pandas.tseries.holiday import (nearest_workday)
8
- from pandas.tseries.offsets import (Day)
9
-
10
-
11
- #########
12
- # Martin Luther King
13
- #########
14
- USMartinLutherKingJrAfter1998Before2022 = Holiday(
15
- 'Dr. Martin Luther King Jr. Day',
16
- month=1,
17
- day=1,
18
- # The US markets didn't observe MLK day as a holiday until 1998.
19
- start_date=Timestamp('1998-01-01'),
20
- end_date=Timestamp('2021-12-31'),
21
- offset=DateOffset(weekday=MO(3)),
22
- )
23
-
24
- USMartinLutherKingJrAfter1998Before2015 = Holiday(
25
- 'Dr. Martin Luther King Jr. Day',
26
- month=1,
27
- day=1,
28
- # The US markets didn't observe MLK day as a holiday until 1998.
29
- start_date=Timestamp('1998-01-01'),
30
- end_date=Timestamp('2014-12-31'),
31
- offset=DateOffset(weekday=MO(3)),)
32
-
33
- USMartinLutherKingJrAfter2015 = Holiday(
34
- 'Dr. Martin Luther King Jr. Day',
35
- month=1,
36
- day=1,
37
- # The US markets didn't observe MLK day as a holiday until 1998.
38
- start_date=Timestamp('2015-01-01'),
39
- offset=DateOffset(weekday=MO(3)),)
40
-
41
- USMartinLutherKingJrAfter1998Before2016FridayBefore = Holiday(
42
- "Dr. Martin Luther King Jr. Day",
43
- month= 1,
44
- day= 1,
45
- start_date= Timestamp("1998-01-01"),
46
- end_date= Timestamp("2015-12-31"),
47
- offset= [DateOffset(weekday= MO(3)), DateOffset(weekday= FR(-1))]
48
- )
49
-
50
- #########
51
- # President's Day
52
- #########
53
- USPresidentsDayBefore2022 = Holiday(
54
- 'President''s Day',
55
- start_date=Timestamp('1971-01-01'),
56
- end_date=Timestamp('2021-12-31'),
57
- month=2, day=1,
58
- offset=DateOffset(weekday=MO(3)),
59
- )
60
- USPresidentsDayBefore2015 = Holiday(
61
- 'President''s Day',
62
- start_date=Timestamp('1971-01-01'),
63
- end_date=Timestamp('2014-12-31'),
64
- month=2, day=1,
65
- offset=DateOffset(weekday=MO(3)),)
66
-
67
- USPresidentsDayAfter2015 = Holiday(
68
- 'President''s Day',
69
- start_date=Timestamp('2015-01-01'),
70
- month=2, day=1,
71
- offset=DateOffset(weekday=MO(3)),)
72
-
73
- USPresidentsDayBefore2016FridayBefore = Holiday(
74
- 'President''s Day',
75
- start_date=Timestamp('1971-01-01'),
76
- end_date=Timestamp('2015-12-31'),
77
- month=2, day=1,
78
- offset=[DateOffset(weekday=MO(3)), DateOffset(weekday= FR(-1))]
79
- )
80
-
81
- #########
82
- # Good Friday
83
- #########
84
-
85
-
86
- GoodFridayBefore2021 = Holiday(
87
- "Good Friday",
88
- month=1, day=1,
89
- offset=[Easter(), Day(-2)],
90
- end_date=Timestamp('2020-12-31'),
91
- )
92
-
93
- # On some years (i.e. 2010,2012,2015) there is a special close for equities at 08:15
94
- # so here it is made sure that those are not full holidays
95
- easter = Easter()
96
- daymin2 = Day(-2)
97
- def not_0815_close(dt):
98
- if dt.year in (2010, 2012, 2015):
99
- return None
100
- else:
101
- return dt + easter + daymin2
102
-
103
- GoodFridayBefore2021NotEarlyClose = Holiday(
104
- "Good Friday",
105
- month=1, day=1,
106
- observance=not_0815_close,
107
- end_date=Timestamp('2020-12-31'),
108
- )
109
-
110
- ## CME Interest Rate Products have this odd close
111
- GoodFriday2009 = Holiday(
112
- "Good Friday",
113
- month= 1, day= 1,
114
- offset= [Easter(), Day(-3)],
115
- start_date= Timestamp("2009-01-01"),
116
- end_date= Timestamp("2009-12-31"),
117
- )
118
-
119
- GoodFriday2021 = Holiday(
120
- "Good Friday",
121
- month=1, day=1,
122
- offset=[Easter(), Day(-2)],
123
- start_date=Timestamp('2021-01-01'),
124
- end_date=Timestamp('2021-12-31'),
125
- )
126
- GoodFridayAfter2021 = Holiday(
127
- "Good Friday",
128
- month=1, day=1,
129
- offset=[Easter(), Day(-2)],
130
- start_date=Timestamp('2022-01-01'),
131
- )
132
- # Dates when equities closed at 08:15
133
- GoodFriday2010 = Holiday(
134
- "Good Friday",
135
- month=1, day=1,
136
- offset=[Easter(), Day(-2)],
137
- start_date=Timestamp('2010-01-01'),
138
- end_date=Timestamp('2010-12-31'),
139
- )
140
- GoodFriday2012 = Holiday(
141
- "Good Friday",
142
- month=1, day=1,
143
- offset=[Easter(), Day(-2)],
144
- start_date=Timestamp('2012-01-01'),
145
- end_date=Timestamp('2012-12-31'),)
146
-
147
- GoodFriday2015 = Holiday(
148
- "Good Friday",
149
- month=1, day=1,
150
- offset=[Easter(), Day(-2)],
151
- start_date=Timestamp('2015-01-01'),
152
- end_date=Timestamp('2015-12-31'),
153
- )
154
-
155
- #########
156
- # Memorial Day
157
- #########
158
-
159
- USMemorialDay2021AndPrior = Holiday(
160
- 'Memorial Day',
161
- month=5,
162
- day=25,
163
- start_date=Timestamp('1971-01-01'),
164
- end_date=Timestamp('2021-12-31'),
165
- offset=DateOffset(weekday=MO(1)),
166
- )#### Equity Products
167
- USMemorialDay2013AndPrior = Holiday(
168
- 'Memorial Day',
169
- month=5,
170
- day=25,
171
- start_date=Timestamp('1971-01-01'),
172
- end_date=Timestamp('2013-12-31'),
173
- offset=DateOffset(weekday=MO(1)),
174
- )
175
- USMemorialDayAfter2013 = Holiday(
176
- 'Memorial Day',
177
- month=5,
178
- day=25,
179
- start_date=Timestamp('2014-01-01'),
180
- offset=DateOffset(weekday=MO(1)),
181
- )
182
- USMemorialDay2015AndPriorFridayBefore = Holiday(
183
- 'Memorial Day',
184
- month=5,
185
- day=25,
186
- start_date=Timestamp('1971-01-01'),
187
- end_date=Timestamp('2015-12-31'),
188
- offset=[DateOffset(weekday=MO(1)), DateOffset(weekday= FR(-1))],
189
- )
190
-
191
- #######
192
- # Independence Day
193
- #######
194
-
195
- USIndependenceDayBefore2022 = Holiday(
196
- 'July 4th',
197
- month=7,
198
- day=4,
199
- start_date=Timestamp('1954-01-01'),
200
- end_date=Timestamp('2021-12-31'),
201
- observance=nearest_workday,)
202
- USIndependenceDayBefore2014 = Holiday(
203
- 'July 4th',
204
- month=7,
205
- day=4,
206
- start_date=Timestamp('1954-01-01'),
207
- end_date=Timestamp('2013-12-31'),
208
- observance=nearest_workday,)
209
- USIndependenceDayAfter2014 = Holiday(
210
- 'July 4th',
211
- month=7,
212
- day=4,
213
- start_date=Timestamp('2014-01-01'),
214
- observance=nearest_workday,)
215
-
216
- # Necessary for equities
217
- def previous_workday_if_july_4th_is_tue_to_fri(dt):
218
- july4th = datetime.datetime(dt.year, 7, 4)
219
- if july4th.weekday() in (1, 2, 3, 4):
220
- return july4th - datetime.timedelta(days= 1)
221
- # else None
222
-
223
- USIndependenceDayBefore2022PreviousDay = Holiday(
224
- 'July 4th',
225
- month=7,
226
- day=4,
227
- start_date=Timestamp('1954-01-01'),
228
- observance= previous_workday_if_july_4th_is_tue_to_fri
229
- )
230
-
231
- #########
232
- # Labor Day
233
- #########
234
-
235
- USLaborDayStarting1887Before2022 = Holiday(
236
- "Labor Day",
237
- month=9,
238
- day=1,
239
- start_date=Timestamp("1887-01-01"),
240
- end_date=Timestamp('2021-12-31'),
241
- offset=DateOffset(weekday=MO(1))
242
- )
243
- USLaborDayStarting1887Before2014 = Holiday(
244
- "Labor Day",
245
- month=9,
246
- day=1,
247
- start_date=Timestamp("1887-01-01"),
248
- end_date=Timestamp('2013-12-31'),
249
- offset=DateOffset(weekday=MO(1))
250
- )
251
- USLaborDayStarting1887Before2015FridayBefore = Holiday(
252
- "Labor Day",
253
- month=9,
254
- day=1,
255
- start_date=Timestamp("1887-01-01"),
256
- end_date=Timestamp('2014-12-31'),
257
- offset=[DateOffset(weekday=MO(1)), DateOffset(weekday=FR(-1))]
258
-
259
- )
260
- USLaborDayStarting1887After2014 = Holiday(
261
- "Labor Day",
262
- month=9,
263
- day=1,
264
- start_date=Timestamp("2014-01-01"),
265
- offset=DateOffset(weekday=MO(1))
266
- )
267
-
268
-
269
- #########
270
- # Thanksgiving
271
- #########
272
-
273
- USThanksgivingBefore2022 = Holiday(
274
- 'ThanksgivingFriday',
275
- start_date=Timestamp('1942-01-01'),
276
- end_date=Timestamp('2021-12-31'),
277
- month=11, day=1,
278
- offset=DateOffset(weekday=TH(4)),
279
- )
280
- USThanksgivingBefore2014 = Holiday(
281
- 'ThanksgivingFriday',
282
- start_date=Timestamp('1942-01-01'),
283
- end_date=Timestamp('2013-12-31'),
284
- month=11, day=1,
285
- offset=DateOffset(weekday=TH(4)),
286
- )
287
- USThanksgivingAfter2014 = Holiday(
288
- 'ThanksgivingFriday',
289
- start_date=Timestamp('2014-01-01'),
290
- month=11, day=1,
291
- offset=DateOffset(weekday=TH(4)),
292
- )
293
-
294
- ######## The following Holidays shouldn't be set with the FR offset
295
- ## In 2013, Nov 1st is a friday, so the 4th Friday is before the 4th Thursday...
296
- # the observance rule defined herafter fixes this
297
-
298
- # USThanksgivingFridayBefore2022 = Holiday(
299
- # 'ThanksgivingFriday',
300
- # start_date=Timestamp('1942-01-01'),
301
- # end_date=Timestamp('2021-12-31'),
302
- # month=11, day=1,
303
- # offset=DateOffset(weekday=FR(4)),
304
- # )
305
- #
306
- # USThanksgivingFriday2022AndAfter = Holiday(
307
- # 'ThanksgivingFriday',
308
- # start_date=Timestamp('2022-01-01'),
309
- # month=11, day=1,
310
- # offset=DateOffset(weekday=FR(4)),
311
- # )
312
- # USThanksgivingFriday = Holiday(
313
- # 'ThanksgivingFriday',
314
- # month=11, day=1,
315
- # offset=DateOffset(weekday=FR(4)),
316
- # )
317
-
318
- def fri_after_4th_thu(dt):
319
- # dt will just be Nov 1st
320
- diff_to_thu = 3 - dt.weekday()
321
- if diff_to_thu < 0: diff_to_thu += 7
322
- return dt + datetime.timedelta(days=diff_to_thu + 22)
323
-
324
- USThanksgivingFriday = Holiday(
325
- 'ThanksgivingFriday',
326
- start_date=Timestamp('1942-01-01'),
327
- month=11, day=1,
328
- observance= fri_after_4th_thu,
329
- )
330
-
331
- USThanksgivingFriday2022AndAfter = Holiday(
332
- 'ThanksgivingFriday',
333
- start_date=Timestamp('2022-01-01'),
334
- month=11, day=1,
335
- observance= fri_after_4th_thu,
336
- )
337
- # USThanksgivingFriday = Holiday(
338
- # 'ThanksgivingFriday',
339
- # month=11, day=1,
340
- # observance= fri_after_4th_thu,
341
- # )
@@ -1,169 +0,0 @@
1
- from dateutil.relativedelta import (MO, TU, WE, TH, FR, SA, SU)
2
- from pandas import (DateOffset, Timestamp, date_range)
3
- from datetime import timedelta
4
- from pandas.tseries.holiday import (Holiday, nearest_workday, sunday_to_monday, Easter)
5
- from pandas.tseries.offsets import Day, CustomBusinessDay
6
-
7
- from pandas_market_calendars.market_calendar import ( MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY)
8
-
9
-
10
-
11
- ####################################################
12
- # US New Years Day Jan 1
13
- #####################################################
14
- USNewYearsDay = Holiday(
15
- 'New Years Day',
16
- month=1,
17
- day=1,
18
- start_date = Timestamp('1952-09-29'),
19
- #observance=sunday_to_monday,
20
- days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY,)
21
- )
22
-
23
-
24
-
25
- #########################################################################
26
- # Martin Luther King Jr.
27
- # Starting 1998
28
- ##########################################################################
29
- USMartinLutherKingJrFrom2022 = Holiday( # Early Close 1:30pm
30
- 'Dr. Martin Luther King Jr. Day',
31
- month=1,
32
- day=1,
33
- start_date=Timestamp('2022-01-01'),
34
- days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY,),
35
- offset=DateOffset(weekday=MO(3)),
36
- )
37
-
38
- USMartinLutherKingJrPre2022 = Holiday( # Early Close 12:00pm
39
- 'Dr. Martin Luther King Jr. Day',
40
- month=1,
41
- day=1,
42
- start_date=Timestamp('1998-01-01'),
43
- end_date=Timestamp("2021-12-31"),
44
- offset=DateOffset(weekday=MO(3)),
45
- )
46
-
47
-
48
- #########################################################################
49
- # US Presidents Day Feb
50
- ##########################################################################
51
- USPresidentsDayFrom2022 = Holiday('President''s Day', # 1:30pm Early Close
52
- start_date=Timestamp('2022-01-01'),
53
- month=2, day=1,
54
- offset=DateOffset(weekday=MO(3)))
55
-
56
- USPresidentsDayPre2022 = Holiday('President''s Day', # 12:00pm Early Close
57
- end_date=Timestamp('2021-12-31'),
58
- month=2, day=1,
59
- offset=DateOffset(weekday=MO(3)))
60
-
61
-
62
-
63
- ############################################################
64
- # Good Friday
65
- ############################################################
66
- GoodFriday = Holiday(
67
- "Good Friday 1908+",
68
- start_date=Timestamp('1908-01-01'),
69
- month=1,
70
- day=1,
71
- offset=[Easter(), Day(-2)]
72
- )
73
-
74
- ##################################################
75
- # US Memorial Day (Decoration Day) May 30
76
- ##################################################
77
- USMemorialDayFrom2022 = Holiday( # 1:30pm early close
78
- 'Memorial Day',
79
- month=5,
80
- day=25,
81
- start_date=Timestamp('2022-01-01'),
82
- offset=DateOffset(weekday=MO(1)),
83
- )
84
-
85
- USMemorialDayPre2022 = Holiday( # 12:00pm early close
86
- 'Memorial Day',
87
- month=5,
88
- day=25,
89
- end_date=Timestamp('2021-12-31'),
90
- offset=DateOffset(weekday=MO(1)),
91
- )
92
-
93
- #######################################
94
- # US Juneteenth (June 19th)
95
- #######################################
96
- USJuneteenthFrom2022 = Holiday(
97
- 'Juneteenth Starting at 2022',
98
- start_date=Timestamp('2022-06-19'),
99
- month=6, day=19,
100
- observance=nearest_workday,
101
- )
102
-
103
- #######################################
104
- # US Independence Day July 4
105
- #######################################
106
- USIndependenceDayFrom2022 = Holiday(
107
- 'July 4th',
108
- month=7,
109
- day=4,
110
- start_date=Timestamp('2022-01-01'),
111
- observance=nearest_workday,
112
- )
113
- USIndependenceDayPre2022 = Holiday(
114
- 'July 4th',
115
- month=7,
116
- day=4,
117
- end_date=Timestamp('2021-12-31'),
118
- observance=nearest_workday,
119
- )
120
-
121
-
122
- #################################################
123
- # US Labor Day Starting 1887
124
- #################################################
125
- USLaborDay = Holiday(
126
- "Labor Day",
127
- month=9,
128
- day=1,
129
- start_date=Timestamp("1887-01-01"),
130
- offset=DateOffset(weekday=MO(1))
131
- )
132
-
133
-
134
- ################################################
135
- # US Thanksgiving Nov 30
136
- ################################################
137
- USThanksgivingDayFrom2022 = Holiday(
138
- 'Thanksgiving',
139
- start_date=Timestamp('2022-01-01'),
140
- month=11, day=1,
141
- offset=DateOffset(weekday=TH(4))
142
- )
143
-
144
- USThanksgivingDayPre2022 = Holiday(
145
- 'Thanksgiving',
146
- end_date=Timestamp('2021-12-31'),
147
- month=11, day=1,
148
- offset=DateOffset(weekday=TH(4))
149
- )
150
-
151
- FridayAfterThanksgiving = Holiday(
152
- 'Friday after Thanksgiving',
153
- month=11,
154
- day=1,
155
- offset=[DateOffset(weekday=TH(4)), Day(1)],
156
- )
157
-
158
-
159
- ################################
160
- # Christmas Dec 25
161
- ################################
162
- ChristmasCME = Holiday(
163
- 'Christmas',
164
- month=12,
165
- day=25,
166
- start_date=Timestamp('1999-01-01'),
167
- observance=nearest_workday,
168
- )
169
-