rlquantdata 0.1.0__tar.gz
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.
Potentially problematic release.
This version of rlquantdata might be problematic. Click here for more details.
- rlquantdata-0.1.0/LICENSE +21 -0
- rlquantdata-0.1.0/PKG-INFO +24 -0
- rlquantdata-0.1.0/README.md +1 -0
- rlquantdata-0.1.0/rlquantdata.egg-info/PKG-INFO +24 -0
- rlquantdata-0.1.0/rlquantdata.egg-info/SOURCES.txt +25 -0
- rlquantdata-0.1.0/rlquantdata.egg-info/dependency_links.txt +1 -0
- rlquantdata-0.1.0/rlquantdata.egg-info/requires.txt +3 -0
- rlquantdata-0.1.0/rlquantdata.egg-info/top_level.txt +1 -0
- rlquantdata-0.1.0/setup.cfg +4 -0
- rlquantdata-0.1.0/setup.py +23 -0
- rlquantdata-0.1.0/src/__init__.py +0 -0
- rlquantdata-0.1.0/src/rlquantdata/DateUtilities/Asserts.py +26 -0
- rlquantdata-0.1.0/src/rlquantdata/DateUtilities/Calendar.py +282 -0
- rlquantdata-0.1.0/src/rlquantdata/DateUtilities/Date.py +427 -0
- rlquantdata-0.1.0/src/rlquantdata/DateUtilities/DateUtilities.py +86 -0
- rlquantdata-0.1.0/src/rlquantdata/DateUtilities/Date_enum.py +47 -0
- rlquantdata-0.1.0/src/rlquantdata/DateUtilities/DayCounter.py +141 -0
- rlquantdata-0.1.0/src/rlquantdata/DateUtilities/Period.py +319 -0
- rlquantdata-0.1.0/src/rlquantdata/DateUtilities/Schedule.py +309 -0
- rlquantdata-0.1.0/src/rlquantdata/DateUtilities/Settings.py +39 -0
- rlquantdata-0.1.0/src/rlquantdata/DateUtilities/__init__.py +24 -0
- rlquantdata-0.1.0/src/rlquantdata/__init__.py +0 -0
- rlquantdata-0.1.0/src/rlquantdata/client.py +665 -0
- rlquantdata-0.1.0/src/rlquantdata/utilities/__init__.py +0 -0
- rlquantdata-0.1.0/src/rlquantdata/utilities/trade_date_utils.py +65 -0
- rlquantdata-0.1.0/src/rlquantdata/utilities/utils.py +197 -0
- rlquantdata-0.1.0/src/rlquantdata/version.py +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-present, Ziheng Zhang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rlquantdata
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Author: zhangziheng
|
|
5
|
+
Author-email: 932165330@qq.com
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.9
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: numpy>=1.17.3
|
|
13
|
+
Requires-Dist: pandas>=1.0.0
|
|
14
|
+
Requires-Dist: pyarrow>=4.0.1
|
|
15
|
+
Dynamic: author
|
|
16
|
+
Dynamic: author-email
|
|
17
|
+
Dynamic: classifier
|
|
18
|
+
Dynamic: description
|
|
19
|
+
Dynamic: description-content-type
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
Dynamic: requires-dist
|
|
22
|
+
Dynamic: requires-python
|
|
23
|
+
|
|
24
|
+
# rl-quant-data
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# rl-quant-data
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rlquantdata
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Author: zhangziheng
|
|
5
|
+
Author-email: 932165330@qq.com
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.9
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: numpy>=1.17.3
|
|
13
|
+
Requires-Dist: pandas>=1.0.0
|
|
14
|
+
Requires-Dist: pyarrow>=4.0.1
|
|
15
|
+
Dynamic: author
|
|
16
|
+
Dynamic: author-email
|
|
17
|
+
Dynamic: classifier
|
|
18
|
+
Dynamic: description
|
|
19
|
+
Dynamic: description-content-type
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
Dynamic: requires-dist
|
|
22
|
+
Dynamic: requires-python
|
|
23
|
+
|
|
24
|
+
# rl-quant-data
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
rlquantdata.egg-info/PKG-INFO
|
|
5
|
+
rlquantdata.egg-info/SOURCES.txt
|
|
6
|
+
rlquantdata.egg-info/dependency_links.txt
|
|
7
|
+
rlquantdata.egg-info/requires.txt
|
|
8
|
+
rlquantdata.egg-info/top_level.txt
|
|
9
|
+
src/__init__.py
|
|
10
|
+
src/rlquantdata/__init__.py
|
|
11
|
+
src/rlquantdata/client.py
|
|
12
|
+
src/rlquantdata/version.py
|
|
13
|
+
src/rlquantdata/DateUtilities/Asserts.py
|
|
14
|
+
src/rlquantdata/DateUtilities/Calendar.py
|
|
15
|
+
src/rlquantdata/DateUtilities/Date.py
|
|
16
|
+
src/rlquantdata/DateUtilities/DateUtilities.py
|
|
17
|
+
src/rlquantdata/DateUtilities/Date_enum.py
|
|
18
|
+
src/rlquantdata/DateUtilities/DayCounter.py
|
|
19
|
+
src/rlquantdata/DateUtilities/Period.py
|
|
20
|
+
src/rlquantdata/DateUtilities/Schedule.py
|
|
21
|
+
src/rlquantdata/DateUtilities/Settings.py
|
|
22
|
+
src/rlquantdata/DateUtilities/__init__.py
|
|
23
|
+
src/rlquantdata/utilities/__init__.py
|
|
24
|
+
src/rlquantdata/utilities/trade_date_utils.py
|
|
25
|
+
src/rlquantdata/utilities/utils.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
src
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="rlquantdata",
|
|
5
|
+
version="0.1.0",
|
|
6
|
+
author="zhangziheng",
|
|
7
|
+
author_email="932165330@qq.com",
|
|
8
|
+
description="",
|
|
9
|
+
long_description=open("README.md").read(),
|
|
10
|
+
long_description_content_type="text/markdown",
|
|
11
|
+
packages=find_packages(),
|
|
12
|
+
install_requires=[
|
|
13
|
+
"numpy>=1.17.3",
|
|
14
|
+
"pandas>=1.0.0",
|
|
15
|
+
"pyarrow>=4.0.1"
|
|
16
|
+
],
|
|
17
|
+
classifiers=[
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
],
|
|
22
|
+
python_requires='>=3.9'
|
|
23
|
+
)
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
import warnings
|
|
4
|
+
from math import fabs
|
|
5
|
+
|
|
6
|
+
from numpy import fmax
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def require(condition, exception, msg=""):
|
|
10
|
+
if not condition:
|
|
11
|
+
raise exception(msg)
|
|
12
|
+
return 0
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def ensureRaise(exception, msg=""):
|
|
16
|
+
raise exception(msg)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def warning(condition, warn_type, msg=""):
|
|
20
|
+
if not condition:
|
|
21
|
+
warnings.warn(msg, warn_type)
|
|
22
|
+
return 0
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def isClose(a, b=0., rel_tol=1e-09, abs_tol=1e-12):
|
|
26
|
+
return fabs(a - b) <= fmax(rel_tol * fmax(fabs(a), fabs(b)), abs_tol)
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
from src.rlquantdata.DateUtilities.Date_enum import TimeUnits, BizDayConventions, Months, Weekdays
|
|
4
|
+
from src.rlquantdata.DateUtilities.Date import Date
|
|
5
|
+
from src.rlquantdata.DateUtilities.Period import Period
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Calendar(object):
|
|
9
|
+
def __init__(self, holCenter: str):
|
|
10
|
+
holCenter = holCenter.lower()
|
|
11
|
+
try:
|
|
12
|
+
self._impl = _holDict[holCenter]()
|
|
13
|
+
except KeyError:
|
|
14
|
+
raise ValueError("{0} is not a valid description of a holiday center".format(holCenter))
|
|
15
|
+
self.name = holCenter
|
|
16
|
+
|
|
17
|
+
def isBizDay(self, d: Date):
|
|
18
|
+
return self._impl.isBizDay(d)
|
|
19
|
+
|
|
20
|
+
def isHoliday(self, d: Date):
|
|
21
|
+
return not self._impl.isBizDay(d)
|
|
22
|
+
|
|
23
|
+
def isWeekEnd(self, weekDay):
|
|
24
|
+
return self._impl.isWeekEnd(weekDay)
|
|
25
|
+
|
|
26
|
+
def isEndOfMonth(self, d: Date):
|
|
27
|
+
return d.month() != self.adjustDate(d + 1).month()
|
|
28
|
+
|
|
29
|
+
def endOfMonth(self, d: Date):
|
|
30
|
+
return self.adjustDate(Date.endOfMonth(d), BizDayConventions.Preceding)
|
|
31
|
+
|
|
32
|
+
def bizDaysBetween(self, fromDate: Date, toDate: Date, includeFirst: bool = True, includeLast: bool = False):
|
|
33
|
+
wd = 0
|
|
34
|
+
d: Date
|
|
35
|
+
|
|
36
|
+
if fromDate != toDate:
|
|
37
|
+
if fromDate < toDate:
|
|
38
|
+
d = fromDate
|
|
39
|
+
while d < toDate:
|
|
40
|
+
if self.isBizDay(d):
|
|
41
|
+
wd += 1
|
|
42
|
+
d += 1
|
|
43
|
+
if self.isBizDay(toDate):
|
|
44
|
+
wd += 1
|
|
45
|
+
elif fromDate > toDate:
|
|
46
|
+
d = toDate
|
|
47
|
+
while d < fromDate:
|
|
48
|
+
if self.isBizDay(d):
|
|
49
|
+
wd += 1
|
|
50
|
+
d += 1
|
|
51
|
+
if self.isBizDay(fromDate):
|
|
52
|
+
wd += 1
|
|
53
|
+
if self.isBizDay(fromDate) and not includeFirst:
|
|
54
|
+
wd -= 1
|
|
55
|
+
if self.isBizDay(toDate) and not includeLast:
|
|
56
|
+
wd -= 1
|
|
57
|
+
return wd
|
|
58
|
+
|
|
59
|
+
def adjustDate(self, d: Date, c=BizDayConventions.Following):
|
|
60
|
+
d1: Date
|
|
61
|
+
d2: Date
|
|
62
|
+
|
|
63
|
+
if c == BizDayConventions.Unadjusted:
|
|
64
|
+
return d
|
|
65
|
+
d1 = d
|
|
66
|
+
|
|
67
|
+
if c == BizDayConventions.Following or c == BizDayConventions.ModifiedFollowing or \
|
|
68
|
+
c == BizDayConventions.HalfMonthModifiedFollowing:
|
|
69
|
+
while self.isHoliday(d1):
|
|
70
|
+
d1 += 1
|
|
71
|
+
if c == BizDayConventions.ModifiedFollowing or c == BizDayConventions.HalfMonthModifiedFollowing:
|
|
72
|
+
if d1.month() != d.month():
|
|
73
|
+
return self.adjustDate(d, BizDayConventions.Preceding)
|
|
74
|
+
if c == BizDayConventions.HalfMonthModifiedFollowing:
|
|
75
|
+
if d.dayOfMonth() <= 15 < d1.dayOfMonth():
|
|
76
|
+
return self.adjustDate(d, BizDayConventions.Preceding)
|
|
77
|
+
elif c == BizDayConventions.Preceding or c == BizDayConventions.ModifiedPreceding:
|
|
78
|
+
while self.isHoliday(d1):
|
|
79
|
+
d1 -= 1
|
|
80
|
+
if c == BizDayConventions.ModifiedPreceding and d1.month() != d.month():
|
|
81
|
+
return self.adjustDate(d, BizDayConventions.Following)
|
|
82
|
+
elif c == BizDayConventions.Nearest:
|
|
83
|
+
d2 = d
|
|
84
|
+
while self.isHoliday(d1) and self.isHoliday(d2):
|
|
85
|
+
d1 += 1
|
|
86
|
+
d2 -= 1
|
|
87
|
+
|
|
88
|
+
if self.isHoliday(d1):
|
|
89
|
+
return d2
|
|
90
|
+
else:
|
|
91
|
+
return d1
|
|
92
|
+
else:
|
|
93
|
+
raise ValueError("unknown business-day convention")
|
|
94
|
+
return d1
|
|
95
|
+
|
|
96
|
+
def advanceDate(self, d: Date, period: Period, c=BizDayConventions.Following, endOfMonth: bool = False):
|
|
97
|
+
n: int
|
|
98
|
+
units: int
|
|
99
|
+
d: Date
|
|
100
|
+
|
|
101
|
+
n = period.length()
|
|
102
|
+
units = period.units()
|
|
103
|
+
|
|
104
|
+
if n == 0:
|
|
105
|
+
return self.adjustDate(d, c)
|
|
106
|
+
elif units == TimeUnits.BDays:
|
|
107
|
+
d1 = d
|
|
108
|
+
if n > 0:
|
|
109
|
+
while n > 0:
|
|
110
|
+
d1 += 1
|
|
111
|
+
while self.isHoliday(d1):
|
|
112
|
+
d1 += 1
|
|
113
|
+
n -= 1
|
|
114
|
+
else:
|
|
115
|
+
while n < 0:
|
|
116
|
+
d1 -= 1
|
|
117
|
+
while self.isHoliday(d1):
|
|
118
|
+
d1 -= 1
|
|
119
|
+
n += 1
|
|
120
|
+
return d1
|
|
121
|
+
elif units == TimeUnits.Days or units == TimeUnits.Weeks:
|
|
122
|
+
d1 = d + period
|
|
123
|
+
return self.adjustDate(d1, c)
|
|
124
|
+
else:
|
|
125
|
+
d1 = d + period
|
|
126
|
+
if endOfMonth and self.isEndOfMonth(d):
|
|
127
|
+
return self.endOfMonth(d1)
|
|
128
|
+
return self.adjustDate(d1, c)
|
|
129
|
+
|
|
130
|
+
def holDatesList(self, fromDate: Date, toDate: Date, includeWeekEnds: bool = True):
|
|
131
|
+
result = []
|
|
132
|
+
d: Date = fromDate
|
|
133
|
+
|
|
134
|
+
while d <= toDate:
|
|
135
|
+
if self.isHoliday(d) and (includeWeekEnds or not self.isWeekEnd(d.weekday())):
|
|
136
|
+
result.append(d)
|
|
137
|
+
d += 1
|
|
138
|
+
return result
|
|
139
|
+
|
|
140
|
+
def bizDatesList(self, fromDate: Date, toDate: Date):
|
|
141
|
+
result = []
|
|
142
|
+
d: Date = fromDate
|
|
143
|
+
|
|
144
|
+
while d <= toDate:
|
|
145
|
+
if self.isBizDay(d):
|
|
146
|
+
result.append(d)
|
|
147
|
+
d += 1
|
|
148
|
+
return result
|
|
149
|
+
|
|
150
|
+
def __richcmp__(self, right, op):
|
|
151
|
+
if op == 2:
|
|
152
|
+
return self._impl == right._impl
|
|
153
|
+
|
|
154
|
+
def __deepcopy__(self, memo):
|
|
155
|
+
return Calendar(self.name)
|
|
156
|
+
|
|
157
|
+
def __reduce__(self):
|
|
158
|
+
d = {}
|
|
159
|
+
|
|
160
|
+
return Calendar, (self.name,), d
|
|
161
|
+
|
|
162
|
+
def __setstate__(self, state):
|
|
163
|
+
pass
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
class CalendarImpl(object):
|
|
167
|
+
def isBizDay(self, date: Date):
|
|
168
|
+
pass
|
|
169
|
+
|
|
170
|
+
def isWeekEnd(self, weekday):
|
|
171
|
+
pass
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
sse_holDays = {'2017-10-02', '2017-10-03', '1995-05-01', '2017-10-04', '2017-10-05', '2017-10-06', '2001-01-01',
|
|
175
|
+
'2012-04-02', '2012-04-03', '2012-04-04', '2023-06-22', '2023-06-23', '2001-01-22', '2001-01-23',
|
|
176
|
+
'2001-01-24', '2001-01-25', '2001-01-26', '2001-01-29', '2001-01-30', '2001-01-31', '2001-02-01',
|
|
177
|
+
'2001-02-02', '2012-04-30', '2012-05-01', '2006-10-02', '2006-10-03', '2006-10-04', '2006-10-05',
|
|
178
|
+
'2006-10-06', '2018-01-01', '2012-06-22', '2018-02-15', '2018-02-16', '2018-02-19', '2018-02-20',
|
|
179
|
+
'2018-02-21', '2023-09-29', '2023-10-02', '2023-10-03', '2001-05-01', '2001-05-02', '2001-05-03',
|
|
180
|
+
'2001-05-04', '2023-10-04', '2023-10-05', '2001-05-07', '2023-10-06', '1995-10-02', '1995-10-03',
|
|
181
|
+
'2007-01-01', '2007-01-02', '2007-01-03', '2018-04-05', '2018-04-06', '2018-04-30', '2018-05-01',
|
|
182
|
+
'2007-02-19', '2007-02-20', '2007-02-21', '2007-02-22', '2007-02-23', '2012-10-01', '2012-10-02',
|
|
183
|
+
'2012-10-03', '2012-10-04', '2012-10-05', '1996-01-01', '2018-06-18', '2007-05-01', '2007-05-02',
|
|
184
|
+
'2007-05-03', '2007-05-04', '2007-05-07', '1996-02-19', '1996-02-20', '1996-02-21', '2001-10-01',
|
|
185
|
+
'2001-10-02', '1996-02-22', '1996-02-23', '1996-02-26', '1996-02-27', '1996-02-28', '1996-02-29',
|
|
186
|
+
'1996-03-01', '2001-10-03', '2001-10-04', '2001-10-05', '2013-01-01', '2013-01-02', '2013-01-03',
|
|
187
|
+
'2013-02-11', '2013-02-12', '2013-02-13', '2013-02-14', '2013-02-15', '2018-09-24', '2018-10-01',
|
|
188
|
+
'2018-10-02', '2018-10-03', '2018-10-04', '1996-05-01', '2018-10-05', '2002-01-01', '2002-01-02',
|
|
189
|
+
'2002-01-03', '2013-04-04', '2013-04-05', '2013-04-29', '2002-02-11', '2002-02-12', '2002-02-13',
|
|
190
|
+
'2002-02-14', '2002-02-15', '2013-04-30', '2013-05-01', '2002-02-18', '2002-02-19', '2002-02-20',
|
|
191
|
+
'2007-10-01', '2007-10-02', '2007-10-03', '2002-02-21', '2002-02-22', '2007-10-04', '2007-10-05',
|
|
192
|
+
'2018-12-31', '2019-01-01', '1991-01-01', '2013-06-10', '2013-06-11', '2013-06-12', '2019-02-04',
|
|
193
|
+
'2019-02-05', '2019-02-06', '2019-02-07', '2019-02-08', '2002-05-01', '2002-05-02', '2002-05-03',
|
|
194
|
+
'1991-02-15', '2002-05-06', '1991-02-18', '2002-05-07', '1996-09-30', '1996-10-01', '1996-10-02',
|
|
195
|
+
'2007-12-31', '2008-01-01', '2019-04-05', '2008-02-06', '2008-02-07', '2008-02-08', '2013-09-19',
|
|
196
|
+
'2008-02-11', '2008-02-12', '2013-09-20', '2019-05-01', '2019-05-02', '2019-05-03', '2013-10-01',
|
|
197
|
+
'2013-10-02', '2013-10-03', '1991-05-01', '2013-10-04', '2013-10-07', '1997-01-01', '2019-06-07',
|
|
198
|
+
'2008-04-04', '1997-02-03', '1997-02-04', '1997-02-05', '1997-02-06', '1997-02-07', '1997-02-10',
|
|
199
|
+
'1997-02-11', '1997-02-12', '1997-02-13', '1997-02-14', '2008-05-01', '2008-05-02', '2002-09-30',
|
|
200
|
+
'2002-10-01', '2002-10-02', '2002-10-03', '2002-10-04', '2002-10-07', '2014-01-01', '2008-06-09',
|
|
201
|
+
'2014-01-31', '2014-02-03', '2014-02-04', '2014-02-05', '2014-02-06', '2019-09-13', '2019-10-01',
|
|
202
|
+
'2019-10-02', '2019-10-03', '2019-10-04', '1997-05-01', '1997-05-02', '2019-10-07', '1991-10-01',
|
|
203
|
+
'1991-10-02', '2003-01-01', '2014-04-07', '2003-01-30', '2003-01-31', '2003-02-03', '2003-02-04',
|
|
204
|
+
'2003-02-05', '2003-02-06', '1997-06-30', '1997-07-01', '2003-02-07', '2008-09-15', '2014-05-01',
|
|
205
|
+
'2014-05-02', '2008-09-29', '2008-09-30', '2008-10-01', '2008-10-02', '2008-10-03', '2020-01-01',
|
|
206
|
+
'2014-06-02', '1992-01-01', '2020-01-24', '2020-01-27', '2020-01-28', '2020-01-29', '2020-01-30',
|
|
207
|
+
'2020-01-31', '1992-02-04', '1992-02-05', '1992-02-06', '2003-05-01', '2003-05-02', '2003-05-05',
|
|
208
|
+
'2003-05-06', '2003-05-07', '2003-05-08', '2003-05-09', '1997-10-01', '1997-10-02', '1997-10-03',
|
|
209
|
+
'2009-01-01', '2009-01-02', '2020-04-06', '2009-01-26', '2009-01-27', '2009-01-28', '2009-01-29',
|
|
210
|
+
'2009-01-30', '2014-09-08', '2020-05-01', '2020-05-04', '2020-05-05', '2014-10-01', '2014-10-02',
|
|
211
|
+
'2014-10-03', '1992-05-01', '2014-10-06', '2014-10-07', '1998-01-01', '1998-01-02', '2009-04-06',
|
|
212
|
+
'2020-06-25', '2020-06-26', '1998-01-26', '1998-01-27', '1998-01-28', '1998-01-29', '1998-01-30',
|
|
213
|
+
'1998-02-02', '1998-02-03', '1998-02-04', '1998-02-05', '1998-02-06', '2009-05-01', '2003-10-01',
|
|
214
|
+
'2003-10-02', '2003-10-03', '2003-10-06', '2003-10-07', '2015-01-01', '2015-01-02', '2009-05-28',
|
|
215
|
+
'2009-05-29', '2015-02-18', '2015-02-19', '2015-02-20', '2020-10-01', '2015-02-23', '2015-02-24',
|
|
216
|
+
'1998-05-01', '2020-10-02', '2020-10-05', '2020-10-06', '2020-10-07', '2020-10-08', '1992-10-01',
|
|
217
|
+
'1992-10-02', '2004-01-01', '2015-04-06', '2004-01-19', '2004-01-20', '2004-01-21', '2004-01-22',
|
|
218
|
+
'2004-01-23', '2004-01-26', '2004-01-27', '2004-01-28', '2015-05-01', '2009-10-01', '2009-10-02',
|
|
219
|
+
'2009-10-05', '2009-10-06', '2009-10-07', '2009-10-08', '2021-01-01', '1993-01-01', '2015-06-22',
|
|
220
|
+
'1993-01-25', '1993-01-26', '2021-02-11', '2021-02-12', '2021-02-15', '2021-02-16', '2021-02-17',
|
|
221
|
+
'2004-05-03', '2004-05-04', '2004-05-05', '2004-05-06', '2004-05-07', '1998-10-01', '1998-10-02',
|
|
222
|
+
'2010-01-01', '2021-04-05', '2015-09-03', '2015-09-04', '2021-05-03', '2010-02-15', '2010-02-16',
|
|
223
|
+
'2010-02-17', '2010-02-18', '2010-02-19', '2021-05-04', '2015-10-01', '2015-10-02', '2021-05-05',
|
|
224
|
+
'2015-10-05', '2015-10-06', '2015-10-07', '1999-01-01', '2021-06-14', '2010-04-05', '1999-02-10',
|
|
225
|
+
'1999-02-11', '1999-02-12', '2010-05-03', '1999-02-15', '1999-02-16', '1999-02-17', '1999-02-18',
|
|
226
|
+
'1999-02-19', '1999-02-22', '1999-02-23', '1999-02-24', '1999-02-25', '1999-02-26', '2004-10-04',
|
|
227
|
+
'2004-10-05', '2004-10-06', '2004-10-07', '2004-10-01', '2016-01-01', '2010-06-14', '2010-06-15',
|
|
228
|
+
'2010-06-16', '2016-02-08', '2016-02-09', '2016-02-10', '2016-02-11', '2016-02-12', '2021-09-20',
|
|
229
|
+
'2021-09-21', '2021-10-01', '2021-10-04', '2021-10-05', '1999-05-03', '2021-10-06', '2021-10-07',
|
|
230
|
+
'1993-10-01', '2005-01-03', '2016-04-04', '2005-02-07', '2005-02-08', '2005-02-09', '2005-02-10',
|
|
231
|
+
'2005-02-11', '2010-09-22', '2010-09-23', '2005-02-14', '2005-02-15', '2010-09-24', '2016-05-01',
|
|
232
|
+
'2016-05-02', '2010-10-01', '2010-10-04', '2010-10-05', '2010-10-06', '2010-10-07', '2022-01-03',
|
|
233
|
+
'2016-06-09', '2016-06-10', '2022-01-31', '2022-02-01', '2022-02-02', '2022-02-03', '2022-02-04',
|
|
234
|
+
'1994-02-07', '1994-02-08', '1994-02-09', '1994-02-10', '1994-02-11', '2005-05-02', '2005-05-03',
|
|
235
|
+
'2005-05-04', '2005-05-05', '2005-05-06', '1999-10-01', '1999-10-04', '1999-10-05', '1999-10-06',
|
|
236
|
+
'1999-10-07', '2011-01-03', '2022-04-04', '2022-04-05', '2011-02-02', '2011-02-03', '2011-02-04',
|
|
237
|
+
'2016-09-15', '2011-02-07', '2011-02-08', '2016-09-16', '2022-05-02', '2022-05-03', '2022-05-04',
|
|
238
|
+
'2016-10-03', '2016-10-04', '1994-05-02', '2016-10-05', '2016-10-06', '2016-10-07', '1999-12-20',
|
|
239
|
+
'2022-06-03', '1999-12-31', '2000-01-03', '2011-04-04', '2011-04-05', '2000-01-31', '2000-02-01',
|
|
240
|
+
'2000-02-02', '2000-02-03', '2000-02-04', '2000-02-07', '2000-02-08', '2000-02-09', '2000-02-10',
|
|
241
|
+
'2000-02-11', '2011-05-02', '2005-10-03', '2005-10-04', '2005-10-05', '2005-10-06', '2005-10-07',
|
|
242
|
+
'2017-01-02', '2011-06-06', '2017-01-27', '2017-01-30', '2017-01-31', '2017-02-01', '2017-02-02',
|
|
243
|
+
'2022-09-12', '2022-10-03', '2022-10-04', '2000-05-01', '2000-05-02', '2000-05-03', '2000-05-04',
|
|
244
|
+
'2000-05-05', '2022-10-05', '2022-10-06', '2022-10-07', '1994-10-03', '1994-10-04', '2006-01-02',
|
|
245
|
+
'2006-01-03', '2017-04-03', '2017-04-04', '2006-01-26', '2006-01-27', '2006-01-30', '2006-01-31',
|
|
246
|
+
'2006-02-01', '2006-02-02', '2006-02-03', '2011-09-12', '2017-05-01', '2011-10-03', '2011-10-04',
|
|
247
|
+
'2011-10-05', '2011-10-06', '2011-10-07', '2023-01-02', '2017-05-29', '2017-05-30', '1995-01-02',
|
|
248
|
+
'2023-01-23', '2023-01-24', '2023-01-25', '2023-01-26', '2023-01-27', '1995-01-30', '1995-01-31',
|
|
249
|
+
'1995-02-01', '1995-02-02', '1995-02-03', '2006-05-01', '2006-05-02', '2006-05-03', '2006-05-04',
|
|
250
|
+
'2006-05-05', '2000-10-02', '2000-10-03', '2000-10-04', '2000-10-05', '2000-10-06', '2012-01-02',
|
|
251
|
+
'2012-01-03', '2023-04-05', '2012-01-23', '2012-01-24', '2012-01-25', '2012-01-26', '2012-01-27',
|
|
252
|
+
'2023-05-01', '2023-05-02', '2023-05-03', '2024-01-01', '2024-02-09', '2024-02-12', '2024-02-13',
|
|
253
|
+
'2024-02-14', '2024-02-15', '2024-02-16', '2024-04-04', '2024-04-05', '2024-05-01', '2024-05-02',
|
|
254
|
+
'2024-05-03', '2024-06-10', '2024-09-16', '2024-09-17', '2024-10-01', '2024-10-02', '2024-10-03',
|
|
255
|
+
'2024-10-04', '2024-10-07'}
|
|
256
|
+
sse_working_weekends = {
|
|
257
|
+
# 1992
|
|
258
|
+
Date.westernStyle(4, Months.October, 1992)
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
class ChinaSseImpl(CalendarImpl):
|
|
263
|
+
def __init__(self):
|
|
264
|
+
pass
|
|
265
|
+
|
|
266
|
+
def isBizDay(self, date: Date):
|
|
267
|
+
w = date.weekday()
|
|
268
|
+
if (self.isWeekEnd(w) or str(date) in sse_holDays) and date not in sse_working_weekends:
|
|
269
|
+
return False
|
|
270
|
+
return True
|
|
271
|
+
|
|
272
|
+
def isWeekEnd(self, weekDay):
|
|
273
|
+
return weekDay == Weekdays.Saturday or weekDay == Weekdays.Sunday
|
|
274
|
+
|
|
275
|
+
def __richcmp__(self, right, op):
|
|
276
|
+
if op == 2:
|
|
277
|
+
return isinstance(right, ChinaSseImpl)
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
_sseImpl = ChinaSseImpl()
|
|
281
|
+
|
|
282
|
+
_holDict = {'china.sse': ChinaSseImpl}
|