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,150 @@
1
+ from datetime import time
2
+
3
+ from pandas.tseries.holiday import AbstractHolidayCalendar, EasterMonday, GoodFriday, Holiday
4
+ from pandas.tseries.offsets import Day, Easter
5
+ from pytz import timezone
6
+
7
+ from pandas_market_calendars.market_calendar import MarketCalendar
8
+
9
+ OSENewYearsDay = Holiday(
10
+ "New Year's Day",
11
+ month=1,
12
+ day=1
13
+ )
14
+
15
+ OSEWednesdayBeforeEaster = Holiday(
16
+ "Wednesday before Easter",
17
+ month=1,
18
+ day=1,
19
+ offset=[Easter(), Day(-4)]
20
+
21
+ )
22
+
23
+ OSEMaundyThursday = Holiday(
24
+ "Maundy Thursday",
25
+ month=1,
26
+ day=1,
27
+ offset=[Easter(), Day(-3)]
28
+ )
29
+
30
+ OSEGoodFriday = GoodFriday
31
+
32
+ OSEEasterMonday = EasterMonday
33
+
34
+ OSELabourDay = Holiday(
35
+ "Labour Day",
36
+ month=5,
37
+ day=1
38
+ )
39
+
40
+ OSEConstitutionDay = Holiday(
41
+ "Constitution Day",
42
+ month=5,
43
+ day=17
44
+ )
45
+
46
+ OSEWhitMonday = Holiday(
47
+ "Whit Monday",
48
+ month=1,
49
+ day=1,
50
+ offset=[Easter(), Day(50)]
51
+ )
52
+
53
+ OSEAscensionDay = Holiday(
54
+ "Ascension Day",
55
+ month=1,
56
+ day=1,
57
+ offset=[Easter(), Day(39)]
58
+ )
59
+
60
+ OSEChristmasEve = Holiday(
61
+ "Christmas Eve",
62
+ month=12,
63
+ day=24,
64
+ )
65
+
66
+ OSEChristmasDay = Holiday(
67
+ "Christmas Day",
68
+ month=12,
69
+ day=25
70
+ )
71
+
72
+ OSEBoxingDay = Holiday(
73
+ "Boxing Day",
74
+ month=12,
75
+ day=26
76
+ )
77
+
78
+ OSENewYearsEve = Holiday(
79
+ "New Year's Eve",
80
+ month=12,
81
+ day=31
82
+ )
83
+
84
+
85
+ class OSEExchangeCalendar(MarketCalendar):
86
+ """
87
+ Exchange calendar for Oslo Stock Exchange
88
+
89
+ Note these dates are only checked against 2017, 2018 and 2019
90
+ https://www.oslobors.no/ob_eng/Oslo-Boers/About-Oslo-Boers/Opening-hours
91
+
92
+ Opening times for the regular trading of equities (not including closing auction call)
93
+ Open Time: 9:00 AM, CEST/EST
94
+ Close Time: 4:20 PM, CEST/EST
95
+
96
+ Regularly-Observed Holidays (not necessarily in order):
97
+ - New Years Day
98
+ - Wednesday before Easter (Half trading day)
99
+ - Maundy Thursday
100
+ - Good Friday
101
+ - Easter Monday
102
+ - Labour Day
103
+ - Ascension Day
104
+ - Constitution Day
105
+ - Whit Monday
106
+ - Christmas Eve
107
+ - Christmas Day
108
+ - Boxing Day
109
+ - New Year's Eve
110
+ """
111
+
112
+ aliases = ['OSE']
113
+ regular_market_times = {
114
+ "market_open": ((None, time(9)),),
115
+ "market_close": ((None, time(16,20)),)
116
+ }
117
+
118
+ @property
119
+ def name(self):
120
+ return "OSE"
121
+
122
+ @property
123
+ def tz(self):
124
+ return timezone("Europe/Oslo")
125
+
126
+ @property
127
+ def regular_holidays(self):
128
+ return AbstractHolidayCalendar(rules=[
129
+ OSENewYearsDay,
130
+ OSEMaundyThursday,
131
+ OSEGoodFriday,
132
+ OSEEasterMonday,
133
+ OSELabourDay,
134
+ OSEConstitutionDay,
135
+ OSEWhitMonday,
136
+ OSEAscensionDay,
137
+ OSEChristmasEve,
138
+ OSEChristmasDay,
139
+ OSEBoxingDay,
140
+ OSENewYearsEve
141
+ ])
142
+
143
+ @property
144
+ def special_closes(self):
145
+ return [(
146
+ time(13, 0, tzinfo=self.tz),
147
+ AbstractHolidayCalendar(rules=[
148
+ OSEWednesdayBeforeEaster
149
+ ])
150
+ )]
@@ -0,0 +1,297 @@
1
+ from datetime import time
2
+
3
+ from pandas.tseries.holiday import AbstractHolidayCalendar
4
+ from pytz import timezone
5
+ from itertools import chain
6
+
7
+ ########################################################################################################################
8
+ # SIFMA Financial Markets Calendar for US, UK, JP
9
+ #
10
+ # https://www.sifma.com/
11
+ #
12
+ # US: SIFMAUSExchangeCalendar() ['SIFMAUS', 'SIFMA_US', "Capital_Markets_US", "Financial_Markets_US", "Bond_Markets_US"]
13
+ # UK: SIFMAUKExchangeCalendar() ['SIFMAUK', 'SIFMA_UK', "Capital_Markets_UK", "Financial_Markets_UK", "Bond_Markets_UK"]
14
+ # JP: SIFMAJPExchangeCalendar() ['SIFMAJP', 'SIFMA_JP', "Capital_Markets_JP", "Financial_Markets_JP", "Bond_Markets_JP"]
15
+ #
16
+ # Trading Hours:
17
+ # US: 7:00 to 17:30
18
+ # UK: 8:00 to 17:00
19
+ # JP: 8:30 to 18:30
20
+ ########################################################################################################################
21
+
22
+
23
+ from pandas_market_calendars.holidays.sifma import(
24
+ # US Holidays
25
+ USNewYearsDay, # Not observed if a Saturday
26
+ USNewYearsEve2pmEarlyClose,
27
+
28
+ MartinLutherKingJr,
29
+ USPresidentsDay,
30
+
31
+ GoodFridayThru2020,
32
+ DayBeforeGoodFriday2pmEarlyCloseThru2020,
33
+ GoodFridayAdHoc,
34
+ GoodFriday2pmEarlyCloseAdHoc,
35
+ DayBeforeGoodFriday2pmEarlyCloseAdHoc,
36
+
37
+ DayBeforeUSMemorialDay2pmEarlyClose,
38
+ USMemorialDay,
39
+ USJuneteenthAfter2022,
40
+
41
+ USIndependenceDay,
42
+ DayBeforeUSIndependenceDay2pmEarlyClose,
43
+ ThursdayBeforeUSIndependenceDay2pmEarlyClose,
44
+
45
+ USLaborDay,
46
+ USColumbusDay,
47
+ USVeteransDay,
48
+ USThanksgivingDay,
49
+ DayAfterThanksgiving2pmEarlyClose,
50
+
51
+ Christmas,
52
+ ChristmasEve2pmEarlyClose,
53
+ ChristmasEveThursday2pmEarlyClose,
54
+
55
+ # UK Specific Holidays
56
+ UKNewYearsDay, # Saturdays observed on Monday
57
+ UKGoodFriday,
58
+ UKEasterMonday,
59
+ UKMayDay,
60
+ UKSpringBankAdHoc, # Usually follows US Memorial Day but not always
61
+ UKSummerBank,
62
+ UKChristmas,
63
+ UKChristmaEve,
64
+ UKWeekendChristmas, # Observed Tuesday when Boxing Day is on Monday
65
+ UKBoxingDay,
66
+ UKWeekendBoxingDay,
67
+
68
+ UKPlatinumJubilee2022,
69
+ )
70
+
71
+ from pandas_market_calendars.market_calendar import MarketCalendar
72
+
73
+ #AbstractHolidayCalendar.start_date = '1998-01-01'
74
+
75
+ ############################################################
76
+ # US
77
+ ############################################################
78
+
79
+ class SIFMAUSExchangeCalendar(MarketCalendar):
80
+ """
81
+ Exchange calendar for SIFMA United States
82
+
83
+ https://www.sifma.org/resources/general/holiday-schedule/#US
84
+
85
+ """
86
+
87
+ aliases = ['SIFMAUS', 'SIFMA_US', "Capital_Markets_US", "Financial_Markets_US", "Bond_Markets_US"]
88
+
89
+ regular_market_times = {
90
+ "market_open": ((None, time(7)),),
91
+ "market_close": ((None, time(17, 30)),)
92
+ }
93
+
94
+
95
+ @property
96
+ def name(self):
97
+ return "SIFMA_US"
98
+
99
+ @property
100
+ def tz(self):
101
+ return timezone("America/New_York")
102
+
103
+ @property
104
+ def regular_holidays(self):
105
+ return AbstractHolidayCalendar(rules=[
106
+ USNewYearsDay,
107
+ MartinLutherKingJr,
108
+ USPresidentsDay,
109
+ GoodFridayThru2020,
110
+ USMemorialDay,
111
+ USJuneteenthAfter2022,
112
+ USIndependenceDay,
113
+ USLaborDay,
114
+ USColumbusDay,
115
+ USVeteransDay,
116
+ USThanksgivingDay,
117
+ Christmas,
118
+ ])
119
+
120
+ @property
121
+ def adhoc_holidays(self):
122
+ return list(chain(
123
+ GoodFridayAdHoc,
124
+ ))
125
+
126
+
127
+
128
+ @property
129
+ def special_closes(self):
130
+ return [(
131
+ time(14),
132
+ AbstractHolidayCalendar(rules=[
133
+ DayBeforeGoodFriday2pmEarlyCloseThru2020,
134
+ DayBeforeUSMemorialDay2pmEarlyClose,
135
+ DayBeforeUSIndependenceDay2pmEarlyClose,
136
+ ThursdayBeforeUSIndependenceDay2pmEarlyClose,
137
+ DayAfterThanksgiving2pmEarlyClose,
138
+ ChristmasEve2pmEarlyClose,
139
+ ChristmasEveThursday2pmEarlyClose,
140
+ USNewYearsEve2pmEarlyClose,
141
+ ])
142
+ )]
143
+
144
+ @property
145
+ def special_closes_adhoc(self):
146
+ return [
147
+ (time(14, tzinfo=timezone('America/New_York')),
148
+ GoodFriday2pmEarlyCloseAdHoc # list
149
+ + DayBeforeGoodFriday2pmEarlyCloseAdHoc
150
+ ),
151
+ ]
152
+
153
+ ############################################################
154
+ # UK
155
+ ############################################################
156
+
157
+ class SIFMAUKExchangeCalendar(MarketCalendar):
158
+ """
159
+ Exchange calendar for SIFMA United Kingdom
160
+
161
+ https://www.sifma.org/resources/general/holiday-schedule/#UK
162
+
163
+ """
164
+
165
+ aliases = ['SIFMAUK', 'SIFMA_UK', "Capital_Markets_UK", "Financial_Markets_UK", "Bond_Markets_UK"]
166
+
167
+ regular_market_times = {
168
+ "market_open": ((None, time(8)),),
169
+ "market_close": ((None, time(17)),)
170
+ }
171
+
172
+ @property
173
+ def name(self):
174
+ return "SIFMA_UK"
175
+
176
+ @property
177
+ def tz(self):
178
+ return timezone("Europe/London")
179
+
180
+ @property
181
+ def regular_holidays(self):
182
+ return AbstractHolidayCalendar(rules=[
183
+ UKNewYearsDay,
184
+ MartinLutherKingJr,
185
+ USPresidentsDay,
186
+ UKGoodFriday,
187
+ UKEasterMonday,
188
+ UKMayDay,
189
+ USMemorialDay,
190
+ USJuneteenthAfter2022,
191
+ USIndependenceDay,
192
+ UKSummerBank,
193
+ USLaborDay,
194
+ USColumbusDay,
195
+ USVeteransDay,
196
+ USThanksgivingDay,
197
+ UKChristmas,
198
+ UKChristmaEve,
199
+ UKWeekendChristmas,
200
+ UKBoxingDay,
201
+ UKWeekendBoxingDay
202
+ ])
203
+
204
+ @property
205
+ def adhoc_holidays(self):
206
+ return list(chain(
207
+ UKSpringBankAdHoc,
208
+ UKPlatinumJubilee2022,
209
+ ))
210
+
211
+ ############################################################
212
+ # Japan
213
+ ############################################################
214
+ from pandas_market_calendars.holidays.jp import (JapanComingOfAgeDay, JapanNationalFoundationDay, JapanEmperorsBirthday, JapanVernalEquinox, JapanShowaDay,
215
+ JapanConstitutionMemorialDay, JapanGreeneryDay, JapanChildrensDay, JapanMarineDay, JapanMountainDay,
216
+ JapanRespectForTheAgedDay, JapanAutumnalEquinox,
217
+ JapanHealthAndSportsDay2000To2019, JapanSportsDay2020, JapanSportsDay,
218
+ JapanCultureDay, JapanLaborThanksgivingDay)
219
+
220
+ class SIFMAJPExchangeCalendar(MarketCalendar):
221
+ """
222
+ Exchange calendar for SIFMA Japan
223
+
224
+ https://www.sifma.org/resources/general/holiday-schedule/#JP
225
+
226
+ """
227
+
228
+ aliases = ['SIFMAJP', 'SIFMA_JP', "Capital_Markets_JP", "Financial_Markets_JP", "Bond_Markets_JP"]
229
+
230
+ regular_market_times = {
231
+ "market_open": ((None, time(8, 30)),),
232
+ "market_close": ((None, time(18, 30)),)
233
+ }
234
+
235
+ @property
236
+ def name(self):
237
+ return "SIFMA_JP"
238
+
239
+ @property
240
+ def tz(self):
241
+ return timezone("Asia/Tokyo")
242
+
243
+ @property
244
+ def regular_holidays(self):
245
+ return AbstractHolidayCalendar(rules=[
246
+ UKNewYearsDay,
247
+ JapanComingOfAgeDay,
248
+ MartinLutherKingJr,
249
+ JapanNationalFoundationDay,
250
+ USPresidentsDay,
251
+ JapanEmperorsBirthday,
252
+ JapanVernalEquinox,
253
+ UKGoodFriday,
254
+ UKEasterMonday,
255
+ JapanShowaDay,
256
+ JapanConstitutionMemorialDay,
257
+ JapanGreeneryDay,
258
+ JapanChildrensDay,
259
+ USMemorialDay,
260
+ USJuneteenthAfter2022,
261
+ USIndependenceDay,
262
+ JapanMarineDay,
263
+ JapanMountainDay,
264
+ UKSummerBank,
265
+ USLaborDay,
266
+ JapanRespectForTheAgedDay,
267
+ JapanAutumnalEquinox,
268
+ JapanSportsDay,
269
+ JapanSportsDay2020,
270
+ JapanHealthAndSportsDay2000To2019,
271
+ JapanCultureDay,
272
+ USVeteransDay,
273
+ JapanLaborThanksgivingDay,
274
+ USThanksgivingDay,
275
+ UKChristmas,
276
+ UKChristmaEve,
277
+ UKBoxingDay,
278
+ UKWeekendBoxingDay
279
+ ])
280
+
281
+ @property
282
+ def adhoc_holidays(self):
283
+ return list(chain(
284
+ UKSpringBankAdHoc,
285
+ UKPlatinumJubilee2022,
286
+ ))
287
+
288
+ @property
289
+ def special_closes(self):
290
+ return [(
291
+ time(15),
292
+ AbstractHolidayCalendar(rules=[
293
+ UKMayDay,
294
+ UKWeekendChristmas
295
+ ])
296
+ )]
297
+
@@ -0,0 +1,114 @@
1
+ from datetime import time
2
+
3
+ from pandas.tseries.holiday import (AbstractHolidayCalendar, Day, Easter, EasterMonday, GoodFriday, Holiday,
4
+ previous_friday)
5
+ from pytz import timezone
6
+
7
+ from pandas_market_calendars.market_calendar import (FRIDAY, MONDAY, MarketCalendar, THURSDAY, TUESDAY, WEDNESDAY)
8
+
9
+ # New Year's Eve
10
+ NewYearsEve = Holiday(
11
+ "New Year's Eve",
12
+ month=12,
13
+ day=31,
14
+ observance=previous_friday,
15
+ )
16
+ # New Year's Day
17
+ NewYearsDay = Holiday(
18
+ "New Year's Day",
19
+ month=1,
20
+ day=1,
21
+ days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
22
+ )
23
+ # Berthold's Day
24
+ BertholdsDay = Holiday(
25
+ "Berthold's Day",
26
+ month=1,
27
+ day=2,
28
+ days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
29
+ )
30
+ # Early May bank holiday
31
+ MayBank = Holiday(
32
+ "Early May Bank Holiday",
33
+ month=5,
34
+ day=1,
35
+ days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
36
+ )
37
+ # Ascension Day (Auffahrt)
38
+ AscensionDay = Holiday(
39
+ 'Ascension Day',
40
+ month=1,
41
+ day=1,
42
+ offset=[Easter(), Day(39)],
43
+ days_of_week=(THURSDAY,),
44
+ )
45
+ # Pentecost Day (Pfingstmontag)
46
+ PentecostMonday = Holiday(
47
+ 'Pentecost Monday',
48
+ month=1,
49
+ day=1,
50
+ offset=[Easter(), Day(50)],
51
+ days_of_week=(MONDAY,),
52
+ )
53
+ # Swiss National Day
54
+ SwissNationalDay = Holiday(
55
+ "Swiss National Day",
56
+ month=8,
57
+ day=1,
58
+ days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
59
+ )
60
+ # Christmas Eve
61
+ ChristmasEve = Holiday(
62
+ 'Christmas Eve',
63
+ month=12,
64
+ day=24,
65
+ )
66
+ # Christmas
67
+ Christmas = Holiday(
68
+ "Christmas",
69
+ month=12,
70
+ day=25,
71
+ days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
72
+ )
73
+ # Boxing day
74
+ BoxingDay = Holiday(
75
+ "Boxing Day",
76
+ month=12,
77
+ day=26,
78
+ )
79
+
80
+
81
+ class SIXExchangeCalendar(MarketCalendar):
82
+ """
83
+ Exchange calendar for SIX
84
+
85
+ """
86
+ aliases = ['SIX']
87
+ regular_market_times = {
88
+ "market_open": ((None, time(9)),),
89
+ "market_close": ((None, time(17,30)),),
90
+ }
91
+ @property
92
+ def name(self):
93
+ return "SIX"
94
+
95
+ @property
96
+ def tz(self):
97
+ return timezone('Europe/Zurich')
98
+
99
+ @property
100
+ def regular_holidays(self):
101
+ return AbstractHolidayCalendar(rules=[
102
+ NewYearsDay,
103
+ BertholdsDay,
104
+ GoodFriday,
105
+ EasterMonday,
106
+ MayBank,
107
+ AscensionDay,
108
+ PentecostMonday,
109
+ SwissNationalDay,
110
+ ChristmasEve,
111
+ Christmas,
112
+ BoxingDay,
113
+ NewYearsEve,
114
+ ])