pandas-market-calendars 4.3.1__py3-none-any.whl → 4.3.3__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- pandas_market_calendars/__init__.py +38 -37
- pandas_market_calendars/calendar_registry.py +53 -48
- pandas_market_calendars/calendar_utils.py +261 -225
- pandas_market_calendars/calendars/asx.py +66 -63
- pandas_market_calendars/calendars/bmf.py +206 -227
- pandas_market_calendars/calendars/bse.py +407 -409
- pandas_market_calendars/calendars/cboe.py +145 -115
- pandas_market_calendars/calendars/cme.py +402 -240
- pandas_market_calendars/calendars/cme_globex_agriculture.py +126 -103
- pandas_market_calendars/calendars/cme_globex_base.py +119 -103
- pandas_market_calendars/calendars/cme_globex_crypto.py +160 -147
- pandas_market_calendars/calendars/cme_globex_energy_and_metals.py +216 -138
- pandas_market_calendars/calendars/cme_globex_equities.py +123 -104
- pandas_market_calendars/calendars/cme_globex_fixed_income.py +136 -113
- pandas_market_calendars/calendars/cme_globex_fx.py +101 -78
- pandas_market_calendars/calendars/eurex.py +139 -119
- pandas_market_calendars/calendars/eurex_fixed_income.py +98 -0
- pandas_market_calendars/calendars/hkex.py +426 -408
- pandas_market_calendars/calendars/ice.py +81 -65
- pandas_market_calendars/calendars/iex.py +112 -98
- pandas_market_calendars/calendars/jpx.py +109 -103
- pandas_market_calendars/calendars/lse.py +114 -91
- pandas_market_calendars/calendars/mirror.py +130 -114
- pandas_market_calendars/calendars/nyse.py +1324 -1127
- pandas_market_calendars/calendars/ose.py +116 -150
- pandas_market_calendars/calendars/sifma.py +350 -297
- pandas_market_calendars/calendars/six.py +132 -114
- pandas_market_calendars/calendars/sse.py +311 -290
- pandas_market_calendars/calendars/tase.py +197 -195
- pandas_market_calendars/calendars/tsx.py +181 -159
- pandas_market_calendars/class_registry.py +22 -16
- pandas_market_calendars/holidays/cme.py +385 -340
- pandas_market_calendars/holidays/cme_globex.py +214 -198
- pandas_market_calendars/holidays/cn.py +1455 -1436
- pandas_market_calendars/holidays/jp.py +398 -396
- pandas_market_calendars/holidays/jpx_equinox.py +453 -95
- pandas_market_calendars/holidays/nyse.py +1531 -1472
- pandas_market_calendars/holidays/oz.py +63 -65
- pandas_market_calendars/holidays/sifma.py +338 -321
- pandas_market_calendars/holidays/uk.py +32 -26
- pandas_market_calendars/holidays/us.py +376 -360
- pandas_market_calendars/market_calendar.py +895 -789
- {pandas_market_calendars-4.3.1.dist-info → pandas_market_calendars-4.3.3.dist-info}/METADATA +7 -5
- pandas_market_calendars-4.3.3.dist-info/RECORD +50 -0
- {pandas_market_calendars-4.3.1.dist-info → pandas_market_calendars-4.3.3.dist-info}/WHEEL +1 -1
- pandas_market_calendars-4.3.1.dist-info/RECORD +0 -49
- {pandas_market_calendars-4.3.1.dist-info → pandas_market_calendars-4.3.3.dist-info}/LICENSE +0 -0
- {pandas_market_calendars-4.3.1.dist-info → pandas_market_calendars-4.3.3.dist-info}/NOTICE +0 -0
- {pandas_market_calendars-4.3.1.dist-info → pandas_market_calendars-4.3.3.dist-info}/top_level.txt +0 -0
@@ -1,65 +1,81 @@
|
|
1
|
-
from datetime import time
|
2
|
-
from itertools import chain
|
3
|
-
|
4
|
-
from pandas import Timestamp
|
5
|
-
from pandas.tseries.holiday import
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
@property
|
50
|
-
def
|
51
|
-
return
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
]
|
1
|
+
from datetime import time
|
2
|
+
from itertools import chain
|
3
|
+
|
4
|
+
from pandas import Timestamp
|
5
|
+
from pandas.tseries.holiday import (
|
6
|
+
AbstractHolidayCalendar,
|
7
|
+
GoodFriday,
|
8
|
+
USLaborDay,
|
9
|
+
USPresidentsDay,
|
10
|
+
USThanksgivingDay,
|
11
|
+
)
|
12
|
+
from pytz import timezone
|
13
|
+
|
14
|
+
from pandas_market_calendars.holidays.us import (
|
15
|
+
Christmas,
|
16
|
+
USIndependenceDay,
|
17
|
+
USMartinLutherKingJrAfter1998,
|
18
|
+
USMemorialDay,
|
19
|
+
USNationalDaysofMourning,
|
20
|
+
USNewYearsDay,
|
21
|
+
)
|
22
|
+
from pandas_market_calendars.market_calendar import MarketCalendar
|
23
|
+
|
24
|
+
|
25
|
+
class ICEExchangeCalendar(MarketCalendar):
|
26
|
+
"""
|
27
|
+
Exchange calendar for ICE US.
|
28
|
+
|
29
|
+
Open Time: 8pm, US/Eastern
|
30
|
+
Close Time: 6pm, US/Eastern
|
31
|
+
|
32
|
+
https://www.theice.com/publicdocs/futures_us/ICE_Futures_US_Regular_Trading_Hours.pdf # noqa
|
33
|
+
"""
|
34
|
+
|
35
|
+
aliases = ["ICE", "ICEUS", "NYFE"]
|
36
|
+
regular_market_times = {
|
37
|
+
"market_open": ((None, time(20, 1), -1),), # offset by -1 day
|
38
|
+
"market_close": ((None, time(18)),),
|
39
|
+
}
|
40
|
+
|
41
|
+
@property
|
42
|
+
def name(self):
|
43
|
+
return "ICE"
|
44
|
+
|
45
|
+
@property
|
46
|
+
def tz(self):
|
47
|
+
return timezone("US/Eastern")
|
48
|
+
|
49
|
+
@property
|
50
|
+
def special_closes(self):
|
51
|
+
return [
|
52
|
+
(
|
53
|
+
time(13),
|
54
|
+
AbstractHolidayCalendar(
|
55
|
+
rules=[
|
56
|
+
USMartinLutherKingJrAfter1998,
|
57
|
+
USPresidentsDay,
|
58
|
+
USMemorialDay,
|
59
|
+
USIndependenceDay,
|
60
|
+
USLaborDay,
|
61
|
+
USThanksgivingDay,
|
62
|
+
]
|
63
|
+
),
|
64
|
+
)
|
65
|
+
]
|
66
|
+
|
67
|
+
@property
|
68
|
+
def adhoc_holidays(self):
|
69
|
+
return list(
|
70
|
+
chain(
|
71
|
+
USNationalDaysofMourning,
|
72
|
+
# ICE was only closed on the first day of the Hurricane Sandy
|
73
|
+
# closings (was not closed on 2012-10-30)
|
74
|
+
[Timestamp("2012-10-29", tz="UTC")],
|
75
|
+
)
|
76
|
+
)
|
77
|
+
|
78
|
+
@property
|
79
|
+
def regular_holidays(self):
|
80
|
+
# https://www.theice.com/publicdocs/futures_us/exchange_notices/NewExNot2016Holidays.pdf # noqa
|
81
|
+
return AbstractHolidayCalendar(rules=[USNewYearsDay, GoodFriday, Christmas])
|
@@ -1,98 +1,112 @@
|
|
1
|
-
from datetime import time
|
2
|
-
from itertools import chain
|
3
|
-
|
4
|
-
from pandas.tseries.holiday import AbstractHolidayCalendar
|
5
|
-
from pytz import timezone
|
6
|
-
|
7
|
-
from pandas_market_calendars.holidays.nyse import (
|
8
|
-
USPresidentsDay,
|
9
|
-
GoodFriday,
|
10
|
-
USMemorialDay,
|
11
|
-
USJuneteenthAfter2022,
|
12
|
-
USIndependenceDay,
|
13
|
-
USThanksgivingDay,
|
14
|
-
ChristmasNYSE,
|
15
|
-
USMartinLutherKingJrAfter1998,
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
- https://
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
"
|
42
|
-
"
|
43
|
-
"
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
def
|
97
|
-
|
98
|
-
|
1
|
+
from datetime import time
|
2
|
+
from itertools import chain
|
3
|
+
|
4
|
+
from pandas.tseries.holiday import AbstractHolidayCalendar
|
5
|
+
from pytz import timezone
|
6
|
+
|
7
|
+
from pandas_market_calendars.holidays.nyse import (
|
8
|
+
USPresidentsDay,
|
9
|
+
GoodFriday,
|
10
|
+
USMemorialDay,
|
11
|
+
USJuneteenthAfter2022,
|
12
|
+
USIndependenceDay,
|
13
|
+
USThanksgivingDay,
|
14
|
+
ChristmasNYSE,
|
15
|
+
USMartinLutherKingJrAfter1998,
|
16
|
+
# Ad-Hoc
|
17
|
+
DayAfterThanksgiving1pmEarlyCloseInOrAfter1993,
|
18
|
+
DaysBeforeIndependenceDay1pmEarlyCloseAdhoc,
|
19
|
+
ChristmasEvesAdhoc,
|
20
|
+
)
|
21
|
+
from .nyse import NYSEExchangeCalendar
|
22
|
+
|
23
|
+
|
24
|
+
class IEXExchangeCalendar(NYSEExchangeCalendar):
|
25
|
+
"""
|
26
|
+
Exchange calendar for the Investor's Exchange (IEX).
|
27
|
+
|
28
|
+
IEX Exchange is a U.S. stock exchange focused on driving performance
|
29
|
+
for broker-dealers and investors through innovative design and technology.
|
30
|
+
|
31
|
+
Most of this class inherits from NYSEExchangeCalendar since
|
32
|
+
the holidays are the same. The only variation is (1) IEX began
|
33
|
+
operation in 2013, and (2) IEX has different hours of operation
|
34
|
+
|
35
|
+
References:
|
36
|
+
- https://exchange.iex.io/
|
37
|
+
- https://iexexchange.io/resources/trading/trading-hours-holidays/index.html
|
38
|
+
"""
|
39
|
+
|
40
|
+
regular_market_times = {
|
41
|
+
"pre": (("2013-03-25", time(8)),),
|
42
|
+
"market_open": ((None, time(9, 30)),),
|
43
|
+
"market_close": ((None, time(16)),),
|
44
|
+
"post": ((None, time(17)),),
|
45
|
+
}
|
46
|
+
|
47
|
+
aliases = ["IEX", "Investors_Exchange"]
|
48
|
+
|
49
|
+
@property
|
50
|
+
def name(self):
|
51
|
+
return "IEX"
|
52
|
+
|
53
|
+
@property
|
54
|
+
def weekmask(self):
|
55
|
+
return "Mon Tue Wed Thu Fri"
|
56
|
+
|
57
|
+
@property
|
58
|
+
def regular_holidays(self):
|
59
|
+
return AbstractHolidayCalendar(
|
60
|
+
rules=[
|
61
|
+
USPresidentsDay,
|
62
|
+
GoodFriday,
|
63
|
+
USMemorialDay,
|
64
|
+
USJuneteenthAfter2022,
|
65
|
+
USIndependenceDay,
|
66
|
+
USThanksgivingDay,
|
67
|
+
ChristmasNYSE,
|
68
|
+
USMartinLutherKingJrAfter1998,
|
69
|
+
]
|
70
|
+
)
|
71
|
+
|
72
|
+
@property
|
73
|
+
def adhoc_holidays(self):
|
74
|
+
return list(
|
75
|
+
chain(
|
76
|
+
ChristmasEvesAdhoc,
|
77
|
+
)
|
78
|
+
)
|
79
|
+
|
80
|
+
@property
|
81
|
+
def special_closes(self):
|
82
|
+
return [
|
83
|
+
(
|
84
|
+
time(hour=13, tzinfo=timezone("America/New_York")),
|
85
|
+
AbstractHolidayCalendar(
|
86
|
+
rules=[
|
87
|
+
DayAfterThanksgiving1pmEarlyCloseInOrAfter1993,
|
88
|
+
]
|
89
|
+
),
|
90
|
+
)
|
91
|
+
]
|
92
|
+
|
93
|
+
"""Override NYSE calendar special cases"""
|
94
|
+
|
95
|
+
@property
|
96
|
+
def special_closes_adhoc(self):
|
97
|
+
return [
|
98
|
+
(
|
99
|
+
time(13, tzinfo=timezone("America/New_York")),
|
100
|
+
DaysBeforeIndependenceDay1pmEarlyCloseAdhoc,
|
101
|
+
)
|
102
|
+
]
|
103
|
+
|
104
|
+
@property
|
105
|
+
def special_opens(self):
|
106
|
+
return []
|
107
|
+
|
108
|
+
def valid_days(self, start_date, end_date, tz="UTC"):
|
109
|
+
trading_days = super().valid_days(
|
110
|
+
start_date, end_date, tz=tz
|
111
|
+
) # all NYSE valid days
|
112
|
+
return trading_days[~(trading_days <= "2013-08-25")]
|
@@ -1,103 +1,109 @@
|
|
1
|
-
from datetime import time
|
2
|
-
from itertools import chain
|
3
|
-
|
4
|
-
from pandas.tseries.holiday import AbstractHolidayCalendar
|
5
|
-
from pytz import timezone
|
6
|
-
|
7
|
-
from pandas_market_calendars.holidays.jp import *
|
8
|
-
from pandas_market_calendars.holidays.us import USNewYearsDay
|
9
|
-
from pandas_market_calendars.market_calendar import MarketCalendar
|
10
|
-
|
11
|
-
|
12
|
-
# TODO:
|
13
|
-
# From 1949 to 1972 the TSE was open on all non-holiday Saturdays for a half day
|
14
|
-
# From 1973 to 1984 the TSE was open on all non-holiday Saturdays except the third Saturday of the month
|
15
|
-
# need to add support for weekmask to make this work properly
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
"
|
30
|
-
"
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
1
|
+
from datetime import time
|
2
|
+
from itertools import chain
|
3
|
+
|
4
|
+
from pandas.tseries.holiday import AbstractHolidayCalendar
|
5
|
+
from pytz import timezone
|
6
|
+
|
7
|
+
from pandas_market_calendars.holidays.jp import *
|
8
|
+
from pandas_market_calendars.holidays.us import USNewYearsDay
|
9
|
+
from pandas_market_calendars.market_calendar import MarketCalendar
|
10
|
+
|
11
|
+
|
12
|
+
# TODO:
|
13
|
+
# From 1949 to 1972 the TSE was open on all non-holiday Saturdays for a half day
|
14
|
+
# From 1973 to 1984 the TSE was open on all non-holiday Saturdays except the third Saturday of the month
|
15
|
+
# need to add support for weekmask to make this work properly
|
16
|
+
|
17
|
+
|
18
|
+
class JPXExchangeCalendar(MarketCalendar):
|
19
|
+
"""
|
20
|
+
Exchange calendar for JPX
|
21
|
+
|
22
|
+
Open Time: 9:31 AM, Asia/Tokyo
|
23
|
+
LUNCH BREAK :facepalm: : 11:30 AM - 12:30 PM Asia/Tokyo
|
24
|
+
Close Time: 4:00 PM, Asia/Tokyo
|
25
|
+
"""
|
26
|
+
|
27
|
+
aliases = ["JPX", "XJPX"]
|
28
|
+
regular_market_times = {
|
29
|
+
"market_open": ((None, time(9)),),
|
30
|
+
"market_close": ((None, time(15)),),
|
31
|
+
"break_start": ((None, time(11, 30)),),
|
32
|
+
"break_end": ((None, time(12, 30)),),
|
33
|
+
}
|
34
|
+
regular_early_close = time(13)
|
35
|
+
|
36
|
+
@property
|
37
|
+
def name(self):
|
38
|
+
return "JPX"
|
39
|
+
|
40
|
+
@property
|
41
|
+
def tz(self):
|
42
|
+
return timezone("Asia/Tokyo")
|
43
|
+
|
44
|
+
@property
|
45
|
+
def adhoc_holidays(self):
|
46
|
+
return list(
|
47
|
+
chain(
|
48
|
+
AscensionDays,
|
49
|
+
MarriageDays,
|
50
|
+
FuneralShowa,
|
51
|
+
EnthronementDays,
|
52
|
+
AutumnalCitizenDates,
|
53
|
+
NoN225IndexPrices,
|
54
|
+
EquityTradingSystemFailure,
|
55
|
+
)
|
56
|
+
)
|
57
|
+
|
58
|
+
@property
|
59
|
+
def regular_holidays(self):
|
60
|
+
return AbstractHolidayCalendar(
|
61
|
+
rules=[
|
62
|
+
USNewYearsDay,
|
63
|
+
JapanNewYearsDay2,
|
64
|
+
JapanNewYearsDay3,
|
65
|
+
JapanComingOfAgeDay1951To1973,
|
66
|
+
JapanComingOfAgeDay1974To1999,
|
67
|
+
JapanComingOfAgeDay,
|
68
|
+
JapanNationalFoundationDay1969To1973,
|
69
|
+
JapanNationalFoundationDay,
|
70
|
+
JapanEmperorsBirthday,
|
71
|
+
JapanVernalEquinox,
|
72
|
+
JapanShowaDayUntil1972,
|
73
|
+
JapanShowaDay,
|
74
|
+
JapanConstitutionMemorialDayUntil1972,
|
75
|
+
JapanConstitutionMemorialDay,
|
76
|
+
JapanGreeneryDay,
|
77
|
+
JapanChildrensDayUntil1972,
|
78
|
+
JapanChildrensDay,
|
79
|
+
JapanGoldenWeekBonusDay,
|
80
|
+
JapanMarineDay1996To2002,
|
81
|
+
JapanMarineDay2003To2019,
|
82
|
+
JapanMarineDay2020,
|
83
|
+
JapanMarineDay2021,
|
84
|
+
JapanMarineDay,
|
85
|
+
JapanMountainDay2016to2019,
|
86
|
+
JapanMountainDay2020,
|
87
|
+
JapanMountainDay2021,
|
88
|
+
JapanMountainDay2021NextDay,
|
89
|
+
JapanMountainDay,
|
90
|
+
JapanRespectForTheAgedDay1966To1972,
|
91
|
+
JapanRespectForTheAgedDay1973To2002,
|
92
|
+
JapanRespectForTheAgedDay,
|
93
|
+
JapanAutumnalEquinox,
|
94
|
+
JapanHealthAndSportsDay1966To1972,
|
95
|
+
JapanHealthAndSportsDay1973To1999,
|
96
|
+
JapanHealthAndSportsDay2000To2019,
|
97
|
+
JapanSportsDay2020,
|
98
|
+
JapanSportsDay2021,
|
99
|
+
JapanSportsDay,
|
100
|
+
JapanCultureDayUntil1972,
|
101
|
+
JapanCultureDay,
|
102
|
+
JapanLaborThanksgivingDayUntil1972,
|
103
|
+
JapanLaborThanksgivingDay,
|
104
|
+
JapanEmperorAkahitosBirthday,
|
105
|
+
JapanDecember29Until1988,
|
106
|
+
JapanDecember30Until1988,
|
107
|
+
JapanBeforeNewYearsDay,
|
108
|
+
]
|
109
|
+
)
|