pandas-market-calendars 4.4.2__py3-none-any.whl → 4.5.1__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/__init__.py +38 -38
- pandas_market_calendars/calendar_registry.py +57 -57
- pandas_market_calendars/calendar_utils.py +262 -262
- pandas_market_calendars/calendars/asx.py +66 -66
- pandas_market_calendars/calendars/bmf.py +223 -223
- pandas_market_calendars/calendars/bse.py +421 -421
- pandas_market_calendars/calendars/cboe.py +145 -145
- pandas_market_calendars/calendars/cme.py +405 -405
- pandas_market_calendars/calendars/cme_globex_agriculture.py +172 -172
- pandas_market_calendars/calendars/cme_globex_base.py +119 -119
- pandas_market_calendars/calendars/cme_globex_crypto.py +160 -160
- pandas_market_calendars/calendars/cme_globex_energy_and_metals.py +216 -216
- pandas_market_calendars/calendars/cme_globex_equities.py +123 -123
- pandas_market_calendars/calendars/cme_globex_fixed_income.py +136 -136
- pandas_market_calendars/calendars/cme_globex_fx.py +101 -101
- pandas_market_calendars/calendars/eurex.py +131 -131
- pandas_market_calendars/calendars/eurex_fixed_income.py +98 -98
- pandas_market_calendars/calendars/hkex.py +429 -429
- pandas_market_calendars/calendars/ice.py +81 -81
- pandas_market_calendars/calendars/iex.py +112 -112
- pandas_market_calendars/calendars/lse.py +114 -114
- pandas_market_calendars/calendars/mirror.py +149 -149
- pandas_market_calendars/calendars/nyse.py +3 -0
- pandas_market_calendars/calendars/ose.py +116 -116
- pandas_market_calendars/calendars/sifma.py +354 -354
- pandas_market_calendars/calendars/six.py +132 -132
- pandas_market_calendars/calendars/sse.py +1 -1
- pandas_market_calendars/calendars/tase.py +197 -197
- pandas_market_calendars/calendars/tsx.py +181 -181
- pandas_market_calendars/holidays/cme.py +385 -385
- pandas_market_calendars/holidays/cme_globex.py +214 -214
- pandas_market_calendars/holidays/cn.py +20 -0
- pandas_market_calendars/holidays/jp.py +401 -401
- pandas_market_calendars/holidays/jpx_equinox.py +506 -506
- pandas_market_calendars/holidays/nyse.py +5 -0
- pandas_market_calendars/holidays/oz.py +63 -63
- pandas_market_calendars/holidays/sifma.py +350 -350
- pandas_market_calendars/holidays/us.py +376 -376
- pandas_market_calendars/market_calendar.py +20 -1
- {pandas_market_calendars-4.4.2.dist-info → pandas_market_calendars-4.5.1.dist-info}/METADATA +1 -1
- pandas_market_calendars-4.5.1.dist-info/RECORD +50 -0
- {pandas_market_calendars-4.4.2.dist-info → pandas_market_calendars-4.5.1.dist-info}/WHEEL +1 -1
- pandas_market_calendars-4.4.2.dist-info/RECORD +0 -50
- {pandas_market_calendars-4.4.2.dist-info → pandas_market_calendars-4.5.1.dist-info}/LICENSE +0 -0
- {pandas_market_calendars-4.4.2.dist-info → pandas_market_calendars-4.5.1.dist-info}/NOTICE +0 -0
- {pandas_market_calendars-4.4.2.dist-info → pandas_market_calendars-4.5.1.dist-info}/top_level.txt +0 -0
@@ -1,81 +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
|
-
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
|
+
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,112 +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
|
-
# 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
|
+
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,114 +1,114 @@
|
|
1
|
-
#
|
2
|
-
# Copyright 2016 Quantopian, Inc.
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
|
16
|
-
from datetime import time
|
17
|
-
|
18
|
-
from pandas.tseries.holiday import AbstractHolidayCalendar, EasterMonday, GoodFriday
|
19
|
-
from pytz import timezone
|
20
|
-
|
21
|
-
from pandas_market_calendars.holidays.uk import (
|
22
|
-
BoxingDay,
|
23
|
-
Christmas,
|
24
|
-
ChristmasEve,
|
25
|
-
LSENewYearsDay,
|
26
|
-
LSENewYearsEve,
|
27
|
-
MayBank_pre_1995,
|
28
|
-
MayBank_post_1995_pre_2020,
|
29
|
-
MayBank_post_2020,
|
30
|
-
SpringBank_pre_2002,
|
31
|
-
SpringBank_post_2002_pre_2012,
|
32
|
-
SpringBank_post_2012_pre_2022,
|
33
|
-
SpringBank_post_2022,
|
34
|
-
SummerBank,
|
35
|
-
WeekendBoxingDay,
|
36
|
-
WeekendChristmas,
|
37
|
-
UniqueCloses,
|
38
|
-
)
|
39
|
-
from pandas_market_calendars.market_calendar import MarketCalendar
|
40
|
-
|
41
|
-
|
42
|
-
class LSEExchangeCalendar(MarketCalendar):
|
43
|
-
"""
|
44
|
-
Exchange calendar for the London Stock Exchange
|
45
|
-
|
46
|
-
Open Time: 8:00 AM, GMT
|
47
|
-
Close Time: 4:30 PM, GMT
|
48
|
-
|
49
|
-
Regularly-Observed Holidays:
|
50
|
-
- New Years Day (observed on first business day on/after)
|
51
|
-
- Good Friday
|
52
|
-
- Easter Monday
|
53
|
-
- Early May Bank Holiday (first Monday in May)
|
54
|
-
- Spring Bank Holiday (last Monday in May)
|
55
|
-
- Summer Bank Holiday (last Monday in August)
|
56
|
-
- Christmas Day
|
57
|
-
- Dec. 27th (if Christmas is on a weekend)
|
58
|
-
- Boxing Day
|
59
|
-
- Dec. 28th (if Boxing Day is on a weekend)
|
60
|
-
"""
|
61
|
-
|
62
|
-
aliases = ["LSE"]
|
63
|
-
regular_market_times = {
|
64
|
-
"market_open": ((None, time(8)),),
|
65
|
-
"market_close": ((None, time(16, 30)),),
|
66
|
-
}
|
67
|
-
|
68
|
-
@property
|
69
|
-
def name(self):
|
70
|
-
return "LSE"
|
71
|
-
|
72
|
-
@property
|
73
|
-
def tz(self):
|
74
|
-
return timezone("Europe/London")
|
75
|
-
|
76
|
-
@property
|
77
|
-
def regular_holidays(self):
|
78
|
-
return AbstractHolidayCalendar(
|
79
|
-
rules=[
|
80
|
-
LSENewYearsDay,
|
81
|
-
GoodFriday,
|
82
|
-
EasterMonday,
|
83
|
-
MayBank_pre_1995,
|
84
|
-
MayBank_post_1995_pre_2020,
|
85
|
-
MayBank_post_2020,
|
86
|
-
SpringBank_pre_2002,
|
87
|
-
SpringBank_post_2002_pre_2012,
|
88
|
-
SpringBank_post_2012_pre_2022,
|
89
|
-
SpringBank_post_2022,
|
90
|
-
SummerBank,
|
91
|
-
Christmas,
|
92
|
-
WeekendChristmas,
|
93
|
-
BoxingDay,
|
94
|
-
WeekendBoxingDay,
|
95
|
-
]
|
96
|
-
)
|
97
|
-
|
98
|
-
@property
|
99
|
-
def adhoc_holidays(self):
|
100
|
-
return UniqueCloses
|
101
|
-
|
102
|
-
@property
|
103
|
-
def special_closes(self):
|
104
|
-
return [
|
105
|
-
(
|
106
|
-
time(12, 30),
|
107
|
-
AbstractHolidayCalendar(
|
108
|
-
rules=[
|
109
|
-
ChristmasEve,
|
110
|
-
LSENewYearsEve,
|
111
|
-
]
|
112
|
-
),
|
113
|
-
)
|
114
|
-
]
|
1
|
+
#
|
2
|
+
# Copyright 2016 Quantopian, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
from datetime import time
|
17
|
+
|
18
|
+
from pandas.tseries.holiday import AbstractHolidayCalendar, EasterMonday, GoodFriday
|
19
|
+
from pytz import timezone
|
20
|
+
|
21
|
+
from pandas_market_calendars.holidays.uk import (
|
22
|
+
BoxingDay,
|
23
|
+
Christmas,
|
24
|
+
ChristmasEve,
|
25
|
+
LSENewYearsDay,
|
26
|
+
LSENewYearsEve,
|
27
|
+
MayBank_pre_1995,
|
28
|
+
MayBank_post_1995_pre_2020,
|
29
|
+
MayBank_post_2020,
|
30
|
+
SpringBank_pre_2002,
|
31
|
+
SpringBank_post_2002_pre_2012,
|
32
|
+
SpringBank_post_2012_pre_2022,
|
33
|
+
SpringBank_post_2022,
|
34
|
+
SummerBank,
|
35
|
+
WeekendBoxingDay,
|
36
|
+
WeekendChristmas,
|
37
|
+
UniqueCloses,
|
38
|
+
)
|
39
|
+
from pandas_market_calendars.market_calendar import MarketCalendar
|
40
|
+
|
41
|
+
|
42
|
+
class LSEExchangeCalendar(MarketCalendar):
|
43
|
+
"""
|
44
|
+
Exchange calendar for the London Stock Exchange
|
45
|
+
|
46
|
+
Open Time: 8:00 AM, GMT
|
47
|
+
Close Time: 4:30 PM, GMT
|
48
|
+
|
49
|
+
Regularly-Observed Holidays:
|
50
|
+
- New Years Day (observed on first business day on/after)
|
51
|
+
- Good Friday
|
52
|
+
- Easter Monday
|
53
|
+
- Early May Bank Holiday (first Monday in May)
|
54
|
+
- Spring Bank Holiday (last Monday in May)
|
55
|
+
- Summer Bank Holiday (last Monday in August)
|
56
|
+
- Christmas Day
|
57
|
+
- Dec. 27th (if Christmas is on a weekend)
|
58
|
+
- Boxing Day
|
59
|
+
- Dec. 28th (if Boxing Day is on a weekend)
|
60
|
+
"""
|
61
|
+
|
62
|
+
aliases = ["LSE"]
|
63
|
+
regular_market_times = {
|
64
|
+
"market_open": ((None, time(8)),),
|
65
|
+
"market_close": ((None, time(16, 30)),),
|
66
|
+
}
|
67
|
+
|
68
|
+
@property
|
69
|
+
def name(self):
|
70
|
+
return "LSE"
|
71
|
+
|
72
|
+
@property
|
73
|
+
def tz(self):
|
74
|
+
return timezone("Europe/London")
|
75
|
+
|
76
|
+
@property
|
77
|
+
def regular_holidays(self):
|
78
|
+
return AbstractHolidayCalendar(
|
79
|
+
rules=[
|
80
|
+
LSENewYearsDay,
|
81
|
+
GoodFriday,
|
82
|
+
EasterMonday,
|
83
|
+
MayBank_pre_1995,
|
84
|
+
MayBank_post_1995_pre_2020,
|
85
|
+
MayBank_post_2020,
|
86
|
+
SpringBank_pre_2002,
|
87
|
+
SpringBank_post_2002_pre_2012,
|
88
|
+
SpringBank_post_2012_pre_2022,
|
89
|
+
SpringBank_post_2022,
|
90
|
+
SummerBank,
|
91
|
+
Christmas,
|
92
|
+
WeekendChristmas,
|
93
|
+
BoxingDay,
|
94
|
+
WeekendBoxingDay,
|
95
|
+
]
|
96
|
+
)
|
97
|
+
|
98
|
+
@property
|
99
|
+
def adhoc_holidays(self):
|
100
|
+
return UniqueCloses
|
101
|
+
|
102
|
+
@property
|
103
|
+
def special_closes(self):
|
104
|
+
return [
|
105
|
+
(
|
106
|
+
time(12, 30),
|
107
|
+
AbstractHolidayCalendar(
|
108
|
+
rules=[
|
109
|
+
ChristmasEve,
|
110
|
+
LSENewYearsEve,
|
111
|
+
]
|
112
|
+
),
|
113
|
+
)
|
114
|
+
]
|