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,360 +1,376 @@
1
- from dateutil.relativedelta import (MO, TH, TU, FR)
2
- from pandas import (DateOffset, Timestamp, date_range)
3
- from pandas.tseries.holiday import (Holiday, nearest_workday, sunday_to_monday)
4
- from pandas.tseries.offsets import Day
5
-
6
- from pandas_market_calendars.market_calendar import (FRIDAY, MONDAY, THURSDAY, TUESDAY, WEDNESDAY)
7
-
8
-
9
- # These have the same definition, but are used in different places because the
10
- # NYSE closed at 2:00 PM on Christmas Eve until 1993.
11
-
12
-
13
- def following_tuesday_every_four_years_observance(dt):
14
- return dt + DateOffset(years=(4 - (dt.year % 4)) % 4, weekday=TU(1))
15
-
16
-
17
- ChristmasEveBefore1993 = Holiday(
18
- 'Christmas Eve',
19
- month=12,
20
- day=24,
21
- end_date=Timestamp('1993-01-01'),
22
- # When Christmas is a Saturday, the 24th is a full holiday.
23
- days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY),
24
- )
25
- ChristmasEveInOrAfter1993 = Holiday(
26
- 'Christmas Eve',
27
- month=12,
28
- day=24,
29
- start_date=Timestamp('1993-01-01'),
30
- # When Christmas is a Saturday, the 24th is a full holiday.
31
- days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY),
32
- )
33
- USNewYearsDay = Holiday(
34
- 'New Years Day',
35
- month=1,
36
- day=1,
37
- # When Jan 1 is a Sunday, US markets observe the subsequent Monday.
38
- # When Jan 1 is a Saturday (as in 2005 and 2011), no holiday is observed.
39
- observance=sunday_to_monday
40
- )
41
- USMartinLutherKingJrAfter1998 = Holiday(
42
- 'Dr. Martin Luther King Jr. Day',
43
- month=1,
44
- day=1,
45
- # The US markets didn't observe MLK day as a holiday until 1998.
46
- start_date=Timestamp('1998-01-01'),
47
- offset=DateOffset(weekday=MO(3)),
48
- )
49
- USLincolnsBirthDayBefore1954 = Holiday(
50
- 'Lincoln''s Birthday',
51
- month=2,
52
- day=12,
53
- start_date=Timestamp('1874-01-01'),
54
- end_date=Timestamp('1953-12-31'),
55
- observance=sunday_to_monday,
56
- )
57
- USWashingtonsBirthDayBefore1964 = Holiday(
58
- 'Washington''s Birthday',
59
- month=2,
60
- day=22,
61
- start_date=Timestamp('1880-01-01'),
62
- end_date=Timestamp('1963-12-31'),
63
- observance=sunday_to_monday,
64
- )
65
- USWashingtonsBirthDay1964to1970 = Holiday(
66
- 'Washington''s Birthday',
67
- month=2,
68
- day=22,
69
- start_date=Timestamp('1964-01-01'),
70
- end_date=Timestamp('1970-12-31'),
71
- observance=nearest_workday,
72
- )
73
- USPresidentsDay = Holiday('President''s Day',
74
- start_date=Timestamp('1971-01-01'),
75
- month=2, day=1,
76
- offset=DateOffset(weekday=MO(3)))
77
- # http://www.tradingtheodds.com/nyse-full-day-closings/
78
- USThanksgivingDayBefore1939 = Holiday('Thanksgiving Before 1939',
79
- start_date=Timestamp('1864-01-01'),
80
- end_date=Timestamp('1938-12-31'),
81
- month=11, day=30,
82
- offset=DateOffset(weekday=TH(-1)))
83
- # http://www.tradingtheodds.com/nyse-full-day-closings/
84
- USThanksgivingDay1939to1941 = Holiday('Thanksgiving 1939 to 1941',
85
- start_date=Timestamp('1939-01-01'),
86
- end_date=Timestamp('1941-12-31'),
87
- month=11, day=30,
88
- offset=DateOffset(weekday=TH(-2)))
89
- USThanksgivingDay = Holiday('Thanksgiving',
90
- start_date=Timestamp('1942-01-01'),
91
- month=11, day=1,
92
- offset=DateOffset(weekday=TH(4)))
93
- # http://www.tradingtheodds.com/nyse-full-day-closings/
94
- USMemorialDayBefore1964 = Holiday(
95
- 'Memorial Day',
96
- month=5,
97
- day=30,
98
- end_date=Timestamp('1963-12-31'),
99
- observance=sunday_to_monday,
100
- )
101
- # http://www.tradingtheodds.com/nyse-full-day-closings/
102
- USMemorialDay1964to1969 = Holiday(
103
- 'Memorial Day',
104
- month=5,
105
- day=30,
106
- start_date=Timestamp('1964-01-01'),
107
- end_date=Timestamp('1969-12-31'),
108
- observance=nearest_workday,
109
- )
110
- USMemorialDay = Holiday(
111
- # NOTE: The definition for Memorial Day is incorrect as of pandas 0.16.0.
112
- # See https://github.com/pydata/pandas/issues/9760.
113
- 'Memorial Day',
114
- month=5,
115
- day=25,
116
- start_date=Timestamp('1971-01-01'),
117
- offset=DateOffset(weekday=MO(1)),
118
- )
119
- # http://www.tradingtheodds.com/nyse-full-day-closings/
120
- USIndependenceDayBefore1954 = Holiday(
121
- 'July 4th',
122
- month=7,
123
- day=4,
124
- end_date=Timestamp('1953-12-31'),
125
- observance=sunday_to_monday,
126
- )
127
- USIndependenceDay = Holiday(
128
- 'July 4th',
129
- month=7,
130
- day=4,
131
- start_date=Timestamp('1954-01-01'),
132
- observance=nearest_workday,
133
- )
134
- # http://www.tradingtheodds.com/nyse-full-day-closings/
135
- USElectionDay1848to1967 = Holiday(
136
- 'Election Day',
137
- month=11,
138
- day=2,
139
- start_date=Timestamp('1848-1-1'),
140
- end_date=Timestamp('1967-12-31'),
141
- offset=DateOffset(weekday=TU(1)),
142
- )
143
- # http://www.tradingtheodds.com/nyse-full-day-closings/
144
- USElectionDay1968to1980 = Holiday(
145
- 'Election Day',
146
- month=11,
147
- day=2,
148
- start_date=Timestamp('1968-01-01'),
149
- end_date=Timestamp('1980-12-31'),
150
- observance=following_tuesday_every_four_years_observance
151
- )
152
- # http://www.tradingtheodds.com/nyse-full-day-closings/
153
- USVeteransDay1934to1953 = Holiday(
154
- 'Veteran Day',
155
- month=11,
156
- day=11,
157
- start_date=Timestamp('1934-1-1'),
158
- end_date=Timestamp('1953-12-31'),
159
- observance=sunday_to_monday,
160
- )
161
- # http://www.tradingtheodds.com/nyse-full-day-closings/
162
- USColumbusDayBefore1954 = Holiday(
163
- 'Columbus Day',
164
- month=10,
165
- day=12,
166
- end_date=Timestamp('1953-12-31'),
167
- observance=sunday_to_monday,
168
- )
169
- ChristmasBefore1954 = Holiday(
170
- 'Christmas',
171
- month=12,
172
- day=25,
173
- end_date=Timestamp('1953-12-31'),
174
- observance=sunday_to_monday,
175
- )
176
- Christmas = Holiday(
177
- 'Christmas',
178
- month=12,
179
- day=25,
180
- start_date=Timestamp('1954-01-01'),
181
- observance=nearest_workday,
182
- )
183
-
184
- MonTuesThursBeforeIndependenceDay = Holiday(
185
- # When July 4th is a Tuesday, Wednesday, or Friday, the previous day is a
186
- # half day.
187
- 'Mondays, Tuesdays, and Thursdays Before Independence Day',
188
- month=7,
189
- day=3,
190
- days_of_week=(MONDAY, TUESDAY, THURSDAY),
191
- start_date=Timestamp("1995-01-01"),
192
- )
193
- FridayAfterIndependenceDayPre2013 = Holiday(
194
- # When July 4th is a Thursday, the next day is a half day prior to 2013.
195
- # Since 2013 the early close is on Wednesday and Friday is a full day
196
- "Fridays after Independence Day prior to 2013",
197
- month=7,
198
- day=5,
199
- days_of_week=(FRIDAY,),
200
- start_date=Timestamp("1995-01-01"),
201
- end_date=Timestamp("2012-12-31"),
202
- )
203
- WednesdayBeforeIndependenceDayPost2013 = Holiday(
204
- # When July 4th is a Thursday, the next day is a half day prior to 2013.
205
- # Since 2013 the early close is on Wednesday and Friday is a full day
206
- "Wednesdays Before Independence Day including and after 2013",
207
- month=7,
208
- day=3,
209
- days_of_week=(WEDNESDAY,),
210
- start_date=Timestamp("2013-01-01"),
211
- )
212
- USBlackFridayBefore1993 = Holiday(
213
- 'Black Friday',
214
- month=11,
215
- day=1,
216
- # Black Friday was not observed until 1992.
217
- start_date=Timestamp('1992-01-01'),
218
- end_date=Timestamp('1993-01-01'),
219
- offset=[DateOffset(weekday=TH(4)), Day(1)],
220
- )
221
- USBlackFridayInOrAfter1993 = Holiday(
222
- 'Black Friday',
223
- month=11,
224
- day=1,
225
- start_date=Timestamp('1993-01-01'),
226
- offset=[DateOffset(weekday=TH(4)), Day(1)],
227
- )
228
- BattleOfGettysburg = Holiday(
229
- # All of the floor traders in Chicago were sent to PA
230
- 'Markets were closed during the battle of Gettysburg',
231
- month=7,
232
- day=(1, 2, 3),
233
- start_date=Timestamp("1863-07-01"),
234
- end_date=Timestamp("1863-07-03")
235
- )
236
-
237
- # http://www.tradingtheodds.com/nyse-full-day-closings/
238
- November29BacklogRelief = [Timestamp('1929-11-01', tz='UTC'),
239
- Timestamp('1929-11-29', tz='UTC')]
240
-
241
- # https://en.wikipedia.org/wiki/March_1933#March_6,_1933_(Monday)
242
- March33BankHoliday = [
243
- Timestamp("1933-03-06", tz="UTC"),
244
- Timestamp("1933-03-07", tz="UTC"),
245
- Timestamp("1933-03-08", tz="UTC"),
246
- Timestamp("1933-03-09", tz="UTC"),
247
- Timestamp("1933-03-10", tz="UTC"),
248
- Timestamp("1933-03-13", tz="UTC"),
249
- Timestamp("1933-03-14", tz="UTC"),
250
- ]
251
-
252
- # http://www.tradingtheodds.com/nyse-full-day-closings/
253
- August45VictoryOverJapan = date_range('1945-08-15', '1945-08-16', tz='UTC')
254
-
255
- # http://www.tradingtheodds.com/nyse-full-day-closings/
256
- ChristmasEvesAdhoc = [Timestamp('1945-12-24', tz='UTC'),
257
- Timestamp('1956-12-24', tz='UTC')]
258
-
259
- # http://www.tradingtheodds.com/nyse-full-day-closings/
260
- DayAfterChristmasAdhoc = [Timestamp('1958-12-26', tz='UTC')]
261
-
262
- # http://www.tradingtheodds.com/nyse-full-day-closings/
263
- DayBeforeDecorationAdhoc = [Timestamp('1961-05-29', tz='UTC')]
264
-
265
- # http://www.tradingtheodds.com/nyse-full-day-closings/
266
- LincolnsBirthDayAdhoc = [Timestamp('1968-02-12', tz='UTC')]
267
-
268
- # http://www.tradingtheodds.com/nyse-full-day-closings/
269
- PaperworkCrisis68 = [Timestamp('1968-06-12', tz='UTC'),
270
- Timestamp('1968-06-19', tz='UTC'),
271
- Timestamp('1968-06-26', tz='UTC'),
272
- Timestamp('1968-07-10', tz='UTC'),
273
- Timestamp('1968-07-17', tz='UTC'),
274
- Timestamp('1968-07-24', tz='UTC'),
275
- Timestamp('1968-07-31', tz='UTC'),
276
- Timestamp('1968-08-07', tz='UTC'),
277
- Timestamp('1968-08-14', tz='UTC'),
278
- Timestamp('1968-08-21', tz='UTC'),
279
- Timestamp('1968-08-28', tz='UTC'),
280
- Timestamp('1968-09-11', tz='UTC'),
281
- Timestamp('1968-09-18', tz='UTC'),
282
- Timestamp('1968-09-25', tz='UTC'),
283
- Timestamp('1968-10-02', tz='UTC'),
284
- Timestamp('1968-10-09', tz='UTC'),
285
- Timestamp('1968-10-16', tz='UTC'),
286
- Timestamp('1968-10-23', tz='UTC'),
287
- Timestamp('1968-10-30', tz='UTC'),
288
- Timestamp('1968-11-11', tz='UTC'),
289
- Timestamp('1968-11-20', tz='UTC'),
290
- Timestamp('1968-12-04', tz='UTC'),
291
- Timestamp('1968-12-11', tz='UTC'),
292
- Timestamp('1968-12-18', tz='UTC'),
293
- Timestamp('1968-12-25', tz='UTC')]
294
-
295
- # http://www.tradingtheodds.com/nyse-full-day-closings/
296
- DayAfterIndependenceDayAdhoc = [Timestamp('1968-07-05', tz='UTC')]
297
-
298
- # http://www.tradingtheodds.com/nyse-full-day-closings/
299
- WeatherSnowClosing = [Timestamp('1969-02-10', tz='UTC')]
300
-
301
- # http://www.tradingtheodds.com/nyse-full-day-closings/
302
- FirstLunarLandingClosing = [Timestamp('1969-07-21', tz='UTC')]
303
-
304
- # http://www.tradingtheodds.com/nyse-full-day-closings/
305
- NewYorkCityBlackout77 = [Timestamp('1977-07-14', tz='UTC')]
306
-
307
- # http://en.wikipedia.org/wiki/Aftermath_of_the_September_11_attacks
308
- September11Closings = [
309
- Timestamp("2001-09-11", tz='UTC'),
310
- Timestamp("2001-09-12", tz='UTC'),
311
- Timestamp("2001-09-13", tz='UTC'),
312
- Timestamp("2001-09-14", tz='UTC'),
313
- ]
314
-
315
- # http://en.wikipedia.org/wiki/Hurricane_Gloria
316
- HurricaneGloriaClosings = date_range(
317
- '1985-09-27',
318
- '1985-09-27',
319
- tz='UTC'
320
- )
321
-
322
- # http://en.wikipedia.org/wiki/Hurricane_sandy
323
- HurricaneSandyClosings = date_range(
324
- '2012-10-29',
325
- '2012-10-30',
326
- tz='UTC'
327
- )
328
-
329
- # National Days of Mourning
330
- # - President John F. Kennedy - November 25, 1963
331
- # - Martin Luther King - April 9, 1968
332
- # - President Dwight D. Eisenhower - March 31, 1969
333
- # - President Harry S. Truman - December 28, 1972
334
- # - President Lyndon B. Johnson - January 25, 1973
335
- # - President Richard Nixon - April 27, 1994
336
- # - President Ronald W. Reagan - June 11, 2004
337
- # - President Gerald R. Ford - Jan 2, 2007
338
- # - President George H.W. Bush - Dec 5, 2018
339
- USNationalDaysofMourning = [
340
- Timestamp('1963-11-25', tz='UTC'),
341
- Timestamp('1968-04-09', tz='UTC'),
342
- Timestamp('1969-03-31', tz='UTC'),
343
- Timestamp('1972-12-28', tz='UTC'),
344
- Timestamp('1973-01-25', tz='UTC'),
345
- Timestamp('1994-04-27', tz='UTC'),
346
- Timestamp('2004-06-11', tz='UTC'),
347
- Timestamp('2007-01-02', tz='UTC'),
348
- Timestamp('2018-12-05', tz='UTC'),
349
- ]
350
-
351
-
352
- #######################################
353
- # US Juneteenth (June 19th)
354
- #######################################
355
- USJuneteenthAfter2022 = Holiday(
356
- 'Juneteenth Starting at 2022',
357
- start_date=Timestamp('2022-06-19'),
358
- month=6, day=19,
359
- observance=nearest_workday,
360
- )
1
+ from dateutil.relativedelta import MO, TH, TU
2
+ from pandas import DateOffset, Timestamp, date_range
3
+ from pandas.tseries.holiday import Holiday, nearest_workday, sunday_to_monday
4
+ from pandas.tseries.offsets import Day
5
+
6
+ from pandas_market_calendars.market_calendar import (
7
+ FRIDAY,
8
+ MONDAY,
9
+ THURSDAY,
10
+ TUESDAY,
11
+ WEDNESDAY,
12
+ )
13
+
14
+
15
+ # These have the same definition, but are used in different places because the
16
+ # NYSE closed at 2:00 PM on Christmas Eve until 1993.
17
+
18
+
19
+ def following_tuesday_every_four_years_observance(dt):
20
+ return dt + DateOffset(years=(4 - (dt.year % 4)) % 4, weekday=TU(1))
21
+
22
+
23
+ ChristmasEveBefore1993 = Holiday(
24
+ "Christmas Eve",
25
+ month=12,
26
+ day=24,
27
+ end_date=Timestamp("1993-01-01"),
28
+ # When Christmas is a Saturday, the 24th is a full holiday.
29
+ days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY),
30
+ )
31
+ ChristmasEveInOrAfter1993 = Holiday(
32
+ "Christmas Eve",
33
+ month=12,
34
+ day=24,
35
+ start_date=Timestamp("1993-01-01"),
36
+ # When Christmas is a Saturday, the 24th is a full holiday.
37
+ days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY),
38
+ )
39
+ USNewYearsDay = Holiday(
40
+ "New Years Day",
41
+ month=1,
42
+ day=1,
43
+ # When Jan 1 is a Sunday, US markets observe the subsequent Monday.
44
+ # When Jan 1 is a Saturday (as in 2005 and 2011), no holiday is observed.
45
+ observance=sunday_to_monday,
46
+ )
47
+ USMartinLutherKingJrAfter1998 = Holiday(
48
+ "Dr. Martin Luther King Jr. Day",
49
+ month=1,
50
+ day=1,
51
+ # The US markets didn't observe MLK day as a holiday until 1998.
52
+ start_date=Timestamp("1998-01-01"),
53
+ offset=DateOffset(weekday=MO(3)),
54
+ )
55
+ USLincolnsBirthDayBefore1954 = Holiday(
56
+ "Lincoln" "s Birthday",
57
+ month=2,
58
+ day=12,
59
+ start_date=Timestamp("1874-01-01"),
60
+ end_date=Timestamp("1953-12-31"),
61
+ observance=sunday_to_monday,
62
+ )
63
+ USWashingtonsBirthDayBefore1964 = Holiday(
64
+ "Washington" "s Birthday",
65
+ month=2,
66
+ day=22,
67
+ start_date=Timestamp("1880-01-01"),
68
+ end_date=Timestamp("1963-12-31"),
69
+ observance=sunday_to_monday,
70
+ )
71
+ USWashingtonsBirthDay1964to1970 = Holiday(
72
+ "Washington" "s Birthday",
73
+ month=2,
74
+ day=22,
75
+ start_date=Timestamp("1964-01-01"),
76
+ end_date=Timestamp("1970-12-31"),
77
+ observance=nearest_workday,
78
+ )
79
+ USPresidentsDay = Holiday(
80
+ "President" "s Day",
81
+ start_date=Timestamp("1971-01-01"),
82
+ month=2,
83
+ day=1,
84
+ offset=DateOffset(weekday=MO(3)),
85
+ )
86
+ # http://www.tradingtheodds.com/nyse-full-day-closings/
87
+ USThanksgivingDayBefore1939 = Holiday(
88
+ "Thanksgiving Before 1939",
89
+ start_date=Timestamp("1864-01-01"),
90
+ end_date=Timestamp("1938-12-31"),
91
+ month=11,
92
+ day=30,
93
+ offset=DateOffset(weekday=TH(-1)),
94
+ )
95
+ # http://www.tradingtheodds.com/nyse-full-day-closings/
96
+ USThanksgivingDay1939to1941 = Holiday(
97
+ "Thanksgiving 1939 to 1941",
98
+ start_date=Timestamp("1939-01-01"),
99
+ end_date=Timestamp("1941-12-31"),
100
+ month=11,
101
+ day=30,
102
+ offset=DateOffset(weekday=TH(-2)),
103
+ )
104
+ USThanksgivingDay = Holiday(
105
+ "Thanksgiving",
106
+ start_date=Timestamp("1942-01-01"),
107
+ month=11,
108
+ day=1,
109
+ offset=DateOffset(weekday=TH(4)),
110
+ )
111
+ # http://www.tradingtheodds.com/nyse-full-day-closings/
112
+ USMemorialDayBefore1964 = Holiday(
113
+ "Memorial Day",
114
+ month=5,
115
+ day=30,
116
+ end_date=Timestamp("1963-12-31"),
117
+ observance=sunday_to_monday,
118
+ )
119
+ # http://www.tradingtheodds.com/nyse-full-day-closings/
120
+ USMemorialDay1964to1969 = Holiday(
121
+ "Memorial Day",
122
+ month=5,
123
+ day=30,
124
+ start_date=Timestamp("1964-01-01"),
125
+ end_date=Timestamp("1969-12-31"),
126
+ observance=nearest_workday,
127
+ )
128
+ USMemorialDay = Holiday(
129
+ # NOTE: The definition for Memorial Day is incorrect as of pandas 0.16.0.
130
+ # See https://github.com/pydata/pandas/issues/9760.
131
+ "Memorial Day",
132
+ month=5,
133
+ day=25,
134
+ start_date=Timestamp("1971-01-01"),
135
+ offset=DateOffset(weekday=MO(1)),
136
+ )
137
+ # http://www.tradingtheodds.com/nyse-full-day-closings/
138
+ USIndependenceDayBefore1954 = Holiday(
139
+ "July 4th",
140
+ month=7,
141
+ day=4,
142
+ end_date=Timestamp("1953-12-31"),
143
+ observance=sunday_to_monday,
144
+ )
145
+ USIndependenceDay = Holiday(
146
+ "July 4th",
147
+ month=7,
148
+ day=4,
149
+ start_date=Timestamp("1954-01-01"),
150
+ observance=nearest_workday,
151
+ )
152
+ # http://www.tradingtheodds.com/nyse-full-day-closings/
153
+ USElectionDay1848to1967 = Holiday(
154
+ "Election Day",
155
+ month=11,
156
+ day=2,
157
+ start_date=Timestamp("1848-1-1"),
158
+ end_date=Timestamp("1967-12-31"),
159
+ offset=DateOffset(weekday=TU(1)),
160
+ )
161
+ # http://www.tradingtheodds.com/nyse-full-day-closings/
162
+ USElectionDay1968to1980 = Holiday(
163
+ "Election Day",
164
+ month=11,
165
+ day=2,
166
+ start_date=Timestamp("1968-01-01"),
167
+ end_date=Timestamp("1980-12-31"),
168
+ observance=following_tuesday_every_four_years_observance,
169
+ )
170
+ # http://www.tradingtheodds.com/nyse-full-day-closings/
171
+ USVeteransDay1934to1953 = Holiday(
172
+ "Veteran Day",
173
+ month=11,
174
+ day=11,
175
+ start_date=Timestamp("1934-1-1"),
176
+ end_date=Timestamp("1953-12-31"),
177
+ observance=sunday_to_monday,
178
+ )
179
+ # http://www.tradingtheodds.com/nyse-full-day-closings/
180
+ USColumbusDayBefore1954 = Holiday(
181
+ "Columbus Day",
182
+ month=10,
183
+ day=12,
184
+ end_date=Timestamp("1953-12-31"),
185
+ observance=sunday_to_monday,
186
+ )
187
+ ChristmasBefore1954 = Holiday(
188
+ "Christmas",
189
+ month=12,
190
+ day=25,
191
+ end_date=Timestamp("1953-12-31"),
192
+ observance=sunday_to_monday,
193
+ )
194
+ Christmas = Holiday(
195
+ "Christmas",
196
+ month=12,
197
+ day=25,
198
+ start_date=Timestamp("1954-01-01"),
199
+ observance=nearest_workday,
200
+ )
201
+
202
+ MonTuesThursBeforeIndependenceDay = Holiday(
203
+ # When July 4th is a Tuesday, Wednesday, or Friday, the previous day is a
204
+ # half day.
205
+ "Mondays, Tuesdays, and Thursdays Before Independence Day",
206
+ month=7,
207
+ day=3,
208
+ days_of_week=(MONDAY, TUESDAY, THURSDAY),
209
+ start_date=Timestamp("1995-01-01"),
210
+ )
211
+ FridayAfterIndependenceDayPre2013 = Holiday(
212
+ # When July 4th is a Thursday, the next day is a half day prior to 2013.
213
+ # Since 2013 the early close is on Wednesday and Friday is a full day
214
+ "Fridays after Independence Day prior to 2013",
215
+ month=7,
216
+ day=5,
217
+ days_of_week=(FRIDAY,),
218
+ start_date=Timestamp("1995-01-01"),
219
+ end_date=Timestamp("2012-12-31"),
220
+ )
221
+ WednesdayBeforeIndependenceDayPost2013 = Holiday(
222
+ # When July 4th is a Thursday, the next day is a half day prior to 2013.
223
+ # Since 2013 the early close is on Wednesday and Friday is a full day
224
+ "Wednesdays Before Independence Day including and after 2013",
225
+ month=7,
226
+ day=3,
227
+ days_of_week=(WEDNESDAY,),
228
+ start_date=Timestamp("2013-01-01"),
229
+ )
230
+ USBlackFridayBefore1993 = Holiday(
231
+ "Black Friday",
232
+ month=11,
233
+ day=1,
234
+ # Black Friday was not observed until 1992.
235
+ start_date=Timestamp("1992-01-01"),
236
+ end_date=Timestamp("1993-01-01"),
237
+ offset=[DateOffset(weekday=TH(4)), Day(1)],
238
+ )
239
+ USBlackFridayInOrAfter1993 = Holiday(
240
+ "Black Friday",
241
+ month=11,
242
+ day=1,
243
+ start_date=Timestamp("1993-01-01"),
244
+ offset=[DateOffset(weekday=TH(4)), Day(1)],
245
+ )
246
+ BattleOfGettysburg = Holiday(
247
+ # All of the floor traders in Chicago were sent to PA
248
+ "Markets were closed during the battle of Gettysburg",
249
+ month=7,
250
+ day=(1, 2, 3),
251
+ start_date=Timestamp("1863-07-01"),
252
+ end_date=Timestamp("1863-07-03"),
253
+ )
254
+
255
+ # http://www.tradingtheodds.com/nyse-full-day-closings/
256
+ November29BacklogRelief = [
257
+ Timestamp("1929-11-01", tz="UTC"),
258
+ Timestamp("1929-11-29", tz="UTC"),
259
+ ]
260
+
261
+ # https://en.wikipedia.org/wiki/March_1933#March_6,_1933_(Monday)
262
+ March33BankHoliday = [
263
+ Timestamp("1933-03-06", tz="UTC"),
264
+ Timestamp("1933-03-07", tz="UTC"),
265
+ Timestamp("1933-03-08", tz="UTC"),
266
+ Timestamp("1933-03-09", tz="UTC"),
267
+ Timestamp("1933-03-10", tz="UTC"),
268
+ Timestamp("1933-03-13", tz="UTC"),
269
+ Timestamp("1933-03-14", tz="UTC"),
270
+ ]
271
+
272
+ # http://www.tradingtheodds.com/nyse-full-day-closings/
273
+ August45VictoryOverJapan = date_range("1945-08-15", "1945-08-16", tz="UTC")
274
+
275
+ # http://www.tradingtheodds.com/nyse-full-day-closings/
276
+ ChristmasEvesAdhoc = [
277
+ Timestamp("1945-12-24", tz="UTC"),
278
+ Timestamp("1956-12-24", tz="UTC"),
279
+ ]
280
+
281
+ # http://www.tradingtheodds.com/nyse-full-day-closings/
282
+ DayAfterChristmasAdhoc = [Timestamp("1958-12-26", tz="UTC")]
283
+
284
+ # http://www.tradingtheodds.com/nyse-full-day-closings/
285
+ DayBeforeDecorationAdhoc = [Timestamp("1961-05-29", tz="UTC")]
286
+
287
+ # http://www.tradingtheodds.com/nyse-full-day-closings/
288
+ LincolnsBirthDayAdhoc = [Timestamp("1968-02-12", tz="UTC")]
289
+
290
+ # http://www.tradingtheodds.com/nyse-full-day-closings/
291
+ PaperworkCrisis68 = [
292
+ Timestamp("1968-06-12", tz="UTC"),
293
+ Timestamp("1968-06-19", tz="UTC"),
294
+ Timestamp("1968-06-26", tz="UTC"),
295
+ Timestamp("1968-07-10", tz="UTC"),
296
+ Timestamp("1968-07-17", tz="UTC"),
297
+ Timestamp("1968-07-24", tz="UTC"),
298
+ Timestamp("1968-07-31", tz="UTC"),
299
+ Timestamp("1968-08-07", tz="UTC"),
300
+ Timestamp("1968-08-14", tz="UTC"),
301
+ Timestamp("1968-08-21", tz="UTC"),
302
+ Timestamp("1968-08-28", tz="UTC"),
303
+ Timestamp("1968-09-11", tz="UTC"),
304
+ Timestamp("1968-09-18", tz="UTC"),
305
+ Timestamp("1968-09-25", tz="UTC"),
306
+ Timestamp("1968-10-02", tz="UTC"),
307
+ Timestamp("1968-10-09", tz="UTC"),
308
+ Timestamp("1968-10-16", tz="UTC"),
309
+ Timestamp("1968-10-23", tz="UTC"),
310
+ Timestamp("1968-10-30", tz="UTC"),
311
+ Timestamp("1968-11-11", tz="UTC"),
312
+ Timestamp("1968-11-20", tz="UTC"),
313
+ Timestamp("1968-12-04", tz="UTC"),
314
+ Timestamp("1968-12-11", tz="UTC"),
315
+ Timestamp("1968-12-18", tz="UTC"),
316
+ Timestamp("1968-12-25", tz="UTC"),
317
+ ]
318
+
319
+ # http://www.tradingtheodds.com/nyse-full-day-closings/
320
+ DayAfterIndependenceDayAdhoc = [Timestamp("1968-07-05", tz="UTC")]
321
+
322
+ # http://www.tradingtheodds.com/nyse-full-day-closings/
323
+ WeatherSnowClosing = [Timestamp("1969-02-10", tz="UTC")]
324
+
325
+ # http://www.tradingtheodds.com/nyse-full-day-closings/
326
+ FirstLunarLandingClosing = [Timestamp("1969-07-21", tz="UTC")]
327
+
328
+ # http://www.tradingtheodds.com/nyse-full-day-closings/
329
+ NewYorkCityBlackout77 = [Timestamp("1977-07-14", tz="UTC")]
330
+
331
+ # http://en.wikipedia.org/wiki/Aftermath_of_the_September_11_attacks
332
+ September11Closings = [
333
+ Timestamp("2001-09-11", tz="UTC"),
334
+ Timestamp("2001-09-12", tz="UTC"),
335
+ Timestamp("2001-09-13", tz="UTC"),
336
+ Timestamp("2001-09-14", tz="UTC"),
337
+ ]
338
+
339
+ # http://en.wikipedia.org/wiki/Hurricane_Gloria
340
+ HurricaneGloriaClosings = date_range("1985-09-27", "1985-09-27", tz="UTC")
341
+
342
+ # http://en.wikipedia.org/wiki/Hurricane_sandy
343
+ HurricaneSandyClosings = date_range("2012-10-29", "2012-10-30", tz="UTC")
344
+
345
+ # National Days of Mourning
346
+ # - President John F. Kennedy - November 25, 1963
347
+ # - Martin Luther King - April 9, 1968
348
+ # - President Dwight D. Eisenhower - March 31, 1969
349
+ # - President Harry S. Truman - December 28, 1972
350
+ # - President Lyndon B. Johnson - January 25, 1973
351
+ # - President Richard Nixon - April 27, 1994
352
+ # - President Ronald W. Reagan - June 11, 2004
353
+ # - President Gerald R. Ford - Jan 2, 2007
354
+ # - President George H.W. Bush - Dec 5, 2018
355
+ USNationalDaysofMourning = [
356
+ Timestamp("1963-11-25", tz="UTC"),
357
+ Timestamp("1968-04-09", tz="UTC"),
358
+ Timestamp("1969-03-31", tz="UTC"),
359
+ Timestamp("1972-12-28", tz="UTC"),
360
+ Timestamp("1973-01-25", tz="UTC"),
361
+ Timestamp("1994-04-27", tz="UTC"),
362
+ Timestamp("2004-06-11", tz="UTC"),
363
+ Timestamp("2007-01-02", tz="UTC"),
364
+ Timestamp("2018-12-05", tz="UTC"),
365
+ ]
366
+
367
+ #######################################
368
+ # US Juneteenth (June 19th)
369
+ #######################################
370
+ USJuneteenthAfter2022 = Holiday(
371
+ "Juneteenth Starting at 2022",
372
+ start_date=Timestamp("2022-06-19"),
373
+ month=6,
374
+ day=19,
375
+ observance=nearest_workday,
376
+ )