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,147 +1,160 @@
|
|
1
|
-
import datetime as dt
|
2
|
-
|
3
|
-
|
4
|
-
import
|
5
|
-
|
6
|
-
from .
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
GoodFridayBefore2021,
|
11
|
-
USIndependenceDayBefore2022PreviousDay,
|
12
|
-
)
|
13
|
-
from pandas_market_calendars.holidays.cme_globex import (
|
14
|
-
ChristmasCME,
|
15
|
-
USMartinLutherKingJrFrom2022,
|
16
|
-
USMartinLutherKingJrPre2022,
|
17
|
-
USPresidentsDayFrom2022,
|
18
|
-
USPresidentsDayPre2022,
|
19
|
-
USMemorialDayFrom2022,
|
20
|
-
USMemorialDayPre2022,
|
21
|
-
USJuneteenthFrom2022,
|
22
|
-
USIndependenceDayFrom2022,
|
23
|
-
USIndependenceDayPre2022,
|
24
|
-
USLaborDayFrom2022,
|
25
|
-
USLaborDayPre2022,
|
26
|
-
USThanksgivingDayFrom2022,
|
27
|
-
USThanksgivingDayPre2022,
|
28
|
-
USThanksgivingFridayFrom2021,
|
29
|
-
USThanksgivingFridayPre2021,
|
30
|
-
)
|
31
|
-
from pandas_market_calendars.holidays.us import (
|
32
|
-
ChristmasEveInOrAfter1993,
|
33
|
-
USNewYearsDay,
|
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
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
]
|
116
|
-
),
|
117
|
-
),
|
118
|
-
(
|
119
|
-
dt.time(12,
|
120
|
-
AbstractHolidayCalendar(
|
121
|
-
rules=[
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
1
|
+
import datetime as dt
|
2
|
+
|
3
|
+
import pytz
|
4
|
+
from pandas.tseries.holiday import AbstractHolidayCalendar
|
5
|
+
|
6
|
+
from pandas_market_calendars.holidays.cme import (
|
7
|
+
GoodFriday2021,
|
8
|
+
GoodFriday2022,
|
9
|
+
GoodFridayAfter2022,
|
10
|
+
GoodFridayBefore2021,
|
11
|
+
USIndependenceDayBefore2022PreviousDay,
|
12
|
+
)
|
13
|
+
from pandas_market_calendars.holidays.cme_globex import (
|
14
|
+
ChristmasCME,
|
15
|
+
USMartinLutherKingJrFrom2022,
|
16
|
+
USMartinLutherKingJrPre2022,
|
17
|
+
USPresidentsDayFrom2022,
|
18
|
+
USPresidentsDayPre2022,
|
19
|
+
USMemorialDayFrom2022,
|
20
|
+
USMemorialDayPre2022,
|
21
|
+
USJuneteenthFrom2022,
|
22
|
+
USIndependenceDayFrom2022,
|
23
|
+
USIndependenceDayPre2022,
|
24
|
+
USLaborDayFrom2022,
|
25
|
+
USLaborDayPre2022,
|
26
|
+
USThanksgivingDayFrom2022,
|
27
|
+
USThanksgivingDayPre2022,
|
28
|
+
USThanksgivingFridayFrom2021,
|
29
|
+
USThanksgivingFridayPre2021,
|
30
|
+
)
|
31
|
+
from pandas_market_calendars.holidays.us import (
|
32
|
+
ChristmasEveInOrAfter1993,
|
33
|
+
USNewYearsDay,
|
34
|
+
)
|
35
|
+
from .cme_globex_base import CMEGlobexBaseExchangeCalendar
|
36
|
+
|
37
|
+
|
38
|
+
# https://github.com/rsheftel/pandas_market_calendars/blob/master/docs/new_market.rst
|
39
|
+
class CMEGlobexCryptoExchangeCalendar(CMEGlobexBaseExchangeCalendar):
|
40
|
+
# The label you fetch the exchange with in mcal.get_calendar('CME Globex ...')
|
41
|
+
aliases = ["CME Globex Cryptocurrencies", "CME Globex Crypto"]
|
42
|
+
|
43
|
+
# https://www.cmegroup.com/markets/cryptocurrencies/bitcoin/bitcoin.contractSpecs.html
|
44
|
+
regular_market_times = {
|
45
|
+
# Tuple[Tuple[first date used, time, offset], ...]
|
46
|
+
# -1 offset indicates that the open is on the previous day
|
47
|
+
# None for first date used marks the start, subsequent market times must have an actual timestamp
|
48
|
+
"market_open": (
|
49
|
+
(None, dt.time(17, tzinfo=pytz.timezone("America/Chicago")), -1),
|
50
|
+
),
|
51
|
+
"market_close": (
|
52
|
+
(
|
53
|
+
None,
|
54
|
+
dt.time(16, tzinfo=pytz.timezone("America/Chicago")),
|
55
|
+
),
|
56
|
+
),
|
57
|
+
"break_start": (
|
58
|
+
(
|
59
|
+
None,
|
60
|
+
dt.time(16, tzinfo=pytz.timezone("America/Chicago")),
|
61
|
+
),
|
62
|
+
),
|
63
|
+
"break_end": (
|
64
|
+
(
|
65
|
+
None,
|
66
|
+
dt.time(17, tzinfo=pytz.timezone("America/Chicago")),
|
67
|
+
),
|
68
|
+
),
|
69
|
+
}
|
70
|
+
|
71
|
+
@property
|
72
|
+
def tz(self):
|
73
|
+
# Central Time
|
74
|
+
return pytz.timezone("America/Chicago")
|
75
|
+
|
76
|
+
@property
|
77
|
+
def name(self):
|
78
|
+
return "CME Globex Crypto"
|
79
|
+
|
80
|
+
# Check the .zip files at the bottom of this page
|
81
|
+
# https://www.cmegroup.com/tools-information/holiday-calendar.html?redirect=/tools-information/holiday-calendar/#cmeGlobex
|
82
|
+
# Note: many of the holiday objects (ie. GoodFridayBefore2021) were originally made for equities and other markets
|
83
|
+
# and hence have a start_date starting before crypto is actually available
|
84
|
+
|
85
|
+
@property
|
86
|
+
def regular_holidays(self):
|
87
|
+
# Days where the market is fully closed
|
88
|
+
return AbstractHolidayCalendar(
|
89
|
+
rules=[
|
90
|
+
GoodFridayBefore2021,
|
91
|
+
GoodFriday2022,
|
92
|
+
ChristmasCME,
|
93
|
+
USNewYearsDay,
|
94
|
+
]
|
95
|
+
)
|
96
|
+
|
97
|
+
@property
|
98
|
+
def special_closes(self):
|
99
|
+
# Days where the market closes early
|
100
|
+
# list[Tuple[time, AbstractHolidayCalendar]]
|
101
|
+
return [
|
102
|
+
(
|
103
|
+
dt.time(8, 15, tzinfo=pytz.timezone("America/Chicago")),
|
104
|
+
AbstractHolidayCalendar(
|
105
|
+
rules=[
|
106
|
+
GoodFriday2021,
|
107
|
+
]
|
108
|
+
),
|
109
|
+
),
|
110
|
+
(
|
111
|
+
dt.time(10, 15, tzinfo=pytz.timezone("America/Chicago")),
|
112
|
+
AbstractHolidayCalendar(
|
113
|
+
rules=[
|
114
|
+
GoodFridayAfter2022,
|
115
|
+
]
|
116
|
+
),
|
117
|
+
),
|
118
|
+
(
|
119
|
+
dt.time(12, tzinfo=pytz.timezone("America/Chicago")),
|
120
|
+
AbstractHolidayCalendar(
|
121
|
+
rules=[
|
122
|
+
USMartinLutherKingJrPre2022,
|
123
|
+
USPresidentsDayPre2022,
|
124
|
+
USMemorialDayPre2022,
|
125
|
+
USIndependenceDayPre2022,
|
126
|
+
USLaborDayPre2022,
|
127
|
+
USThanksgivingDayPre2022,
|
128
|
+
]
|
129
|
+
),
|
130
|
+
),
|
131
|
+
(
|
132
|
+
dt.time(12, 15, tzinfo=pytz.timezone("America/Chicago")),
|
133
|
+
AbstractHolidayCalendar(
|
134
|
+
rules=[
|
135
|
+
ChristmasEveInOrAfter1993,
|
136
|
+
USIndependenceDayBefore2022PreviousDay,
|
137
|
+
USThanksgivingFridayPre2021,
|
138
|
+
]
|
139
|
+
),
|
140
|
+
),
|
141
|
+
(
|
142
|
+
dt.time(12, 45, tzinfo=pytz.timezone("America/Chicago")),
|
143
|
+
AbstractHolidayCalendar(rules=[USThanksgivingFridayFrom2021]),
|
144
|
+
),
|
145
|
+
# TODO: this market already closes at 1600 normally, do we need these holidays?
|
146
|
+
(
|
147
|
+
dt.time(16, tzinfo=pytz.timezone("America/Chicago")),
|
148
|
+
AbstractHolidayCalendar(
|
149
|
+
rules=[
|
150
|
+
USMartinLutherKingJrFrom2022,
|
151
|
+
USPresidentsDayFrom2022,
|
152
|
+
USMemorialDayFrom2022,
|
153
|
+
USJuneteenthFrom2022,
|
154
|
+
USIndependenceDayFrom2022,
|
155
|
+
USLaborDayFrom2022,
|
156
|
+
USThanksgivingDayFrom2022,
|
157
|
+
]
|
158
|
+
),
|
159
|
+
),
|
160
|
+
]
|