pandas-market-calendars 4.3.0__py3-none-any.whl → 4.3.1__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. pandas_market_calendars/calendars/__init__.py +0 -0
  2. pandas_market_calendars/calendars/asx.py +63 -0
  3. pandas_market_calendars/calendars/bmf.py +227 -0
  4. pandas_market_calendars/calendars/bse.py +409 -0
  5. pandas_market_calendars/calendars/cboe.py +115 -0
  6. pandas_market_calendars/calendars/cme.py +240 -0
  7. pandas_market_calendars/calendars/cme_globex_agriculture.py +103 -0
  8. pandas_market_calendars/calendars/cme_globex_base.py +103 -0
  9. pandas_market_calendars/calendars/cme_globex_crypto.py +147 -0
  10. pandas_market_calendars/calendars/cme_globex_energy_and_metals.py +138 -0
  11. pandas_market_calendars/calendars/cme_globex_equities.py +104 -0
  12. pandas_market_calendars/calendars/cme_globex_fixed_income.py +113 -0
  13. pandas_market_calendars/calendars/cme_globex_fx.py +78 -0
  14. pandas_market_calendars/calendars/eurex.py +119 -0
  15. pandas_market_calendars/calendars/hkex.py +408 -0
  16. pandas_market_calendars/calendars/ice.py +65 -0
  17. pandas_market_calendars/calendars/iex.py +98 -0
  18. pandas_market_calendars/calendars/jpx.py +103 -0
  19. pandas_market_calendars/calendars/lse.py +91 -0
  20. pandas_market_calendars/calendars/mirror.py +114 -0
  21. pandas_market_calendars/calendars/nyse.py +1127 -0
  22. pandas_market_calendars/calendars/ose.py +150 -0
  23. pandas_market_calendars/calendars/sifma.py +297 -0
  24. pandas_market_calendars/calendars/six.py +114 -0
  25. pandas_market_calendars/calendars/sse.py +290 -0
  26. pandas_market_calendars/calendars/tase.py +195 -0
  27. pandas_market_calendars/calendars/tsx.py +159 -0
  28. pandas_market_calendars/holidays/__init__.py +0 -0
  29. pandas_market_calendars/holidays/cme.py +340 -0
  30. pandas_market_calendars/holidays/cme_globex.py +198 -0
  31. pandas_market_calendars/holidays/cn.py +1436 -0
  32. pandas_market_calendars/holidays/jp.py +396 -0
  33. pandas_market_calendars/holidays/jpx_equinox.py +147 -0
  34. pandas_market_calendars/holidays/nyse.py +1472 -0
  35. pandas_market_calendars/holidays/oz.py +65 -0
  36. pandas_market_calendars/holidays/sifma.py +321 -0
  37. pandas_market_calendars/holidays/uk.py +180 -0
  38. pandas_market_calendars/holidays/us.py +360 -0
  39. {pandas_market_calendars-4.3.0.dist-info → pandas_market_calendars-4.3.1.dist-info}/METADATA +1 -1
  40. pandas_market_calendars-4.3.1.dist-info/RECORD +49 -0
  41. pandas_market_calendars-4.3.0.dist-info/RECORD +0 -11
  42. {pandas_market_calendars-4.3.0.dist-info → pandas_market_calendars-4.3.1.dist-info}/LICENSE +0 -0
  43. {pandas_market_calendars-4.3.0.dist-info → pandas_market_calendars-4.3.1.dist-info}/NOTICE +0 -0
  44. {pandas_market_calendars-4.3.0.dist-info → pandas_market_calendars-4.3.1.dist-info}/WHEEL +0 -0
  45. {pandas_market_calendars-4.3.0.dist-info → pandas_market_calendars-4.3.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,65 @@
1
+ # OZ Holidays
2
+
3
+ from pandas import DateOffset, Timestamp
4
+ from pandas.tseries.holiday import (
5
+ Holiday,
6
+ MO,
7
+ next_monday_or_tuesday,
8
+ weekend_to_monday,
9
+ )
10
+
11
+ # New Year's Day
12
+ OZNewYearsDay = Holiday(
13
+ "New Year's Day",
14
+ month=1,
15
+ day=1,
16
+ observance=weekend_to_monday,
17
+ )
18
+
19
+ # Australia Day
20
+ AustraliaDay = Holiday(
21
+ "Australia Day",
22
+ month=1,
23
+ day=26,
24
+ observance=weekend_to_monday,
25
+ )
26
+
27
+ # ANZAC Day
28
+ AnzacDay = Holiday(
29
+ "ANZAC Day",
30
+ month=4,
31
+ day=25,
32
+ )
33
+
34
+ # Queen's Birthday
35
+ QueensBirthday = Holiday(
36
+ "Queen's Birthday",
37
+ month=6,
38
+ day=1,
39
+ offset=DateOffset(weekday=MO(2)),
40
+ )
41
+
42
+ # Christmas
43
+ Christmas = Holiday(
44
+ "Christmas",
45
+ month=12,
46
+ day=25,
47
+ observance=weekend_to_monday,
48
+ )
49
+
50
+
51
+ # Boxing day
52
+ BoxingDay = Holiday(
53
+ "Boxing Day",
54
+ month=12,
55
+ day=26,
56
+ observance=next_monday_or_tuesday,
57
+ )
58
+
59
+
60
+ # One-off holiday additions and removals in Australia
61
+
62
+ UniqueCloses = []
63
+
64
+ # National Day of Mourning for Her Majesty the Queen
65
+ UniqueCloses.append(Timestamp("2022-09-22", tz='UTC'))
@@ -0,0 +1,321 @@
1
+ from dateutil.relativedelta import (MO, TH)
2
+ from pandas import (DateOffset, Timestamp)
3
+ from datetime import timedelta
4
+ from pandas.tseries.holiday import (Holiday, nearest_workday, next_monday, sunday_to_monday,
5
+ previous_workday, Easter)
6
+ from pandas.tseries.offsets import Day
7
+
8
+ from pandas_market_calendars.market_calendar import ( MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY)
9
+
10
+
11
+ ####################################################
12
+ # US New Years Day Jan 1
13
+ # When Jan 1 is a Sunday, US markets observe the subsequent Monday.
14
+ # When Jan 1 is a Saturday (as in 2005 and 2011), no holiday is observed.
15
+ #####################################################
16
+ USNewYearsDay = Holiday(
17
+ 'New Years Day US',
18
+ month=1,
19
+ day=1,
20
+ days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY,),
21
+ observance=sunday_to_monday,
22
+ )
23
+
24
+ USNewYearsEve2pmEarlyClose = Holiday(
25
+ 'New Years Eve US',
26
+ month=1,
27
+ day=1,
28
+ days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY,),
29
+ observance = previous_workday,
30
+ )
31
+
32
+ #########################################################################
33
+ # Martin Luther King Jr
34
+ ##########################################################################
35
+ MartinLutherKingJr = Holiday(
36
+ 'Dr. Martin Luther King Jr. Day',
37
+ month=1,
38
+ day=1,
39
+ days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY,),
40
+ offset=DateOffset(weekday=MO(3)),
41
+ )
42
+
43
+ #########################################################################
44
+ # US Presidents Day Feb
45
+ ##########################################################################
46
+ USPresidentsDay = Holiday('President''s Day',
47
+ start_date=Timestamp('1971-01-01'),
48
+ month=2, day=1,
49
+ days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY,),
50
+ offset=DateOffset(weekday=MO(3)))
51
+
52
+
53
+ ############################################################
54
+ # Good Friday
55
+ ############################################################
56
+ GoodFridayThru2020 = Holiday(
57
+ "Good Friday 1908+",
58
+ end_date=Timestamp('2020-12-31'),
59
+ month=1,
60
+ day=1,
61
+ offset=[Easter(), Day(-2)]
62
+ )
63
+
64
+ # 2021 is early close.
65
+ # 2022 is a full holiday.
66
+ # 2023 is early close.
67
+ GoodFridayAdHoc = [Timestamp('2022-04-15', tz='UTC'),]
68
+
69
+ GoodFriday2pmEarlyCloseAdHoc = [
70
+ Timestamp('2021-04-02', tz='UTC'),
71
+ Timestamp('2023-04-07', tz='UTC'),]
72
+
73
+
74
+ DayBeforeGoodFriday2pmEarlyCloseThru2020 = Holiday(
75
+ "Day Before Good Friday Thru 2020",
76
+ end_date=Timestamp('2020-12-31'),
77
+ month=1,
78
+ day=1,
79
+ offset=[Easter(), Day(-3)]
80
+ )
81
+
82
+ DayBeforeGoodFriday2pmEarlyCloseAdHoc = [
83
+ Timestamp('2022-04-14', tz='UTC'),
84
+ ]
85
+
86
+ ##################################################
87
+ # US Memorial Day (Decoration Day) May 30
88
+ # Closed every year since 1873
89
+ # Observed on Monday since 1971
90
+ ##################################################
91
+ USMemorialDay = Holiday(
92
+ 'Memorial Day',
93
+ month=5,
94
+ day=25,
95
+ days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
96
+ offset=DateOffset(weekday=MO(1)),
97
+ )
98
+
99
+ DayBeforeUSMemorialDay2pmEarlyClose = Holiday(
100
+ 'Day Before Memorial Day',
101
+ month=5,
102
+ day=25,
103
+ offset=[DateOffset(weekday=MO(1)), Day(-3)],
104
+ )
105
+
106
+ #######################################
107
+ # US Juneteenth (June 19th)
108
+ #######################################
109
+ USJuneteenthAfter2022 = Holiday(
110
+ 'Juneteenth Starting at 2022',
111
+ start_date=Timestamp('2022-06-19'),
112
+ month=6, day=19,
113
+ observance=nearest_workday,
114
+ )
115
+
116
+ #######################################
117
+ # US Independence Day July 4
118
+ #######################################
119
+ USIndependenceDay = Holiday(
120
+ 'July 4th',
121
+ month=7,
122
+ day=4,
123
+ days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
124
+ observance=nearest_workday,
125
+ )
126
+
127
+ # Day before Independence Day
128
+ DayBeforeUSIndependenceDay2pmEarlyClose = Holiday(
129
+ 'Day Before Independence Day',
130
+ month=7,
131
+ day=4,
132
+ days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
133
+ observance=previous_workday,
134
+ )
135
+
136
+ # When July 4th is a Saturday, the previous Friday is a holiday
137
+ # and the previous Thursday is an early close
138
+ ThursdayBeforeUSIndependenceDay2pmEarlyClose = Holiday(
139
+ 'Thursday Before Independence Day',
140
+ month=7,
141
+ day=2,
142
+ days_of_week=(THURSDAY,),
143
+ )
144
+
145
+
146
+
147
+ #################################################
148
+ # US Labor Day
149
+ #################################################
150
+ USLaborDay = Holiday(
151
+ "Labor Day",
152
+ month=9,
153
+ day=1,
154
+ offset=DateOffset(weekday=MO(1))
155
+ )
156
+
157
+
158
+ #################################################
159
+ # Columbus Day
160
+ #################################################
161
+ USColumbusDay = Holiday(
162
+ 'Columbus Day',
163
+ month=10,
164
+ day=1,
165
+ offset=DateOffset(weekday=MO(2)),
166
+ )
167
+
168
+ ##########################################################
169
+ # Armistice/Veterans day
170
+ # When falls on Saturday, no holiday is observed.
171
+ # When falls on Sunday, the Monday following is a holiday.
172
+ ##########################################################
173
+ USVeteransDay = Holiday(
174
+ 'Veterans Day',
175
+ month=11,
176
+ day=11,
177
+ end_date=Timestamp('2022-12-31'),
178
+ days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
179
+ observance=sunday_to_monday,
180
+ )
181
+
182
+ ################################################
183
+ # US Thanksgiving Nov 30
184
+ ################################################
185
+ USThanksgivingDay = Holiday(
186
+ 'Thanksgiving',
187
+ month=11, day=1,
188
+ offset=DateOffset(weekday=TH(4))
189
+ )
190
+
191
+
192
+ DayAfterThanksgiving2pmEarlyClose = Holiday(
193
+ 'Black Friday',
194
+ month=11,
195
+ day=1,
196
+ offset=[DateOffset(weekday=TH(4)), Day(1)],
197
+ )
198
+
199
+
200
+
201
+ ################################
202
+ # Christmas Dec 25
203
+ ################################
204
+ Christmas = Holiday(
205
+ 'Christmas',
206
+ month=12,
207
+ day=25,
208
+ observance=nearest_workday,
209
+ )
210
+
211
+ ChristmasEve2pmEarlyClose = Holiday(
212
+ 'Christmas Eve',
213
+ month=12,
214
+ day=25,
215
+ observance = previous_workday,
216
+ )
217
+
218
+ # When Christmas is on a Saturday it is observed on Friday the 24th
219
+ # Early close on Thursday 23rd
220
+ ChristmasEveThursday2pmEarlyClose = Holiday(
221
+ 'Christmas Eve on Thursday',
222
+ month=12,
223
+ day=23,
224
+ days_of_week=(THURSDAY,),
225
+ )
226
+
227
+
228
+ ############################################################################
229
+ # UK Specific Holidays
230
+ ############################################################################
231
+
232
+ # Remarkably, in 2022 SIFMA recommended NO new year's day observance in the US (Saturday)
233
+ # but in the UK it was observed on Monday requiring a different rule
234
+ UKNewYearsDay = Holiday(
235
+ 'New Years Day',
236
+ month=1,
237
+ day=1,
238
+ observance=next_monday,
239
+ )
240
+
241
+ UKGoodFriday = Holiday(
242
+ "Good Friday",
243
+ month=1,
244
+ day=1,
245
+ offset=[Easter(), Day(-2)]
246
+ )
247
+
248
+ UKEasterMonday = Holiday(
249
+ "Easter Monday",
250
+ month=1,
251
+ day=1,
252
+ offset=[Easter(), Day(+1)]
253
+ )
254
+
255
+ # Observed first Monday in May
256
+ UKMayDay = Holiday(
257
+ "May Day",
258
+ month=5,
259
+ day=1,
260
+ offset=DateOffset(weekday=MO(1)),
261
+ )
262
+
263
+ # Almost always follows US Memorial Day except for
264
+ UKSpringBankAdHoc = [Timestamp('2022-06-02', tz='UTC'),]
265
+
266
+ UKPlatinumJubilee2022 = [Timestamp('2022-06-03', tz='UTC'),]
267
+
268
+ # Observed last Monday in August in England, Wales, and Northern Ireland
269
+ # Observed first Monday in August in Scotland
270
+ # Coded as last Monday
271
+ # https://www.timeanddate.com/holidays/uk/summer-bank-holiday
272
+ UKSummerBank = Holiday(
273
+ "Summer Bank Holiday",
274
+ month=8,
275
+ day=30,
276
+ offset=DateOffset(weekday=MO(-1)),
277
+ )
278
+
279
+
280
+
281
+ # UK observes Christmas on Tuesday when Boxing Day is on Monday
282
+ # UK observes Christmas on Monday when Christmas is on Saturday
283
+ UKChristmaEve = Holiday(
284
+ "Christmas",
285
+ month=12,
286
+ day=24,
287
+ days_of_week=(FRIDAY,),
288
+ )
289
+
290
+ UKChristmas = Holiday(
291
+ "Christmas",
292
+ month=12,
293
+ day=25,
294
+ days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
295
+ )
296
+
297
+ # If christmas day is Saturday Monday 27th is a holiday
298
+ # If christmas day is sunday the Tuesday 27th is a holiday
299
+ UKWeekendChristmas = Holiday(
300
+ "Weekend Christmas",
301
+ month=12,
302
+ day=27,
303
+ days_of_week=(MONDAY, TUESDAY),
304
+ )
305
+
306
+ # Boxing day
307
+ UKBoxingDay = Holiday(
308
+ "Boxing Day",
309
+ month=12,
310
+ day=26,
311
+ days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
312
+ )
313
+
314
+ # If boxing day is saturday then Monday 28th is a holiday
315
+ # If boxing day is sunday then Tuesday 28th is a holiday
316
+ UKWeekendBoxingDay = Holiday(
317
+ "Weekend Boxing Day",
318
+ month=12,
319
+ day=28,
320
+ days_of_week=(MONDAY, TUESDAY),
321
+ )
@@ -0,0 +1,180 @@
1
+ # UK Holidays
2
+
3
+ import pandas as pd
4
+ from pandas import DateOffset, Timestamp
5
+ from pandas.tseries.holiday import Holiday, MO, previous_friday, weekend_to_monday
6
+
7
+ from pandas_market_calendars.market_calendar import MONDAY, TUESDAY
8
+
9
+ # New Year's Eve
10
+ LSENewYearsEve = Holiday(
11
+ "New Year's Eve",
12
+ month=12,
13
+ day=31,
14
+ observance=previous_friday,
15
+ )
16
+
17
+ # New Year's Day
18
+ LSENewYearsDay = Holiday(
19
+ "New Year's Day",
20
+ month=1,
21
+ day=1,
22
+ observance=weekend_to_monday,
23
+ )
24
+
25
+ # Early May bank holiday has two exceptions based on the 50th and 75th anniversary of VE-Day
26
+ # 1995-05-01 Early May bank holiday removed for VE-day 50th anniversary
27
+ # 2020-05-04 Early May bank holiday removed for VE-day 75th anniversary
28
+
29
+ # Early May bank holiday pre-1995
30
+ MayBank_pre_1995 = Holiday(
31
+ "Early May Bank Holiday",
32
+ month=5,
33
+ offset=DateOffset(weekday=MO(1)),
34
+ day=1,
35
+ end_date=Timestamp('1994-12-31'),
36
+ )
37
+
38
+ # Early May bank holiday post-1995 and pre-2020
39
+ MayBank_post_1995_pre_2020 = Holiday(
40
+ "Early May Bank Holiday",
41
+ month=5,
42
+ offset=DateOffset(weekday=MO(1)),
43
+ day=1,
44
+ start_date=Timestamp('1996-01-01'),
45
+ end_date=Timestamp('2019-12-31'),
46
+ )
47
+
48
+ # Early May bank holiday post 2020
49
+ MayBank_post_2020 = Holiday(
50
+ "Early May Bank Holiday",
51
+ month=5,
52
+ offset=DateOffset(weekday=MO(1)),
53
+ day=1,
54
+ start_date=Timestamp('2021-01-01')
55
+ )
56
+
57
+ # Spring bank holiday has two exceptions based on the Golden & Diamond Jubilee
58
+ # 2002-05-27 Spring bank holiday removed for Golden Jubilee
59
+ # 2012-05-28 Spring bank holiday removed for Diamond Jubilee
60
+ # 2022-05-31 Spring bank holiday removed for Platinum Jubilee
61
+
62
+ # Spring bank holiday
63
+ SpringBank_pre_2002 = Holiday(
64
+ "Spring Bank Holiday",
65
+ month=5,
66
+ day=31,
67
+ offset=DateOffset(weekday=MO(-1)),
68
+ end_date=Timestamp('2001-12-31'),
69
+ )
70
+
71
+ SpringBank_post_2002_pre_2012 = Holiday(
72
+ "Spring Bank Holiday",
73
+ month=5,
74
+ day=31,
75
+ offset=DateOffset(weekday=MO(-1)),
76
+ start_date=Timestamp('2003-01-01'),
77
+ end_date=Timestamp('2011-12-31'),
78
+ )
79
+
80
+ SpringBank_post_2012_pre_2022 = Holiday(
81
+ "Spring Bank Holiday",
82
+ month=5,
83
+ day=31,
84
+ offset=DateOffset(weekday=MO(-1)),
85
+ start_date=Timestamp('2013-01-01'),
86
+ end_date=Timestamp('2021-12-31'),
87
+ )
88
+
89
+ SpringBank_post_2022 = Holiday(
90
+ "Spring Bank Holiday",
91
+ month=5,
92
+ day=31,
93
+ offset=DateOffset(weekday=MO(-1)),
94
+ start_date=Timestamp('2022-01-01'),
95
+ )
96
+
97
+ # Summer bank holiday
98
+ SummerBank = Holiday(
99
+ "Summer Bank Holiday",
100
+ month=8,
101
+ day=31,
102
+ offset=DateOffset(weekday=MO(-1)),
103
+ )
104
+
105
+ # Christmas Eve
106
+ ChristmasEve = Holiday(
107
+ 'Christmas Eve',
108
+ month=12,
109
+ day=24,
110
+ observance=previous_friday,
111
+ )
112
+
113
+ # Christmas
114
+ Christmas = Holiday(
115
+ "Christmas",
116
+ month=12,
117
+ day=25,
118
+ )
119
+
120
+ # If christmas day is Saturday Monday 27th is a holiday
121
+ # If christmas day is sunday the Tuesday 27th is a holiday
122
+ WeekendChristmas = Holiday(
123
+ "Weekend Christmas",
124
+ month=12,
125
+ day=27,
126
+ days_of_week=(MONDAY, TUESDAY),
127
+ )
128
+
129
+ # Boxing day
130
+ BoxingDay = Holiday(
131
+ "Boxing Day",
132
+ month=12,
133
+ day=26,
134
+ )
135
+
136
+ # If boxing day is saturday then Monday 28th is a holiday
137
+ # If boxing day is sunday then Tuesday 28th is a holiday
138
+ WeekendBoxingDay = Holiday(
139
+ "Weekend Boxing Day",
140
+ month=12,
141
+ day=28,
142
+ days_of_week=(MONDAY, TUESDAY),
143
+ )
144
+
145
+ # One-off holiday additions and removals in England
146
+
147
+ UniqueCloses = []
148
+ # VE-Day Anniversary
149
+ UniqueCloses.append(pd.Timestamp("1995-05-08", tz='UTC')) # 50th Anniversary
150
+ UniqueCloses.append(pd.Timestamp("2020-05-08", tz='UTC')) # 75th Anniversary
151
+
152
+ # Queen Elizabeth II Jubilees
153
+ # Silver Jubilee
154
+ UniqueCloses.append(pd.Timestamp("1977-06-07", tz='UTC'))
155
+
156
+ # Golden Jubilee
157
+ UniqueCloses.append(pd.Timestamp("2002-06-03", tz='UTC'))
158
+ UniqueCloses.append(pd.Timestamp("2002-06-04", tz='UTC'))
159
+
160
+ # Diamond Jubilee
161
+ UniqueCloses.append(pd.Timestamp("2012-06-04", tz='UTC'))
162
+ UniqueCloses.append(pd.Timestamp("2012-06-05", tz='UTC'))
163
+
164
+ # Platinum Jubilee
165
+ UniqueCloses.append(pd.Timestamp("2022-06-02", tz='UTC'))
166
+ UniqueCloses.append(pd.Timestamp("2022-06-03", tz='UTC'))
167
+
168
+ # State Funeral of Queen Elizabeth II
169
+ UniqueCloses.append(pd.Timestamp("2022-09-19", tz='UTC'))
170
+
171
+ # Royal Weddings
172
+ UniqueCloses.append(pd.Timestamp("1973-11-14", tz='UTC')) # Wedding Day of Princess Anne and Mark Phillips
173
+ UniqueCloses.append(pd.Timestamp("1981-07-29", tz='UTC')) # Wedding Day of Prince Charles and Diana Spencer
174
+ UniqueCloses.append(pd.Timestamp("2011-04-29", tz='UTC')) # Wedding Day of Prince William and Catherine Middleton
175
+
176
+ # Coronation of King Charles III
177
+ UniqueCloses.append(pd.Timestamp("2023-05-08", tz='UTC'))
178
+
179
+ # Miscellaneous
180
+ UniqueCloses.append(pd.Timestamp("1999-12-31", tz='UTC')) # Eve of 3rd Millenium A.D.