pandas-market-calendars 4.6.1__py3-none-any.whl → 5.1.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.
- pandas_market_calendars/calendar_utils.py +35 -84
- pandas_market_calendars/calendars/asx.py +6 -2
- pandas_market_calendars/calendars/bmf.py +4 -8
- pandas_market_calendars/calendars/bse.py +6 -2
- pandas_market_calendars/calendars/cboe.py +6 -2
- pandas_market_calendars/calendars/cme.py +4 -4
- pandas_market_calendars/calendars/cme_globex_base.py +2 -2
- pandas_market_calendars/calendars/cme_globex_crypto.py +12 -14
- pandas_market_calendars/calendars/cme_globex_energy_and_metals.py +4 -4
- pandas_market_calendars/calendars/cme_globex_equities.py +2 -2
- pandas_market_calendars/calendars/eurex.py +2 -2
- pandas_market_calendars/calendars/eurex_fixed_income.py +2 -2
- pandas_market_calendars/calendars/hkex.py +7 -5
- pandas_market_calendars/calendars/ice.py +2 -2
- pandas_market_calendars/calendars/iex.py +7 -3
- pandas_market_calendars/calendars/jpx.py +6 -2
- pandas_market_calendars/calendars/lse.py +6 -2
- pandas_market_calendars/calendars/mirror.py +6 -11
- pandas_market_calendars/calendars/nyse.py +41 -42
- pandas_market_calendars/calendars/ose.py +7 -5
- pandas_market_calendars/calendars/sifma.py +51 -22
- pandas_market_calendars/calendars/six.py +6 -2
- pandas_market_calendars/calendars/sse.py +6 -2
- pandas_market_calendars/calendars/tase.py +6 -2
- pandas_market_calendars/calendars/tsx.py +6 -2
- pandas_market_calendars/class_registry.py +1 -3
- pandas_market_calendars/holidays/sifma.py +31 -31
- pandas_market_calendars/market_calendar.py +33 -82
- {pandas_market_calendars-4.6.1.dist-info → pandas_market_calendars-5.1.0.dist-info}/METADATA +7 -4
- pandas_market_calendars-5.1.0.dist-info/RECORD +50 -0
- {pandas_market_calendars-4.6.1.dist-info → pandas_market_calendars-5.1.0.dist-info}/WHEEL +1 -1
- pandas_market_calendars-4.6.1.dist-info/RECORD +0 -50
- {pandas_market_calendars-4.6.1.dist-info → pandas_market_calendars-5.1.0.dist-info/licenses}/LICENSE +0 -0
- {pandas_market_calendars-4.6.1.dist-info → pandas_market_calendars-5.1.0.dist-info/licenses}/NOTICE +0 -0
- {pandas_market_calendars-4.6.1.dist-info → pandas_market_calendars-5.1.0.dist-info}/top_level.txt +0 -0
@@ -2,7 +2,7 @@ from datetime import time, timedelta
|
|
2
2
|
from functools import partial
|
3
3
|
|
4
4
|
from pandas.tseries.holiday import AbstractHolidayCalendar, Holiday, next_monday
|
5
|
-
from
|
5
|
+
from zoneinfo import ZoneInfo
|
6
6
|
|
7
7
|
from pandas_market_calendars.holidays.cn import *
|
8
8
|
from pandas_market_calendars.market_calendar import MarketCalendar
|
@@ -29,9 +29,13 @@ class SSEExchangeCalendar(MarketCalendar):
|
|
29
29
|
def name(self):
|
30
30
|
return "SSE"
|
31
31
|
|
32
|
+
@property
|
33
|
+
def full_name(self):
|
34
|
+
return "Shanghai Stock Exchange"
|
35
|
+
|
32
36
|
@property
|
33
37
|
def tz(self):
|
34
|
-
return
|
38
|
+
return ZoneInfo("Asia/Shanghai")
|
35
39
|
|
36
40
|
@property
|
37
41
|
def regular_holidays(self):
|
@@ -2,7 +2,7 @@ from datetime import time
|
|
2
2
|
|
3
3
|
from typing import Literal, Union
|
4
4
|
from pandas import Timestamp, Timedelta, DatetimeIndex
|
5
|
-
from
|
5
|
+
from zoneinfo import ZoneInfo
|
6
6
|
|
7
7
|
from pandas_market_calendars.market_calendar import MarketCalendar
|
8
8
|
from pandas_market_calendars.calendar_utils import Day_Anchor, Month_Anchor
|
@@ -186,9 +186,13 @@ class TASEExchangeCalendar(MarketCalendar):
|
|
186
186
|
def name(self):
|
187
187
|
return "TASE"
|
188
188
|
|
189
|
+
@property
|
190
|
+
def full_name(self):
|
191
|
+
return "Tel Aviv Stock Exchange"
|
192
|
+
|
189
193
|
@property
|
190
194
|
def tz(self):
|
191
|
-
return
|
195
|
+
return ZoneInfo("Asia/Jerusalem")
|
192
196
|
|
193
197
|
@property
|
194
198
|
def adhoc_holidays(self):
|
@@ -10,7 +10,7 @@ from pandas.tseries.holiday import (
|
|
10
10
|
MO,
|
11
11
|
weekend_to_monday,
|
12
12
|
)
|
13
|
-
from
|
13
|
+
from zoneinfo import ZoneInfo
|
14
14
|
|
15
15
|
from pandas_market_calendars.holidays.uk import (
|
16
16
|
BoxingDay,
|
@@ -138,9 +138,13 @@ class TSXExchangeCalendar(MarketCalendar):
|
|
138
138
|
def name(self):
|
139
139
|
return "TSX"
|
140
140
|
|
141
|
+
@property
|
142
|
+
def full_name(self):
|
143
|
+
return "Toronto Stock Exchange"
|
144
|
+
|
141
145
|
@property
|
142
146
|
def tz(self):
|
143
|
-
return
|
147
|
+
return ZoneInfo("Canada/Eastern")
|
144
148
|
|
145
149
|
regular_early_close = time(13)
|
146
150
|
|
@@ -105,9 +105,7 @@ class ProtectedDict(dict):
|
|
105
105
|
|
106
106
|
def __str__(self):
|
107
107
|
try:
|
108
|
-
formatted = pformat(
|
109
|
-
dict(self), sort_dicts=False
|
110
|
-
) # sort_dicts apparently not available < python3.8
|
108
|
+
formatted = pformat(dict(self), sort_dicts=False) # sort_dicts apparently not available < python3.8
|
111
109
|
except TypeError:
|
112
110
|
formatted = pformat(dict(self))
|
113
111
|
|
@@ -89,27 +89,31 @@ USPresidentsDay = Holiday(
|
|
89
89
|
############################################################
|
90
90
|
# Good Friday
|
91
91
|
############################################################
|
92
|
+
|
93
|
+
|
94
|
+
def is_first_friday(dt):
|
95
|
+
"""Check if date is the first Friday of the month"""
|
96
|
+
# The first Friday of any month must occur on or before the 7th.
|
97
|
+
# This check is sufficient regardless of whether Good Friday is in March or April.
|
98
|
+
return dt.weekday() == FRIDAY and dt.day <= 7
|
99
|
+
|
100
|
+
|
92
101
|
GoodFridayThru2020 = Holiday(
|
93
|
-
"Good Friday
|
102
|
+
"Good Friday Thru 2020",
|
94
103
|
end_date=Timestamp("2020-12-31"),
|
95
104
|
month=1,
|
96
105
|
day=1,
|
97
106
|
offset=[Easter(), Day(-2)],
|
98
107
|
)
|
99
108
|
|
100
|
-
#
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
GoodFriday2pmEarlyCloseAdHoc = [
|
110
|
-
Timestamp("2021-04-02", tz="UTC"),
|
111
|
-
Timestamp("2023-04-07", tz="UTC"),
|
112
|
-
]
|
109
|
+
# Generate potential Good Friday dates post 2020 (will be filtered in calendar class)
|
110
|
+
GoodFridayPotentialPost2020 = Holiday(
|
111
|
+
"Good Friday Potential Post 2020",
|
112
|
+
start_date=Timestamp("2021-01-01"),
|
113
|
+
month=1,
|
114
|
+
day=1,
|
115
|
+
offset=[Easter(), Day(-2)],
|
116
|
+
)
|
113
117
|
|
114
118
|
DayBeforeGoodFriday2pmEarlyCloseThru2020 = Holiday(
|
115
119
|
"Day Before Good Friday Thru 2020",
|
@@ -119,10 +123,14 @@ DayBeforeGoodFriday2pmEarlyCloseThru2020 = Holiday(
|
|
119
123
|
offset=[Easter(), Day(-3)],
|
120
124
|
)
|
121
125
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
+
# Generate potential Thursday before Good Friday dates post 2020 (will be filtered in calendar class)
|
127
|
+
DayBeforeGoodFridayPotentialPost2020 = Holiday(
|
128
|
+
"Day Before Good Friday Potential Post 2020",
|
129
|
+
start_date=Timestamp("2021-01-01"),
|
130
|
+
month=1,
|
131
|
+
day=1,
|
132
|
+
offset=[Easter(), Day(-3)],
|
133
|
+
)
|
126
134
|
|
127
135
|
##################################################
|
128
136
|
# US Memorial Day (Decoration Day) May 30
|
@@ -204,20 +212,14 @@ USColumbusDay = Holiday(
|
|
204
212
|
# When falls on Saturday, no holiday is observed.
|
205
213
|
# When falls on Sunday, the Monday following is a holiday.
|
206
214
|
##########################################################
|
207
|
-
USVeteransDay2022 = Holiday(
|
208
|
-
"Veterans Day Prior to 2023",
|
209
|
-
month=11,
|
210
|
-
day=11,
|
211
|
-
end_date=Timestamp("2022-12-31"),
|
212
|
-
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
|
213
|
-
observance=sunday_to_monday,
|
214
|
-
)
|
215
|
-
|
216
215
|
USVeteransDay = Holiday(
|
217
216
|
"Veterans Day",
|
218
217
|
month=11,
|
219
218
|
day=11,
|
220
|
-
|
219
|
+
# SIFMA guidance for observing only Mon-Fri or Sunday->Monday
|
220
|
+
# appears consistent for many years. This rule doesn't specify
|
221
|
+
# a start_date, letting it apply further back if needed by other logic,
|
222
|
+
# while effectively covering 2023+ due to the days_of_week filter.
|
221
223
|
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY),
|
222
224
|
observance=sunday_to_monday,
|
223
225
|
)
|
@@ -225,9 +227,7 @@ USVeteransDay = Holiday(
|
|
225
227
|
################################################
|
226
228
|
# US Thanksgiving Nov 30
|
227
229
|
################################################
|
228
|
-
USThanksgivingDay = Holiday(
|
229
|
-
"Thanksgiving", month=11, day=1, offset=DateOffset(weekday=TH(4))
|
230
|
-
)
|
230
|
+
USThanksgivingDay = Holiday("Thanksgiving", month=11, day=1, offset=DateOffset(weekday=TH(4)))
|
231
231
|
|
232
232
|
DayAfterThanksgiving2pmEarlyClose = Holiday(
|
233
233
|
"Black Friday",
|
@@ -90,16 +90,10 @@ class MarketCalendar(metaclass=MarketCalendarMeta):
|
|
90
90
|
"""All Market Calendar names and aliases that can be used in "factory"
|
91
91
|
:return: list(str)
|
92
92
|
"""
|
93
|
-
return [
|
94
|
-
cal
|
95
|
-
for cal in cls._regmeta_class_registry.keys()
|
96
|
-
if cal not in ["MarketCalendar", "TradingCalendar"]
|
97
|
-
]
|
93
|
+
return [cal for cal in cls._regmeta_class_registry.keys() if cal not in ["MarketCalendar", "TradingCalendar"]]
|
98
94
|
|
99
95
|
@classmethod
|
100
|
-
def factory(
|
101
|
-
cls, name, *args, **kwargs
|
102
|
-
): # Will be set by Meta, keeping it there for tests
|
96
|
+
def factory(cls, name, *args, **kwargs): # Will be set by Meta, keeping it there for tests
|
103
97
|
"""
|
104
98
|
:param name: The name of the MarketCalendar to be retrieved.
|
105
99
|
:param *args/**kwargs: passed to requested MarketCalendar.__init__
|
@@ -136,6 +130,15 @@ class MarketCalendar(metaclass=MarketCalendarMeta):
|
|
136
130
|
"""
|
137
131
|
raise NotImplementedError()
|
138
132
|
|
133
|
+
@property
|
134
|
+
def full_name(self):
|
135
|
+
"""
|
136
|
+
Full name of the market
|
137
|
+
|
138
|
+
:return: string name
|
139
|
+
"""
|
140
|
+
return self.name
|
141
|
+
|
139
142
|
@property
|
140
143
|
@abstractmethod
|
141
144
|
def tz(self):
|
@@ -152,9 +155,7 @@ class MarketCalendar(metaclass=MarketCalendarMeta):
|
|
152
155
|
|
153
156
|
def _prepare_regular_market_times(self):
|
154
157
|
oc_map = self.open_close_map
|
155
|
-
assert all(
|
156
|
-
isinstance(x, bool) for x in oc_map.values()
|
157
|
-
), "Values in open_close_map need to be True or False"
|
158
|
+
assert all(isinstance(x, bool) for x in oc_map.values()), "Values in open_close_map need to be True or False"
|
158
159
|
|
159
160
|
regular = self.regular_market_times
|
160
161
|
discontinued = ProtectedDict()
|
@@ -171,9 +172,7 @@ class MarketCalendar(metaclass=MarketCalendarMeta):
|
|
171
172
|
times = times[:-1]
|
172
173
|
regular._set(market_time, times)
|
173
174
|
|
174
|
-
regular_tds[market_time] = tuple(
|
175
|
-
(t[0], self._tdelta(t[1], self._off(t))) for t in times
|
176
|
-
)
|
175
|
+
regular_tds[market_time] = tuple((t[0], self._tdelta(t[1], self._off(t))) for t in times)
|
177
176
|
|
178
177
|
if discontinued:
|
179
178
|
warnings.warn(
|
@@ -203,14 +202,8 @@ class MarketCalendar(metaclass=MarketCalendarMeta):
|
|
203
202
|
ln = len(times)
|
204
203
|
for i, t in enumerate(times):
|
205
204
|
try:
|
206
|
-
assert (
|
207
|
-
|
208
|
-
or isinstance(t[0], str)
|
209
|
-
or isinstance(t[0], pd.Timestamp)
|
210
|
-
)
|
211
|
-
assert isinstance(t[1], time) or (
|
212
|
-
ln > 1 and i == ln - 1 and t[1] is None
|
213
|
-
)
|
205
|
+
assert t[0] is None or isinstance(t[0], str) or isinstance(t[0], pd.Timestamp)
|
206
|
+
assert isinstance(t[1], time) or (ln > 1 and i == ln - 1 and t[1] is None)
|
214
207
|
assert isinstance(self._off(t), int)
|
215
208
|
except AssertionError:
|
216
209
|
raise AssertionError(
|
@@ -230,9 +223,7 @@ class MarketCalendar(metaclass=MarketCalendarMeta):
|
|
230
223
|
except KeyError:
|
231
224
|
pass
|
232
225
|
else:
|
233
|
-
raise ValueError(
|
234
|
-
"when you pass `opens`, it needs to be True, False, or None"
|
235
|
-
)
|
226
|
+
raise ValueError("when you pass `opens`, it needs to be True, False, or None")
|
236
227
|
|
237
228
|
self.regular_market_times._set(market_time, times)
|
238
229
|
|
@@ -271,8 +262,7 @@ class MarketCalendar(metaclass=MarketCalendarMeta):
|
|
271
262
|
:return: None
|
272
263
|
"""
|
273
264
|
assert market_time not in self.regular_market_times, (
|
274
|
-
f"{market_time} is already in regular_market_times:"
|
275
|
-
f"\n{self._market_times}"
|
265
|
+
f"{market_time} is already in regular_market_times:" f"\n{self._market_times}"
|
276
266
|
)
|
277
267
|
|
278
268
|
return self._set_time(market_time, times, opens)
|
@@ -503,26 +493,19 @@ class MarketCalendar(metaclass=MarketCalendarMeta):
|
|
503
493
|
2011-01-10 NaT
|
504
494
|
dtype: datetime64[ns, UTC]
|
505
495
|
"""
|
506
|
-
col = (
|
507
|
-
col.dropna()
|
508
|
-
) # Python 3.8, pandas 2.0.3 cannot create time deltas from NaT
|
496
|
+
col = col.dropna() # Python 3.8, pandas 2.0.3 cannot create time deltas from NaT
|
509
497
|
try:
|
510
498
|
times = col.str[0]
|
511
499
|
except AttributeError: # no tuples, only offset 0
|
512
500
|
return (
|
513
|
-
(
|
514
|
-
pd.to_timedelta(col.astype("string").fillna(""), errors="coerce")
|
515
|
-
+ col.index
|
516
|
-
)
|
501
|
+
(pd.to_timedelta(col.astype("string").fillna(""), errors="coerce") + col.index)
|
517
502
|
.dt.tz_localize(self.tz)
|
518
503
|
.dt.tz_convert("UTC")
|
519
504
|
)
|
520
505
|
|
521
506
|
return (
|
522
507
|
(
|
523
|
-
pd.to_timedelta(
|
524
|
-
times.fillna(col).astype("string").fillna(""), errors="coerce"
|
525
|
-
)
|
508
|
+
pd.to_timedelta(times.fillna(col).astype("string").fillna(""), errors="coerce")
|
526
509
|
+ pd.to_timedelta(col.str[1].fillna(0), unit="D")
|
527
510
|
+ col.index
|
528
511
|
)
|
@@ -532,11 +515,7 @@ class MarketCalendar(metaclass=MarketCalendarMeta):
|
|
532
515
|
|
533
516
|
@staticmethod
|
534
517
|
def _col_name(n: int):
|
535
|
-
return
|
536
|
-
f"interruption_start_{n // 2 + 1}"
|
537
|
-
if n % 2 == 1
|
538
|
-
else f"interruption_end_{n // 2}"
|
539
|
-
)
|
518
|
+
return f"interruption_start_{n // 2 + 1}" if n % 2 == 1 else f"interruption_end_{n // 2}"
|
540
519
|
|
541
520
|
@property
|
542
521
|
def interruptions_df(self):
|
@@ -579,9 +558,7 @@ class MarketCalendar(metaclass=MarketCalendarMeta):
|
|
579
558
|
:param tz: time zone in either string or pytz.timezone
|
580
559
|
:return: DatetimeIndex of valid business days
|
581
560
|
"""
|
582
|
-
return pd.date_range(
|
583
|
-
start_date, end_date, freq=self.holidays(), normalize=True, tz=tz
|
584
|
-
)
|
561
|
+
return pd.date_range(start_date, end_date, freq=self.holidays(), normalize=True, tz=tz)
|
585
562
|
|
586
563
|
def _get_market_times(self, start, end):
|
587
564
|
mts = self._market_times
|
@@ -611,15 +588,11 @@ class MarketCalendar(metaclass=MarketCalendarMeta):
|
|
611
588
|
# Offset days without tz to avoid timezone issues.
|
612
589
|
days = pd.DatetimeIndex(days).tz_localize(None).to_series()
|
613
590
|
|
614
|
-
if isinstance(
|
615
|
-
market_time, str
|
616
|
-
): # if string, assume its a reference to saved market times
|
591
|
+
if isinstance(market_time, str): # if string, assume its a reference to saved market times
|
617
592
|
timedeltas = self._regular_market_timedeltas[market_time]
|
618
593
|
datetimes = days + timedeltas[0][1]
|
619
594
|
for cut_off, timedelta in timedeltas[1:]:
|
620
|
-
datetimes = datetimes.where(
|
621
|
-
days < pd.Timestamp(cut_off), days + timedelta
|
622
|
-
)
|
595
|
+
datetimes = datetimes.where(days < pd.Timestamp(cut_off), days + timedelta)
|
623
596
|
|
624
597
|
else: # otherwise, assume it is a datetime.time object
|
625
598
|
datetimes = days + self._tdelta(market_time, day_offset)
|
@@ -632,9 +605,7 @@ class MarketCalendar(metaclass=MarketCalendarMeta):
|
|
632
605
|
# more efficient to extract and return those dates
|
633
606
|
observed_dates = u.all_single_observance_rules(cal)
|
634
607
|
if observed_dates is not None:
|
635
|
-
return pd.DatetimeIndex(
|
636
|
-
[date for date in observed_dates if s <= date <= e]
|
637
|
-
)
|
608
|
+
return pd.DatetimeIndex([date for date in observed_dates if s <= date <= e])
|
638
609
|
else:
|
639
610
|
return cal.holidays(s, e)
|
640
611
|
except ValueError:
|
@@ -652,15 +623,9 @@ class MarketCalendar(metaclass=MarketCalendarMeta):
|
|
652
623
|
for time_, calendar in calendars:
|
653
624
|
if isinstance(calendar, int):
|
654
625
|
day_of_week = CustomBusinessDay(weekmask=WEEKMASK_ABBR[calendar])
|
655
|
-
indexes.append(
|
656
|
-
self.days_at_time(
|
657
|
-
pd.date_range(start, end, freq=day_of_week), time_
|
658
|
-
)
|
659
|
-
)
|
626
|
+
indexes.append(self.days_at_time(pd.date_range(start, end, freq=day_of_week), time_))
|
660
627
|
else:
|
661
|
-
indexes.append(
|
662
|
-
self.days_at_time(self._tryholidays(calendar, start, end), time_)
|
663
|
-
)
|
628
|
+
indexes.append(self.days_at_time(self._tryholidays(calendar, start, end), time_))
|
664
629
|
|
665
630
|
indexes += [self.days_at_time(dates, time_) for time_, dates in ad_hoc_dates]
|
666
631
|
|
@@ -688,9 +653,7 @@ class MarketCalendar(metaclass=MarketCalendarMeta):
|
|
688
653
|
|
689
654
|
if filter_holidays:
|
690
655
|
valid = self.valid_days(start_date, end_date, tz=None)
|
691
|
-
special = special[
|
692
|
-
special.index.isin(valid)
|
693
|
-
] # some sources of special times don't exclude holidays
|
656
|
+
special = special[special.index.isin(valid)] # some sources of special times don't exclude holidays
|
694
657
|
return special
|
695
658
|
|
696
659
|
def schedule(
|
@@ -744,13 +707,9 @@ class MarketCalendar(metaclass=MarketCalendarMeta):
|
|
744
707
|
market_times = self._market_times
|
745
708
|
|
746
709
|
if not _all_days.size: # If no valid days return an empty DataFrame
|
747
|
-
return pd.DataFrame(
|
748
|
-
columns=market_times, index=pd.DatetimeIndex([], freq="C")
|
749
|
-
)
|
710
|
+
return pd.DataFrame(columns=market_times, index=pd.DatetimeIndex([], freq="C"))
|
750
711
|
|
751
|
-
return self.schedule_from_days(
|
752
|
-
_all_days, tz, start, end, force_special_times, market_times, interruptions
|
753
|
-
)
|
712
|
+
return self.schedule_from_days(_all_days, tz, start, end, force_special_times, market_times, interruptions)
|
754
713
|
|
755
714
|
def schedule_from_days(
|
756
715
|
self,
|
@@ -810,9 +769,7 @@ class MarketCalendar(metaclass=MarketCalendarMeta):
|
|
810
769
|
temp = self.days_at_time(days, market_time).copy() # standard times
|
811
770
|
if _adj_col:
|
812
771
|
# create an array of special times
|
813
|
-
special = self.special_dates(
|
814
|
-
market_time, days[0], days[-1], filter_holidays=False
|
815
|
-
)
|
772
|
+
special = self.special_dates(market_time, days[0], days[-1], filter_holidays=False)
|
816
773
|
# overwrite standard times
|
817
774
|
specialix = special.index[
|
818
775
|
special.index.isin(temp.index)
|
@@ -970,11 +927,7 @@ class MarketCalendar(metaclass=MarketCalendarMeta):
|
|
970
927
|
|
971
928
|
# When post follows market_close, market_close should not be considered a close
|
972
929
|
day.loc[day.eq("market_close") & day.shift(-1).eq("post")] = "market_open"
|
973
|
-
day = day.map(
|
974
|
-
lambda x: (
|
975
|
-
self.open_close_map.get(x) if x in self.open_close_map.keys() else x
|
976
|
-
)
|
977
|
-
)
|
930
|
+
day = day.map(lambda x: (self.open_close_map.get(x) if x in self.open_close_map.keys() else x))
|
978
931
|
|
979
932
|
if include_close:
|
980
933
|
below = day.index < timestamp
|
@@ -1001,9 +954,7 @@ class MarketCalendar(metaclass=MarketCalendarMeta):
|
|
1001
954
|
:return: True if the current local system time is a valid open date and time, False if not
|
1002
955
|
"""
|
1003
956
|
current_time = MarketCalendar._get_current_time()
|
1004
|
-
return self.open_at_time(
|
1005
|
-
schedule, current_time, include_close=include_close, only_rth=only_rth
|
1006
|
-
)
|
957
|
+
return self.open_at_time(schedule, current_time, include_close=include_close, only_rth=only_rth)
|
1007
958
|
|
1008
959
|
def clean_dates(self, start_date, end_date):
|
1009
960
|
"""
|
{pandas_market_calendars-4.6.1.dist-info → pandas_market_calendars-5.1.0.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: pandas_market_calendars
|
3
|
-
Version:
|
3
|
+
Version: 5.1.0
|
4
4
|
Summary: Market and exchange trading calendars for pandas
|
5
5
|
Author-email: Ryan Sheftel <rsheftel@alumni.upenn.edu>
|
6
6
|
License: MIT
|
@@ -19,12 +19,12 @@ Classifier: Programming Language :: Python :: 3.10
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.11
|
20
20
|
Classifier: Programming Language :: Python :: 3.12
|
21
21
|
Classifier: Programming Language :: Python :: 3.13
|
22
|
-
Requires-Python: >=3.
|
22
|
+
Requires-Python: >=3.8
|
23
23
|
Description-Content-Type: text/x-rst
|
24
24
|
License-File: LICENSE
|
25
25
|
License-File: NOTICE
|
26
26
|
Requires-Dist: pandas>=1.1
|
27
|
-
Requires-Dist:
|
27
|
+
Requires-Dist: tzdata
|
28
28
|
Requires-Dist: python-dateutil
|
29
29
|
Requires-Dist: exchange-calendars>=3.3
|
30
30
|
Provides-Extra: dev
|
@@ -32,6 +32,7 @@ Requires-Dist: pytest; extra == "dev"
|
|
32
32
|
Requires-Dist: black; extra == "dev"
|
33
33
|
Requires-Dist: pre-commit; extra == "dev"
|
34
34
|
Requires-Dist: build; extra == "dev"
|
35
|
+
Dynamic: license-file
|
35
36
|
|
36
37
|
pandas_market_calendars
|
37
38
|
=======================
|
@@ -83,6 +84,8 @@ As of v3.0, the function date_range() is more complete and consistent, for more
|
|
83
84
|
As of v4.0, this package provides the framework to add interruptions to calendars. These can also be added to a schedule and viewed using
|
84
85
|
the new interruptions_df property. A full list of changes can be found in PR #210.
|
85
86
|
|
87
|
+
As of v5.0, this package uses the new zoneinfo standard to timezones and depricates and removes pytz. Minimum python version is now 3.9
|
88
|
+
|
86
89
|
Source location
|
87
90
|
~~~~~~~~~~~~~~~
|
88
91
|
Hosted on GitHub: https://github.com/rsheftel/pandas_market_calendars
|
@@ -0,0 +1,50 @@
|
|
1
|
+
pandas_market_calendars/__init__.py,sha256=9nFwO1i8mOeM9V75vRmbHCz4pcjSjfXHl8CBvrM-_2s,1357
|
2
|
+
pandas_market_calendars/calendar_registry.py,sha256=9ecKkERkztiwVaOXVsWfUcEvaT5_SwwpD5VaUAJhR1Y,2495
|
3
|
+
pandas_market_calendars/calendar_utils.py,sha256=bTW3q4l-PvqJaOmXsfh3LCqRn47TZXKlXNvQSFMgLwE,52151
|
4
|
+
pandas_market_calendars/class_registry.py,sha256=-L3nL7lTSc8B7ieMmA-2ifakJn6pzaLT1bUzSdrTlsg,3838
|
5
|
+
pandas_market_calendars/market_calendar.py,sha256=1VSeiz4ZWk54ARiyxJClHjQ_C0NkdsDQClm4SjSVorM,40409
|
6
|
+
pandas_market_calendars/calendars/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
+
pandas_market_calendars/calendars/asx.py,sha256=W2PLAffVFtwAT7gVSdgOYUKVQJOKR7BjvQZcLptO09U,1881
|
8
|
+
pandas_market_calendars/calendars/bmf.py,sha256=uirnsX-dCh5pD8LXvnlpyifSgnVgPZuZu7NPNGIlX6A,5931
|
9
|
+
pandas_market_calendars/calendars/bse.py,sha256=dhq9E3nzXcz6psQr2HaGRMUYeQncPyNs08V6i4KHXHI,17030
|
10
|
+
pandas_market_calendars/calendars/cboe.py,sha256=lM3K36dH2cmq7uwuaNC6BXkoLWUC3UKtFSPPDc16LrU,3848
|
11
|
+
pandas_market_calendars/calendars/cme.py,sha256=j5ubgVfa5GsfAi_8zZIG3sfXRQe2vitzEtuCJrSrC44,10454
|
12
|
+
pandas_market_calendars/calendars/cme_globex_agriculture.py,sha256=j1Dyg1Q_i3fh4452OeFa5Jw55FW0dhdjmPkmjP85KPc,4666
|
13
|
+
pandas_market_calendars/calendars/cme_globex_base.py,sha256=izubYd4UEJbnGOf0k2jrwCZbb_gLaHW2e1w6TVsG81w,3066
|
14
|
+
pandas_market_calendars/calendars/cme_globex_crypto.py,sha256=t7qg7TyP2aNhW_ov8QMl3yJfBu0L3_krXvGDthHHCGs,5404
|
15
|
+
pandas_market_calendars/calendars/cme_globex_energy_and_metals.py,sha256=mYMyobq5pobFFkrUKGU_253CH5LwWL1LLJasH89ID0o,6624
|
16
|
+
pandas_market_calendars/calendars/cme_globex_equities.py,sha256=66x0YkW7GYDGdu6ttrrdHOnYqOhBK94K30TK0kTh6eM,3643
|
17
|
+
pandas_market_calendars/calendars/cme_globex_fixed_income.py,sha256=egxw-OKUI-SPbNjsLquqPDWQIVX94-torkAuzW6a0aA,4287
|
18
|
+
pandas_market_calendars/calendars/cme_globex_fx.py,sha256=lZJpZvKWC9kGcHVjUSG69vH82VwiifLYt1rAlZsDVaM,3206
|
19
|
+
pandas_market_calendars/calendars/eurex.py,sha256=tlYB5Homx2xyvnQriXfefgna6Zer2EoxkKKXwB-UnJc,2681
|
20
|
+
pandas_market_calendars/calendars/eurex_fixed_income.py,sha256=5tlN8o_bkKJozUa5BF_7leDW6EBKzc44nPbmZKCxB4Y,2136
|
21
|
+
pandas_market_calendars/calendars/hkex.py,sha256=ik1TGa7xETCbgBGyQzAS-tO04zrybRORYBXWKMK4vrg,14068
|
22
|
+
pandas_market_calendars/calendars/ice.py,sha256=Lx7vxRrX9k8DX9C6uvn39RFf3xDocR4okgWwzviopM4,2163
|
23
|
+
pandas_market_calendars/calendars/iex.py,sha256=LAw-qiS-uRd6xWuYlOSj1YsnQgfMwcugYI6lSn1XqSk,4464
|
24
|
+
pandas_market_calendars/calendars/jpx.py,sha256=z6iB3HF4rDq67775oNOvb-snSuXNnOOt_KSRmpp2-3w,3901
|
25
|
+
pandas_market_calendars/calendars/lse.py,sha256=G9LMdGJcWPaZQRbaihVGtYbD92b9I6E0r1kRQRVGheE,3197
|
26
|
+
pandas_market_calendars/calendars/mirror.py,sha256=UVMUV6RMuT9h3U46eNFYllSF8fGFwi6U1L9z_EroiD0,4422
|
27
|
+
pandas_market_calendars/calendars/nyse.py,sha256=IdldsuESaZ47Vzm7RyK2ZvpiVMuoQMAH_zR48weLk8U,66206
|
28
|
+
pandas_market_calendars/calendars/ose.py,sha256=BVgMWrmZRaaPXddyXlgtxHz8GcRMLKdhAshOHc3dnUU,3013
|
29
|
+
pandas_market_calendars/calendars/sifma.py,sha256=o50Gr01x6cl_CtvY2FvvFTCLG9WJcUsVO8AQdOiZijs,11745
|
30
|
+
pandas_market_calendars/calendars/six.py,sha256=zVlaVvNxMx2oRhc054B_A3YrsyD1dtKnUtEGkkx34Xk,2690
|
31
|
+
pandas_market_calendars/calendars/sse.py,sha256=HL5o5WOQr7EZVXW35ujhqdCAgobHyQOEkfQzz7SR6t0,10992
|
32
|
+
pandas_market_calendars/calendars/tase.py,sha256=3zvGAl_fvwVis522zTs3-9QT2UKA1LlHocA-B-UYqmM,8756
|
33
|
+
pandas_market_calendars/calendars/tsx.py,sha256=cfLv9zzaIPFv3S_sQFHrc-BFcxm5z3E_0ZP7S-xuExs,4098
|
34
|
+
pandas_market_calendars/holidays/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
35
|
+
pandas_market_calendars/holidays/cme.py,sha256=TrxR8xA6cgy0YcUfImaKI2QjRmqlwv6pW5KjMKsE1Rg,9089
|
36
|
+
pandas_market_calendars/holidays/cme_globex.py,sha256=0SPVGABO7K66eRitDsDgxRU52aPX8SRGgtUVyB_-LYk,5090
|
37
|
+
pandas_market_calendars/holidays/cn.py,sha256=-45lLLaGDJZnHMKhOf-RXuHAo7TDBDWdeQ0hRkeMovg,47467
|
38
|
+
pandas_market_calendars/holidays/jp.py,sha256=rqobVw837Uxb-4D1Zq_PyBLoeyhImYW7DBwyJupJIp8,9216
|
39
|
+
pandas_market_calendars/holidays/jpx_equinox.py,sha256=KWbJqWsnkdyzG3fD2gJTXRLQOF3YTWSn9O6sYRL9Dnk,8070
|
40
|
+
pandas_market_calendars/holidays/nyse.py,sha256=jwcz3Xp7NNL0rnwrQG8vuuBuXg7YTSBcg733nmFw-uM,39831
|
41
|
+
pandas_market_calendars/holidays/oz.py,sha256=P77pWe7ZQj4o-731w6fW_Vzmo41PRxh94QpclI3ZyFM,1042
|
42
|
+
pandas_market_calendars/holidays/sifma.py,sha256=PsGYHMHD5fH02o7UUuDB4yadUWawUXRUHH7UDO5GZvc,9183
|
43
|
+
pandas_market_calendars/holidays/uk.py,sha256=dt5TNONlDMXPw8wjyyPBYNnLO5Yz6Mht8VrPUrNqy-M,4719
|
44
|
+
pandas_market_calendars/holidays/us.py,sha256=OBBMMKTRzghD-b9CmPRe5zBh7zQYjWl4-9SogT6ZnBo,11515
|
45
|
+
pandas_market_calendars-5.1.0.dist-info/licenses/LICENSE,sha256=qW51_A-I7YutlB-s8VSKeOP-aL83T-Lb8LqqU1x1ilw,1065
|
46
|
+
pandas_market_calendars-5.1.0.dist-info/licenses/NOTICE,sha256=mmH7c9aF5FsELh1OHXloXw1TajLD_mWDKO4dsVf43_E,11693
|
47
|
+
pandas_market_calendars-5.1.0.dist-info/METADATA,sha256=b9voNNgwPUyYYTXbUDmFrQmUyCOG3pkBfEgtFB49x7k,9641
|
48
|
+
pandas_market_calendars-5.1.0.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
|
49
|
+
pandas_market_calendars-5.1.0.dist-info/top_level.txt,sha256=_4cUEFr07SuEAzZMT-5p0lJGXxO9imVbEK9_5oqcopQ,24
|
50
|
+
pandas_market_calendars-5.1.0.dist-info/RECORD,,
|
@@ -1,50 +0,0 @@
|
|
1
|
-
pandas_market_calendars/__init__.py,sha256=9nFwO1i8mOeM9V75vRmbHCz4pcjSjfXHl8CBvrM-_2s,1357
|
2
|
-
pandas_market_calendars/calendar_registry.py,sha256=9ecKkERkztiwVaOXVsWfUcEvaT5_SwwpD5VaUAJhR1Y,2495
|
3
|
-
pandas_market_calendars/calendar_utils.py,sha256=f63aNk3Y1RdZhgMhESaCZkCxsOFxJHyq8Hn8C9IrD1w,52360
|
4
|
-
pandas_market_calendars/class_registry.py,sha256=lpRSp1E_1vcY73a--daCIOsJpoxpJVuhlurRGDVUqlc,3868
|
5
|
-
pandas_market_calendars/market_calendar.py,sha256=8h1EamEX0byTNSOZLotg_DboJkwxESghd5J1yMdKLlU,41134
|
6
|
-
pandas_market_calendars/calendars/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
-
pandas_market_calendars/calendars/asx.py,sha256=tocL_VXzbPNx89mmtXmSw7FKHy2Hzlj5HxcYjfJSn6w,1789
|
8
|
-
pandas_market_calendars/calendars/bmf.py,sha256=eyCFpG-ziuI862V5E41PFQw5cD3cOvmgnlAqcYuk9r4,5939
|
9
|
-
pandas_market_calendars/calendars/bse.py,sha256=mclRAAK5AvF9vyuIos1PexO0Z3d45ZolrPALVdcSoj0,16947
|
10
|
-
pandas_market_calendars/calendars/cboe.py,sha256=tRfq1hiOU2LpEAk-8OC5difM2qLjxNDDpkgobTQtcVI,3765
|
11
|
-
pandas_market_calendars/calendars/cme.py,sha256=YJH58ztmnKiyZZ7z2CK4pcvBLOQtflZcUFn1m3o5aLA,10450
|
12
|
-
pandas_market_calendars/calendars/cme_globex_agriculture.py,sha256=j1Dyg1Q_i3fh4452OeFa5Jw55FW0dhdjmPkmjP85KPc,4666
|
13
|
-
pandas_market_calendars/calendars/cme_globex_base.py,sha256=0mvilo9TY5O5EVHNQVNcI8TGycKM5-ymsIcZ4a-ANhU,3062
|
14
|
-
pandas_market_calendars/calendars/cme_globex_crypto.py,sha256=HbjTTN8pt2dGfgnE3LS0LIzJlaenYAzilvN9AMwkbfc,5463
|
15
|
-
pandas_market_calendars/calendars/cme_globex_energy_and_metals.py,sha256=lcd09CIfZMaZ-mXrI-6c7bqgPx8tj6-2yCOG-f2Hlu4,6620
|
16
|
-
pandas_market_calendars/calendars/cme_globex_equities.py,sha256=FMgBDPdamDAgcslQuf-BDUACCQDoYzV4lIbixNLOO-w,3639
|
17
|
-
pandas_market_calendars/calendars/cme_globex_fixed_income.py,sha256=egxw-OKUI-SPbNjsLquqPDWQIVX94-torkAuzW6a0aA,4287
|
18
|
-
pandas_market_calendars/calendars/cme_globex_fx.py,sha256=lZJpZvKWC9kGcHVjUSG69vH82VwiifLYt1rAlZsDVaM,3206
|
19
|
-
pandas_market_calendars/calendars/eurex.py,sha256=h9K0kvLggc50MKjGb61gfepuiyKovD2uPHCLBruvcBU,2677
|
20
|
-
pandas_market_calendars/calendars/eurex_fixed_income.py,sha256=irtSJvCRsn_N2AjjYe5jMvuxblgOx1BTQW2C34RGFlg,2132
|
21
|
-
pandas_market_calendars/calendars/hkex.py,sha256=dQj4roWPLxcxcMaYC9WBaFaHcqsXPdozTufF4ByZN-A,13996
|
22
|
-
pandas_market_calendars/calendars/ice.py,sha256=CnlbD3g7L6goukKZtSm-deuCdlB4ZcILTkYbol43TPQ,2159
|
23
|
-
pandas_market_calendars/calendars/iex.py,sha256=xBqnv_H4GZ0qceSv-yVmKRZRT3F-_UJhIFJBwM1FNO0,4383
|
24
|
-
pandas_market_calendars/calendars/jpx.py,sha256=uiAtxgXGZAzxM3lxGvVOoIwKvd4gsZTYupTIKoLzn0k,3819
|
25
|
-
pandas_market_calendars/calendars/lse.py,sha256=qltdB1TdQ3F8jqx4oykzy_cZvqHlHwnsrpRXzBsovVc,3114
|
26
|
-
pandas_market_calendars/calendars/mirror.py,sha256=Oq9jRXYpKmPv6PfoKDVVLyIG7hqcuFFC7fPLcCIhl7k,4555
|
27
|
-
pandas_market_calendars/calendars/nyse.py,sha256=7-Yfdi-2aSQbIJn8TozkXfK8XsQtVreA-ko0Dr2Wips,66181
|
28
|
-
pandas_market_calendars/calendars/ose.py,sha256=AfF11QxKYwozaaEc2PvuP3IPvVj5D70mIl0zyp5OogE,2938
|
29
|
-
pandas_market_calendars/calendars/sifma.py,sha256=RgOX1yhT8-b6w029ILkOhU-delPCeX6uNWoWDm1Z0eE,9960
|
30
|
-
pandas_market_calendars/calendars/six.py,sha256=RYShBBuHg6O5QrMnTmdboInh0Wy5bBNRC9dR-QH9PO8,2610
|
31
|
-
pandas_market_calendars/calendars/sse.py,sha256=o8YUElUPWcqcoMshHMF0mpIaa4GGF2GissrAP47_tbk,10907
|
32
|
-
pandas_market_calendars/calendars/tase.py,sha256=G0kb-JKgkzwqDLpvUiCgeAXPANETnp3h1U4Vm-9Kj9k,8671
|
33
|
-
pandas_market_calendars/calendars/tsx.py,sha256=3zQwdU9LkiJjZRF1fgLGHYYcJMC-443QITVS9hn4kOc,4014
|
34
|
-
pandas_market_calendars/holidays/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
35
|
-
pandas_market_calendars/holidays/cme.py,sha256=TrxR8xA6cgy0YcUfImaKI2QjRmqlwv6pW5KjMKsE1Rg,9089
|
36
|
-
pandas_market_calendars/holidays/cme_globex.py,sha256=0SPVGABO7K66eRitDsDgxRU52aPX8SRGgtUVyB_-LYk,5090
|
37
|
-
pandas_market_calendars/holidays/cn.py,sha256=-45lLLaGDJZnHMKhOf-RXuHAo7TDBDWdeQ0hRkeMovg,47467
|
38
|
-
pandas_market_calendars/holidays/jp.py,sha256=rqobVw837Uxb-4D1Zq_PyBLoeyhImYW7DBwyJupJIp8,9216
|
39
|
-
pandas_market_calendars/holidays/jpx_equinox.py,sha256=KWbJqWsnkdyzG3fD2gJTXRLQOF3YTWSn9O6sYRL9Dnk,8070
|
40
|
-
pandas_market_calendars/holidays/nyse.py,sha256=jwcz3Xp7NNL0rnwrQG8vuuBuXg7YTSBcg733nmFw-uM,39831
|
41
|
-
pandas_market_calendars/holidays/oz.py,sha256=P77pWe7ZQj4o-731w6fW_Vzmo41PRxh94QpclI3ZyFM,1042
|
42
|
-
pandas_market_calendars/holidays/sifma.py,sha256=gELES9-NeV3QNGE4JpsVfmcs1-jtYQrLxjnG4B-4RmM,8754
|
43
|
-
pandas_market_calendars/holidays/uk.py,sha256=dt5TNONlDMXPw8wjyyPBYNnLO5Yz6Mht8VrPUrNqy-M,4719
|
44
|
-
pandas_market_calendars/holidays/us.py,sha256=OBBMMKTRzghD-b9CmPRe5zBh7zQYjWl4-9SogT6ZnBo,11515
|
45
|
-
pandas_market_calendars-4.6.1.dist-info/LICENSE,sha256=qW51_A-I7YutlB-s8VSKeOP-aL83T-Lb8LqqU1x1ilw,1065
|
46
|
-
pandas_market_calendars-4.6.1.dist-info/METADATA,sha256=4xcQyj-mUDdl65hv9fmfGcs-dCBvoutznUFV2X-5jDc,9477
|
47
|
-
pandas_market_calendars-4.6.1.dist-info/NOTICE,sha256=mmH7c9aF5FsELh1OHXloXw1TajLD_mWDKO4dsVf43_E,11693
|
48
|
-
pandas_market_calendars-4.6.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
49
|
-
pandas_market_calendars-4.6.1.dist-info/top_level.txt,sha256=_4cUEFr07SuEAzZMT-5p0lJGXxO9imVbEK9_5oqcopQ,24
|
50
|
-
pandas_market_calendars-4.6.1.dist-info/RECORD,,
|
{pandas_market_calendars-4.6.1.dist-info → pandas_market_calendars-5.1.0.dist-info/licenses}/LICENSE
RENAMED
File without changes
|
{pandas_market_calendars-4.6.1.dist-info → pandas_market_calendars-5.1.0.dist-info/licenses}/NOTICE
RENAMED
File without changes
|
{pandas_market_calendars-4.6.1.dist-info → pandas_market_calendars-5.1.0.dist-info}/top_level.txt
RENAMED
File without changes
|