cnexchcal 0.2.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.
- cnexchcal/__init__.py +179 -0
- cnexchcal/asset/extra_holidays.csv +4 -0
- cnexchcal/asset/festivals.csv +259 -0
- cnexchcal/asset/quasi_holidays.csv +154 -0
- cnexchcal/asset/weekend_workdays.csv +153 -0
- cnexchcal-0.2.0.dist-info/METADATA +104 -0
- cnexchcal-0.2.0.dist-info/RECORD +10 -0
- cnexchcal-0.2.0.dist-info/WHEEL +5 -0
- cnexchcal-0.2.0.dist-info/licenses/LICENSE +21 -0
- cnexchcal-0.2.0.dist-info/top_level.txt +1 -0
cnexchcal/__init__.py
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
from importlib.resources import files # for external files
|
|
2
|
+
import polars as pl
|
|
3
|
+
from datetime import date, timedelta
|
|
4
|
+
|
|
5
|
+
with files('cnexchcal').joinpath('asset', 'festivals.csv').open('rb') as f:
|
|
6
|
+
festivals = pl.read_csv(
|
|
7
|
+
f,
|
|
8
|
+
skip_rows = 2,
|
|
9
|
+
try_parse_dates = True
|
|
10
|
+
)
|
|
11
|
+
with files('cnexchcal').joinpath('asset', 'quasi_holidays.csv').open('rb') as f:
|
|
12
|
+
quasiholidays = pl.read_csv(
|
|
13
|
+
f,
|
|
14
|
+
skip_rows = 2,
|
|
15
|
+
try_parse_dates = True
|
|
16
|
+
)
|
|
17
|
+
with files('cnexchcal').joinpath('asset', 'weekend_workdays.csv').open('rb') as f:
|
|
18
|
+
weekendworkdays = pl.read_csv(
|
|
19
|
+
f,
|
|
20
|
+
skip_rows = 2,
|
|
21
|
+
try_parse_dates = True
|
|
22
|
+
)
|
|
23
|
+
ymin = festivals.get_column('date').dt.year().min()
|
|
24
|
+
ymax = festivals.get_column('date').dt.year().max()
|
|
25
|
+
dmin = date(ymin, 1, 1)
|
|
26
|
+
dmax = date(ymax, 12, 31)
|
|
27
|
+
|
|
28
|
+
class ExchCal():
|
|
29
|
+
def __init__(self):
|
|
30
|
+
self.holiday_ennames = ("New Year's Day", "Spring Festival", "Tomb-sweeping Day", "Labour Day", "Dragon Boat Festival",
|
|
31
|
+
"National Day", "Mid-autumn Festival")
|
|
32
|
+
self.holiday_cnnames = ('元旦', '春节', '清明', '劳动节', '端午', '国庆节', '中秋节')
|
|
33
|
+
# 2024-11-12 国务院发布: 自 2025-01-01 起,春节和劳动节各增加1天
|
|
34
|
+
self.nholidays = {
|
|
35
|
+
'before2025': (1, 3, 1, 1, 1, 3, 1), # 11 dates total
|
|
36
|
+
'since2025': (1, 4, 1, 2, 1, 3, 1) # 13 dates total
|
|
37
|
+
}
|
|
38
|
+
self.special_holiday = {'enname': 'Anti-Fascist 70th Day',
|
|
39
|
+
'cnname': '中国人民抗日战争暨世界反法西斯战争胜利70周年纪念日',
|
|
40
|
+
'nholidays': 1
|
|
41
|
+
} # extra holiday only for exchanges
|
|
42
|
+
def isholiday(self, d: date | str) -> bool:
|
|
43
|
+
'''
|
|
44
|
+
If d is a holiday (legal festival, quasi-holiday, weekends not work)
|
|
45
|
+
**Parameters**
|
|
46
|
+
- d: date or date string with format 'yyyy-mm-dd'
|
|
47
|
+
**Returns**: bool
|
|
48
|
+
**Example**
|
|
49
|
+
from cnexchcal import ExchCal
|
|
50
|
+
cal = ExchCal()
|
|
51
|
+
cal.isholiday('2026-01-02') # True, extra holiday on Friday
|
|
52
|
+
cal.isholiday('2026-01-04') # False, Sunday, swap with extra holiday on 2026-01-02 (Friday)
|
|
53
|
+
'''
|
|
54
|
+
if isinstance(d, str):
|
|
55
|
+
d = date.fromisoformat(d)
|
|
56
|
+
assert dmin <= d <= dmax, 'd is out of range'
|
|
57
|
+
res = ((d.weekday() in (5, 6)) and \
|
|
58
|
+
(d not in weekendworkdays.get_column('date'))) or \
|
|
59
|
+
(d in festivals.get_column('date')) or \
|
|
60
|
+
(d in quasiholidays.get_column('date'))
|
|
61
|
+
return res
|
|
62
|
+
def isworkday(self, d: date | str) -> bool:
|
|
63
|
+
'''
|
|
64
|
+
If d is a workday (regular workday and weekend workday)
|
|
65
|
+
**Parameters**
|
|
66
|
+
- d: date or date string with format 'yyyy-mm-dd'
|
|
67
|
+
**Returns**: bool
|
|
68
|
+
**Example**
|
|
69
|
+
from cnexchcal import ExchCal
|
|
70
|
+
cal = ExchCal()
|
|
71
|
+
cal.isworkday('2026-01-04') # True, Sunday, swap with extra holiday on 2026-01-02 (Friday)
|
|
72
|
+
'''
|
|
73
|
+
return not self.isholiday(d)
|
|
74
|
+
def issession(self, d: date | str) -> bool:
|
|
75
|
+
'''
|
|
76
|
+
If d is a trading date of exchanges in China mainland. On weekend workday, exchanges are closed.
|
|
77
|
+
**Parameters**
|
|
78
|
+
- d: date or date string with format 'yyyy-mm-dd'
|
|
79
|
+
**Returns**: bool
|
|
80
|
+
**Example**
|
|
81
|
+
from cnexchcal import ExchCal
|
|
82
|
+
cal = ExchCal()
|
|
83
|
+
cal.issession('2026-01-04') # False, Sunday, but is workday
|
|
84
|
+
'''
|
|
85
|
+
if isinstance(d, str):
|
|
86
|
+
d = date.fromisoformat(d)
|
|
87
|
+
assert dmin <= d <= dmax, 'd is out of range'
|
|
88
|
+
closed = (d.weekday() in (5, 6)) or \
|
|
89
|
+
(d in festivals.get_column('date')) or \
|
|
90
|
+
(d in quasiholidays.get_column('date')) or \
|
|
91
|
+
(d == date(2024, 2, 9)) # special holiday
|
|
92
|
+
return not closed
|
|
93
|
+
def nextsession(self, d: date | str) -> date:
|
|
94
|
+
'''
|
|
95
|
+
Next trading day from a given date d. If d itself is a trading day, return d itself
|
|
96
|
+
**Parameters**
|
|
97
|
+
- d: date or date string with format 'yyyy-mm-dd'
|
|
98
|
+
**Returns**: date
|
|
99
|
+
**Example**
|
|
100
|
+
from cnexchcal import ExchCal
|
|
101
|
+
cal = ExchCal()
|
|
102
|
+
cal.nextsession('2025-12-31') # 2026-01-05
|
|
103
|
+
'''
|
|
104
|
+
if isinstance(d, str):
|
|
105
|
+
d = date.fromisoformat(d)
|
|
106
|
+
assert dmin <= d <= dmax, 'd is out of range'
|
|
107
|
+
i = 0
|
|
108
|
+
while (dd := d + timedelta(days = i)) < dmax:
|
|
109
|
+
if self.issession(dd):
|
|
110
|
+
return dd
|
|
111
|
+
i += 1
|
|
112
|
+
raise ValueError('next session is out of range')
|
|
113
|
+
def previoussession(self, d: date | str) -> date:
|
|
114
|
+
'''
|
|
115
|
+
Previous trading date. If d itself is a trading day, return d itself
|
|
116
|
+
**Parameters**
|
|
117
|
+
- d: date or date string with format 'yyyy-mm-dd'
|
|
118
|
+
**Returns**: date
|
|
119
|
+
**Example**
|
|
120
|
+
from cnexchcal import ExchCal
|
|
121
|
+
cal = ExchCal()
|
|
122
|
+
cal.previoussession('2026-01-05') # 2025-12-31
|
|
123
|
+
'''
|
|
124
|
+
if isinstance(d, str):
|
|
125
|
+
d = date.fromisoformat(d)
|
|
126
|
+
assert dmin <= d <= dmax, 'd is out of range'
|
|
127
|
+
i = 0
|
|
128
|
+
while (dd := d - timedelta(days = i)) > dmin:
|
|
129
|
+
if self.issession(dd):
|
|
130
|
+
return dd
|
|
131
|
+
i += 1
|
|
132
|
+
raise ValueError('previous session is out of range')
|
|
133
|
+
def trade_date_range(self, d1: date | str, d2: date | str, closed: str = 'both') -> list[date]:
|
|
134
|
+
'''
|
|
135
|
+
all trading days between d1 and d2
|
|
136
|
+
**Parameters**
|
|
137
|
+
- d1, d2: date or date string with format 'yyyy-mm-dd'
|
|
138
|
+
- closed: 'both', 'left' or 'right'
|
|
139
|
+
**Returns**: list of date
|
|
140
|
+
**Example**
|
|
141
|
+
from cnexchcal import ExchCal
|
|
142
|
+
cal = ExchCal()
|
|
143
|
+
cal.trade_date_range('2025-12-29', '2026-01-05', closed = 'left')
|
|
144
|
+
'''
|
|
145
|
+
if isinstance(d1, str):
|
|
146
|
+
d1 = date.fromisoformat(d1)
|
|
147
|
+
if isinstance(d2, str):
|
|
148
|
+
d2 = date.fromisoformat(d2)
|
|
149
|
+
if d1 > d2:
|
|
150
|
+
d1, d2 = d2, d1
|
|
151
|
+
assert closed.lower() in ('both', 'left', 'right'), 'value of closed can ONLY be one of "both", "left" or "right"'
|
|
152
|
+
if closed == 'left':
|
|
153
|
+
d2 -= timedelta(days = 1)
|
|
154
|
+
elif closed == 'right':
|
|
155
|
+
d1 += timedelta(days = 1)
|
|
156
|
+
assert dmin <= d1 <= dmax, 'd1 is out of range'
|
|
157
|
+
assert dmin <= d2 <= dmax, 'd2 is out of range'
|
|
158
|
+
return [d for d in pl.date_range(d1, d2, eager = True) if self.issession(d)]
|
|
159
|
+
def next_nth_tradingday(self, d: date | str, n: int) -> date:
|
|
160
|
+
'''
|
|
161
|
+
Next n-th trading day after the given date d. d itself can be a non-trading day
|
|
162
|
+
**Parameters**
|
|
163
|
+
- d: date or date string with format 'yyyy-mm-dd'
|
|
164
|
+
- n: int
|
|
165
|
+
**Returns**: date
|
|
166
|
+
**Example**
|
|
167
|
+
from cnexchcal import ExchCal
|
|
168
|
+
cal = ExchCal()
|
|
169
|
+
cal.next_nth_tradingday('2025-12-31', 3)
|
|
170
|
+
'''
|
|
171
|
+
if isinstance(d, str):
|
|
172
|
+
d = date.fromisoformat(d)
|
|
173
|
+
i, j = 0, 1
|
|
174
|
+
while i < n:
|
|
175
|
+
dd = d + timedelta(days = j)
|
|
176
|
+
if self.issession(dd):
|
|
177
|
+
i += 1
|
|
178
|
+
j += 1
|
|
179
|
+
return (d + timedelta(days = j - 1))
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
pure holidays since year 2004, excluding weekends and in-lieu days (双休日调休形成的 quasi holidays); weekday: 0 (Sun), 1 (Mon), ... 6 (Sat)
|
|
2
|
+
holiday schedule will update in Nov. each year
|
|
3
|
+
date,week_day,enname,cnname
|
|
4
|
+
2004-01-01,4,New Year's Day,元旦
|
|
5
|
+
2004-01-22,4,Spring Festival,春节
|
|
6
|
+
2004-01-23,5,Spring Festival,春节
|
|
7
|
+
2004-01-26,1,Spring Festival,春节
|
|
8
|
+
2004-05-03,1,Labour Day,劳动节
|
|
9
|
+
2004-05-04,2,Labour Day,劳动节
|
|
10
|
+
2004-05-05,3,Labour Day,劳动节
|
|
11
|
+
2004-10-01,5,National Day,国庆节
|
|
12
|
+
2004-10-04,1,National Day,国庆节
|
|
13
|
+
2004-10-05,2,National Day,国庆节
|
|
14
|
+
2005-01-03,1,New Year's Day,元旦
|
|
15
|
+
2005-02-09,3,Spring Festival,春节
|
|
16
|
+
2005-02-10,4,Spring Festival,春节
|
|
17
|
+
2005-02-11,5,Spring Festival,春节
|
|
18
|
+
2005-05-02,1,Labour Day,劳动节
|
|
19
|
+
2005-05-03,2,Labour Day,劳动节
|
|
20
|
+
2005-05-04,3,Labour Day,劳动节
|
|
21
|
+
2005-10-03,1,National Day,国庆节
|
|
22
|
+
2005-10-04,2,National Day,国庆节
|
|
23
|
+
2005-10-05,3,National Day,国庆节
|
|
24
|
+
2006-01-02,1,New Year's Day,元旦
|
|
25
|
+
2006-01-03,2,New Year's Day,元旦
|
|
26
|
+
2006-01-30,1,Spring Festival,春节
|
|
27
|
+
2006-01-31,2,Spring Festival,春节
|
|
28
|
+
2006-02-01,3,Spring Festival,春节
|
|
29
|
+
2006-05-01,1,Labour Day,劳动节
|
|
30
|
+
2006-05-02,2,Labour Day,劳动节
|
|
31
|
+
2006-05-03,3,Labour Day,劳动节
|
|
32
|
+
2006-10-02,1,National Day,国庆节
|
|
33
|
+
2006-10-03,2,National Day,国庆节
|
|
34
|
+
2006-10-04,3,National Day,国庆节
|
|
35
|
+
2007-01-01,1,New Year's Day,元旦
|
|
36
|
+
2007-02-19,1,Spring Festival,春节
|
|
37
|
+
2007-02-20,2,Spring Festival,春节
|
|
38
|
+
2007-02-21,3,Spring Festival,春节
|
|
39
|
+
2007-05-01,2,Labour Day,劳动节
|
|
40
|
+
2007-05-02,3,Labour Day,劳动节
|
|
41
|
+
2007-05-03,4,Labour Day,劳动节
|
|
42
|
+
2007-10-01,1,National Day,国庆节
|
|
43
|
+
2007-10-02,2,National Day,国庆节
|
|
44
|
+
2007-10-03,3,National Day,国庆节
|
|
45
|
+
2008-01-01,2,New Year's Day,元旦
|
|
46
|
+
2008-02-06,3,Spring Festival,春节
|
|
47
|
+
2008-02-07,4,Spring Festival,春节
|
|
48
|
+
2008-02-08,5,Spring Festival,春节
|
|
49
|
+
2008-04-04,5,Tomb-sweeping Day,清明
|
|
50
|
+
2008-05-01,4,Labour Day,劳动节
|
|
51
|
+
2008-06-09,1,Dragon Boat Festival,端午
|
|
52
|
+
2008-09-15,1,Mid-autumn Festival,中秋
|
|
53
|
+
2008-10-01,3,National Day,国庆节
|
|
54
|
+
2008-10-02,4,National Day,国庆节
|
|
55
|
+
2008-10-03,5,National Day,国庆节
|
|
56
|
+
2009-01-01,4,New Year's Day,元旦
|
|
57
|
+
2009-01-26,1,Spring Festival,春节
|
|
58
|
+
2009-01-27,2,Spring Festival,春节
|
|
59
|
+
2009-01-28,3,Spring Festival,春节
|
|
60
|
+
2009-04-06,1,Tomb-sweeping Day,清明
|
|
61
|
+
2009-05-01,5,Labour Day,劳动节
|
|
62
|
+
2009-05-28,4,Dragon Boat Festival,端午
|
|
63
|
+
2009-10-01,4,National Day,国庆节
|
|
64
|
+
2009-10-02,5,National Day,国庆节
|
|
65
|
+
2009-10-05,1,National Day,国庆节
|
|
66
|
+
2009-10-06,2,National Day,国庆节
|
|
67
|
+
2010-01-01,5,New Year's Day,元旦
|
|
68
|
+
2010-02-15,1,Spring Festival,春节
|
|
69
|
+
2010-02-16,2,Spring Festival,春节
|
|
70
|
+
2010-02-17,3,Spring Festival,春节
|
|
71
|
+
2010-04-05,1,Tomb-sweeping Day,清明
|
|
72
|
+
2010-05-03,1,Labour Day,劳动节
|
|
73
|
+
2010-06-16,3,Dragon Boat Festival,端午
|
|
74
|
+
2010-09-22,3,Mid-autumn Festival,中秋
|
|
75
|
+
2010-10-01,5,National Day,国庆节
|
|
76
|
+
2010-10-04,1,National Day,国庆节
|
|
77
|
+
2010-10-05,2,National Day,国庆节
|
|
78
|
+
2011-01-03,1,New Year's Day,元旦
|
|
79
|
+
2011-02-02,3,Spring Festival,春节
|
|
80
|
+
2011-02-03,4,Spring Festival,春节
|
|
81
|
+
2011-02-04,5,Spring Festival,春节
|
|
82
|
+
2011-04-05,2,Tomb-sweeping Day,清明
|
|
83
|
+
2011-05-02,1,Labour Day,劳动节
|
|
84
|
+
2011-06-06,1,Dragon Boat Festival,端午
|
|
85
|
+
2011-09-12,1,Mid-autumn Festival,中秋
|
|
86
|
+
2011-10-03,1,National Day,国庆节
|
|
87
|
+
2011-10-04,2,National Day,国庆节
|
|
88
|
+
2011-10-05,3,National Day,国庆节
|
|
89
|
+
2012-01-02,1,New Year's Day,元旦
|
|
90
|
+
2012-01-23,1,Spring Festival,春节
|
|
91
|
+
2012-01-24,2,Spring Festival,春节
|
|
92
|
+
2012-01-25,3,Spring Festival,春节
|
|
93
|
+
2012-04-04,3,Tomb-sweeping Day,清明
|
|
94
|
+
2012-05-01,2,Labour Day,劳动节
|
|
95
|
+
2012-06-22,5,Dragon Boat Festival,端午
|
|
96
|
+
2012-10-01,1,National Day,国庆节
|
|
97
|
+
2012-10-02,2,National Day,国庆节
|
|
98
|
+
2012-10-03,3,National Day,国庆节
|
|
99
|
+
2012-10-04,4,National Day,国庆节
|
|
100
|
+
2013-01-01,2,New Year's Day,元旦
|
|
101
|
+
2013-02-11,1,Spring Festival,春节
|
|
102
|
+
2013-02-12,2,Spring Festival,春节
|
|
103
|
+
2013-02-13,3,Spring Festival,春节
|
|
104
|
+
2013-04-04,4,Tomb-sweeping Day,清明
|
|
105
|
+
2013-05-01,3,Labour Day,劳动节
|
|
106
|
+
2013-06-12,3,Dragon Boat Festival,端午
|
|
107
|
+
2013-09-19,4,Mid-autumn Festival,中秋
|
|
108
|
+
2013-10-01,2,National Day,国庆节
|
|
109
|
+
2013-10-02,3,National Day,国庆节
|
|
110
|
+
2013-10-03,4,National Day,国庆节
|
|
111
|
+
2014-01-01,3,New Year's Day,元旦
|
|
112
|
+
2014-01-31,5,Spring Festival,春节
|
|
113
|
+
2014-02-03,1,Spring Festival,春节
|
|
114
|
+
2014-02-04,2,Spring Festival,春节
|
|
115
|
+
2014-04-07,1,Tomb-sweeping Day,清明
|
|
116
|
+
2014-05-01,4,Labour Day,劳动节
|
|
117
|
+
2014-06-02,1,Dragon Boat Festival,端午
|
|
118
|
+
2014-09-08,1,Mid-autumn Festival,中秋
|
|
119
|
+
2014-10-01,3,National Day,国庆节
|
|
120
|
+
2014-10-02,4,National Day,国庆节
|
|
121
|
+
2014-10-03,5,National Day,国庆节
|
|
122
|
+
2015-01-01,4,New Year's Day,元旦
|
|
123
|
+
2015-02-18,3,Spring Festival,春节
|
|
124
|
+
2015-02-19,4,Spring Festival,春节
|
|
125
|
+
2015-02-20,5,Spring Festival,春节
|
|
126
|
+
2015-04-06,1,Tomb-sweeping Day,清明
|
|
127
|
+
2015-05-01,5,Labour Day,劳动节
|
|
128
|
+
2015-06-22,1,Dragon Boat Festival,端午
|
|
129
|
+
2015-09-03,4,Anti-Fascist 70th Day,中国人民抗日战争暨世界反法西斯战争胜利70周年纪念日
|
|
130
|
+
2015-10-01,4,National Day,国庆节
|
|
131
|
+
2015-10-02,5,National Day,国庆节
|
|
132
|
+
2015-10-05,1,National Day,国庆节
|
|
133
|
+
2015-10-06,2,National Day,国庆节
|
|
134
|
+
2016-01-01,5,New Year's Day,元旦
|
|
135
|
+
2016-02-08,1,Spring Festival,春节
|
|
136
|
+
2016-02-09,2,Spring Festival,春节
|
|
137
|
+
2016-02-10,3,Spring Festival,春节
|
|
138
|
+
2016-04-04,1,Tomb-sweeping Day,清明
|
|
139
|
+
2016-05-02,1,Labour Day,劳动节
|
|
140
|
+
2016-06-09,4,Dragon Boat Festival,端午
|
|
141
|
+
2016-09-15,4,Mid-autumn Festival,中秋
|
|
142
|
+
2016-10-03,1,National Day,国庆节
|
|
143
|
+
2016-10-04,2,National Day,国庆节
|
|
144
|
+
2016-10-05,3,National Day,国庆节
|
|
145
|
+
2017-01-02,1,New Year's Day,元旦
|
|
146
|
+
2017-01-27,5,Spring Festival,春节
|
|
147
|
+
2017-01-30,1,Spring Festival,春节
|
|
148
|
+
2017-01-31,2,Spring Festival,春节
|
|
149
|
+
2017-04-04,2,Tomb-sweeping Day,清明
|
|
150
|
+
2017-05-01,1,Labour Day,劳动节
|
|
151
|
+
2017-05-30,2,Dragon Boat Festival,端午
|
|
152
|
+
2017-10-02,1,National Day,国庆节
|
|
153
|
+
2017-10-03,2,National Day,国庆节
|
|
154
|
+
2017-10-04,3,Mid-autumn Festival,中秋
|
|
155
|
+
2017-10-05,4,National Day,国庆节
|
|
156
|
+
2018-01-01,1,New Year's Day,元旦
|
|
157
|
+
2018-02-15,4,Spring Festival,春节
|
|
158
|
+
2018-02-16,5,Spring Festival,春节
|
|
159
|
+
2018-04-05,4,Tomb-sweeping Day,清明
|
|
160
|
+
2018-05-01,2,Labour Day,劳动节
|
|
161
|
+
2018-06-18,1,Dragon Boat Festival,端午
|
|
162
|
+
2018-09-24,1,Mid-autumn Festival,中秋
|
|
163
|
+
2018-10-01,1,National Day,国庆节
|
|
164
|
+
2018-10-02,2,National Day,国庆节
|
|
165
|
+
2018-10-03,3,National Day,国庆节
|
|
166
|
+
2019-01-01,2,New Year's Day,元旦
|
|
167
|
+
2019-02-05,2,Spring Festival,春节
|
|
168
|
+
2019-02-06,3,Spring Festival,春节
|
|
169
|
+
2019-02-07,4,Spring Festival,春节
|
|
170
|
+
2019-04-05,5,Tomb-sweeping Day,清明
|
|
171
|
+
2019-05-01,3,Labour Day,劳动节
|
|
172
|
+
2019-06-07,5,Dragon Boat Festival,端午
|
|
173
|
+
2019-09-13,5,Mid-autumn Festival,中秋
|
|
174
|
+
2019-10-01,2,National Day,国庆节
|
|
175
|
+
2019-10-02,3,National Day,国庆节
|
|
176
|
+
2019-10-03,4,National Day,国庆节
|
|
177
|
+
2020-01-01,3,New Year's Day,元旦
|
|
178
|
+
2020-01-24,5,Spring Festival,春节
|
|
179
|
+
2020-01-27,1,Spring Festival,春节
|
|
180
|
+
2020-01-28,2,Spring Festival,春节
|
|
181
|
+
2020-01-30,4,Spring Festival,春节
|
|
182
|
+
2020-01-31,5,Spring Festival,春节
|
|
183
|
+
2020-04-06,1,Tomb-sweeping Day,清明
|
|
184
|
+
2020-05-01,5,Labour Day,劳动节
|
|
185
|
+
2020-06-25,4,Dragon Boat Festival,端午
|
|
186
|
+
2020-10-01,4,National Day,国庆节
|
|
187
|
+
2020-10-02,5,National Day,国庆节
|
|
188
|
+
2020-10-05,1,National Day,国庆节
|
|
189
|
+
2020-10-06,2,National Day,国庆节
|
|
190
|
+
2021-01-01,5,New Year's Day,元旦
|
|
191
|
+
2021-02-11,4,Spring Festival,春节
|
|
192
|
+
2021-02-12,5,Spring Festival,春节
|
|
193
|
+
2021-02-15,1,Spring Festival,春节
|
|
194
|
+
2021-04-05,1,Tomb-sweeping Day,清明
|
|
195
|
+
2021-05-03,1,Labour Day,劳动节
|
|
196
|
+
2021-06-14,1,Dragon Boat Festival,端午
|
|
197
|
+
2021-09-21,2,Mid-autumn Festival,中秋
|
|
198
|
+
2021-10-01,5,National Day,国庆节
|
|
199
|
+
2021-10-04,1,National Day,国庆节
|
|
200
|
+
2021-10-05,2,National Day,国庆节
|
|
201
|
+
2022-01-03,1,New Year's Day,元旦
|
|
202
|
+
2022-01-31,1,Spring Festival,春节
|
|
203
|
+
2022-02-01,2,Spring Festival,春节
|
|
204
|
+
2022-02-02,3,Spring Festival,春节
|
|
205
|
+
2022-04-05,2,Tomb-sweeping Day,清明
|
|
206
|
+
2022-05-02,1,Labour Day,劳动节
|
|
207
|
+
2022-06-03,5,Dragon Boat Festival,端午
|
|
208
|
+
2022-09-12,1,Mid-autumn Festival,中秋
|
|
209
|
+
2022-10-03,1,National Day,国庆节
|
|
210
|
+
2022-10-04,2,National Day,国庆节
|
|
211
|
+
2022-10-05,3,National Day,国庆节
|
|
212
|
+
2023-01-02,1,New Year's Day,元旦
|
|
213
|
+
2023-01-23,1,Spring Festival,春节
|
|
214
|
+
2023-01-24,2,Spring Festival,春节
|
|
215
|
+
2023-01-25,3,Spring Festival,春节
|
|
216
|
+
2023-04-05,3,Tomb-sweeping Day,清明
|
|
217
|
+
2023-05-01,1,Labour Day,劳动节
|
|
218
|
+
2023-06-22,4,Dragon Boat Festival,端午
|
|
219
|
+
2023-09-29,5,Mid-autumn Festival,中秋
|
|
220
|
+
2023-10-02,1,National Day,国庆节
|
|
221
|
+
2023-10-03,2,National Day,国庆节
|
|
222
|
+
2023-10-04,3,National Day,国庆节
|
|
223
|
+
2024-01-01,1,New Year's Day,元旦
|
|
224
|
+
2024-02-12,1,Spring Festival,春节
|
|
225
|
+
2024-02-13,2,Spring Festival,春节
|
|
226
|
+
2024-02-14,3,Spring Festival,春节
|
|
227
|
+
2024-04-04,4,Tomb-sweeping Day,清明
|
|
228
|
+
2024-05-01,3,Labour Day,劳动节
|
|
229
|
+
2024-06-10,1,Dragon Boat Festival,端午
|
|
230
|
+
2024-09-17,2,Mid-autumn Festival,中秋
|
|
231
|
+
2024-10-01,2,National Day,国庆节
|
|
232
|
+
2024-10-02,3,National Day,国庆节
|
|
233
|
+
2024-10-03,4,National Day,国庆节
|
|
234
|
+
2025-01-01,3,New Year's Day,元旦
|
|
235
|
+
2025-01-28,2,Spring Festival,春节
|
|
236
|
+
2025-01-29,3,Spring Festival,春节
|
|
237
|
+
2025-01-30,4,Spring Festival,春节
|
|
238
|
+
2025-01-31,5,Spring Festival,春节
|
|
239
|
+
2025-04-04,5,Tomb-sweeping Day,清明
|
|
240
|
+
2025-05-01,4,Labour Day,劳动节
|
|
241
|
+
2025-05-02,5,Labour Day,劳动节
|
|
242
|
+
2025-06-02,1,Dragon Boat Festival,端午
|
|
243
|
+
2025-10-01,3,National Day,国庆节
|
|
244
|
+
2025-10-02,4,National Day,国庆节
|
|
245
|
+
2025-10-03,5,National Day,国庆节
|
|
246
|
+
2025-10-06,1,Mid-autumn Festival,中秋
|
|
247
|
+
2026-01-01,4,New Year's Day,元旦
|
|
248
|
+
2026-02-16,1,Spring Festival,春节
|
|
249
|
+
2026-02-17,2,Spring Festival,春节
|
|
250
|
+
2026-02-18,3,Spring Festival,春节
|
|
251
|
+
2026-02-19,4,Spring Festival,春节
|
|
252
|
+
2026-04-06,1,Tomb-sweeping Day,清明
|
|
253
|
+
2026-05-01,5,Labour Day,劳动节
|
|
254
|
+
2026-05-04,1,Labour Day,劳动节
|
|
255
|
+
2026-06-19,5,Dragon Boat Festival,端午
|
|
256
|
+
2026-09-25,5,Mid-autumn Festival,中秋
|
|
257
|
+
2026-10-01,4,National Day,国庆节
|
|
258
|
+
2026-10-02,5,National Day,国庆节
|
|
259
|
+
2026-10-05,1,National Day,国庆节
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
quasi-holidays (由双休日调休形成、于非双休日的准假日) since year 2004; weekday: 0 (Sun), 1 (Mon), ... 6 (Sat)
|
|
2
|
+
节假日安排由国务院发布,一般每年11月前后发布,请及时更新数据
|
|
3
|
+
date,week_day,enname,cnname
|
|
4
|
+
2004-01-27,2,Spring Festival,春节
|
|
5
|
+
2004-01-28,3,Spring Festival,春节
|
|
6
|
+
2004-05-06,4,Labour Day,劳动节
|
|
7
|
+
2004-05-07,5,Labour Day,劳动节
|
|
8
|
+
2004-10-06,3,National Day,国庆节
|
|
9
|
+
2004-10-07,4,National Day,国庆节
|
|
10
|
+
2005-02-14,1,Spring Festival,春节
|
|
11
|
+
2005-02-15,2,Spring Festival,春节
|
|
12
|
+
2005-05-05,4,Labour Day,劳动节
|
|
13
|
+
2005-05-06,5,Labour Day,劳动节
|
|
14
|
+
2005-10-06,4,National Day,国庆节
|
|
15
|
+
2005-10-07,5,National Day,国庆节
|
|
16
|
+
2006-02-02,4,Spring Festival,春节
|
|
17
|
+
2006-02-03,5,Spring Festival,春节
|
|
18
|
+
2006-05-04,4,Labour Day,劳动节
|
|
19
|
+
2006-05-05,5,Labour Day,劳动节
|
|
20
|
+
2006-10-05,4,National Day,国庆节
|
|
21
|
+
2006-10-06,5,National Day,国庆节
|
|
22
|
+
2007-01-02,2,New Year's Day,元旦
|
|
23
|
+
2007-01-03,3,New Year's Day,元旦
|
|
24
|
+
2007-02-22,4,Spring Festival,春节
|
|
25
|
+
2007-02-23,5,Spring Festival,春节
|
|
26
|
+
2007-05-04,5,Labour Day,劳动节
|
|
27
|
+
2007-05-07,1,Labour Day,劳动节
|
|
28
|
+
2007-10-04,4,National Day,国庆节
|
|
29
|
+
2007-10-05,5,National Day,国庆节
|
|
30
|
+
2007-12-31,1,New Year's Day,元旦
|
|
31
|
+
2008-02-11,1,Spring Festival,春节
|
|
32
|
+
2008-02-12,2,Spring Festival,春节
|
|
33
|
+
2008-05-02,5,Labour Day,劳动节
|
|
34
|
+
2008-09-29,1,National Day,国庆节
|
|
35
|
+
2008-09-30,2,National Day,国庆节
|
|
36
|
+
2009-01-02,5,New Year's Day,元旦
|
|
37
|
+
2009-01-29,4,Spring Festival,春节
|
|
38
|
+
2009-01-30,5,Spring Festival,春节
|
|
39
|
+
2009-05-29,5,Dragon Boat Festival,端午
|
|
40
|
+
2009-10-07,3,National Day,国庆节
|
|
41
|
+
2009-10-08,4,National Day,国庆节
|
|
42
|
+
2010-02-18,4,Spring Festival,春节
|
|
43
|
+
2010-02-19,5,Spring Festival,春节
|
|
44
|
+
2010-06-14,1,Dragon Boat Festival,端午
|
|
45
|
+
2010-06-15,2,Dragon Boat Festival,端午
|
|
46
|
+
2010-09-23,4,Mid-autumn Festival,中秋
|
|
47
|
+
2010-09-24,5,Mid-autumn Festival,中秋
|
|
48
|
+
2010-10-06,3,National Day,国庆节
|
|
49
|
+
2010-10-07,4,National Day,国庆节
|
|
50
|
+
2011-02-07,1,Spring Festival,春节
|
|
51
|
+
2011-02-08,2,Spring Festival,春节
|
|
52
|
+
2011-04-04,1,Tomb-sweeping Day,清明
|
|
53
|
+
2011-10-06,4,National Day,国庆节
|
|
54
|
+
2011-10-07,5,National Day,国庆节
|
|
55
|
+
2012-01-03,2,New Year's Day,元旦
|
|
56
|
+
2012-01-26,4,Spring Festival,春节
|
|
57
|
+
2012-01-27,5,Spring Festival,春节
|
|
58
|
+
2012-04-02,1,Tomb-sweeping Day,清明
|
|
59
|
+
2012-04-03,2,Tomb-sweeping Day,清明
|
|
60
|
+
2012-04-30,1,Labour Day,劳动节
|
|
61
|
+
2012-10-05,5,National Day,国庆节
|
|
62
|
+
2013-01-02,3,New Year's Day,元旦
|
|
63
|
+
2013-01-03,4,New Year's Day,元旦
|
|
64
|
+
2013-02-14,4,Spring Festival,春节
|
|
65
|
+
2013-02-15,5,Spring Festival,春节
|
|
66
|
+
2013-04-05,5,Tomb-sweeping Day,清明
|
|
67
|
+
2013-04-29,1,Labour Day,劳动节
|
|
68
|
+
2013-04-30,2,Labour Day,劳动节
|
|
69
|
+
2013-06-10,1,Dragon Boat Festival,端午
|
|
70
|
+
2013-06-11,2,Dragon Boat Festival,端午
|
|
71
|
+
2013-09-20,5,Mid-autumn Festival,中秋
|
|
72
|
+
2013-10-04,5,National Day,国庆节
|
|
73
|
+
2013-10-07,1,National Day,国庆节
|
|
74
|
+
2014-02-05,3,Spring Festival,春节
|
|
75
|
+
2014-02-06,4,Spring Festival,春节
|
|
76
|
+
2014-05-02,5,Labour Day,劳动节
|
|
77
|
+
2014-10-06,1,National Day,国庆节
|
|
78
|
+
2014-10-07,2,National Day,国庆节
|
|
79
|
+
2015-01-02,5,New Year's Day,元旦
|
|
80
|
+
2015-02-23,1,Spring Festival,春节
|
|
81
|
+
2015-02-24,2,Spring Festival,春节
|
|
82
|
+
2015-09-04,5,Anti-Fascist 70th Day,中国人民抗日战争暨世界反法西斯战争胜利70周年纪念日
|
|
83
|
+
2015-10-07,3,National Day,国庆节
|
|
84
|
+
2016-02-11,4,Spring Festival,春节
|
|
85
|
+
2016-02-12,5,Spring Festival,春节
|
|
86
|
+
2016-06-10,5,Dragon Boat Festival,端午
|
|
87
|
+
2016-09-16,5,Mid-autumn Festival,中秋
|
|
88
|
+
2016-10-06,4,National Day,国庆节
|
|
89
|
+
2016-10-07,5,National Day,国庆节
|
|
90
|
+
2017-02-01,3,Spring Festival,春节
|
|
91
|
+
2017-02-02,4,Spring Festival,春节
|
|
92
|
+
2017-04-03,1,Tomb-sweeping Day,清明
|
|
93
|
+
2017-05-29,1,Dragon Boat Festival,端午
|
|
94
|
+
2017-10-06,5,National Day,国庆节
|
|
95
|
+
2018-02-19,1,Spring Festival,春节
|
|
96
|
+
2018-02-20,2,Spring Festival,春节
|
|
97
|
+
2018-02-21,3,Spring Festival,春节
|
|
98
|
+
2018-04-06,5,Tomb-sweeping Day,清明
|
|
99
|
+
2018-04-30,1,Labour Day,劳动节
|
|
100
|
+
2018-10-04,4,National Day,国庆节
|
|
101
|
+
2018-10-05,5,National Day,国庆节
|
|
102
|
+
2018-12-31,1,New Year's Day,元旦
|
|
103
|
+
2019-02-04,1,Spring Festival,春节
|
|
104
|
+
2019-02-08,5,Spring Festival,春节
|
|
105
|
+
2019-05-02,4,Labour Day,劳动节
|
|
106
|
+
2019-05-03,5,Labour Day,劳动节
|
|
107
|
+
2019-10-04,5,National Day,国庆节
|
|
108
|
+
2019-10-07,1,National Day,国庆节
|
|
109
|
+
2020-01-29,3,Spring Festival,春节
|
|
110
|
+
2020-05-04,1,Labour Day,劳动节
|
|
111
|
+
2020-05-05,2,Labour Day,劳动节
|
|
112
|
+
2020-06-26,5,Dragon Boat Festival,端午
|
|
113
|
+
2020-10-07,3,National Day,国庆节
|
|
114
|
+
2020-10-08,4,National Day,国庆节
|
|
115
|
+
2021-02-16,2,Spring Festival,春节
|
|
116
|
+
2021-02-17,3,Spring Festival,春节
|
|
117
|
+
2021-05-04,2,Labour Day,劳动节
|
|
118
|
+
2021-05-05,3,Labour Day,劳动节
|
|
119
|
+
2021-09-20,1,Mid-autumn Festival,中秋
|
|
120
|
+
2021-10-06,3,National Day,国庆节
|
|
121
|
+
2021-10-07,4,National Day,国庆节
|
|
122
|
+
2022-02-03,4,Spring Festival,春节
|
|
123
|
+
2022-02-04,5,Spring Festival,春节
|
|
124
|
+
2022-04-04,1,Tomb-sweeping Day,清明
|
|
125
|
+
2022-05-03,2,Labour Day,劳动节
|
|
126
|
+
2022-05-04,3,Labour Day,劳动节
|
|
127
|
+
2022-10-06,4,National Day,国庆节
|
|
128
|
+
2022-10-07,5,National Day,国庆节
|
|
129
|
+
2023-01-26,4,Spring Festival,春节
|
|
130
|
+
2023-01-27,5,Spring Festival,春节
|
|
131
|
+
2023-05-02,2,Labour Day,劳动节
|
|
132
|
+
2023-05-03,3,Labour Day,劳动节
|
|
133
|
+
2023-06-23,5,Dragon Boat Festival,端午
|
|
134
|
+
2023-10-05,4,National Day,国庆节
|
|
135
|
+
2023-10-06,5,National Day,国庆节
|
|
136
|
+
2024-02-15,4,Spring Festival,春节
|
|
137
|
+
2024-02-16,5,Spring Festival,春节
|
|
138
|
+
2024-04-05,5,Tomb-sweeping Day,清明
|
|
139
|
+
2024-05-02,4,Labour Day,劳动节
|
|
140
|
+
2024-05-03,5,Labour Day,劳动节
|
|
141
|
+
2024-09-16,1,Mid-autumn Festival,中秋
|
|
142
|
+
2024-10-04,5,National Day,国庆节
|
|
143
|
+
2024-10-07,1,National Day,国庆节
|
|
144
|
+
2025-02-03,1,Spring Festival,春节
|
|
145
|
+
2025-02-04,2,Spring Festival,春节
|
|
146
|
+
2025-05-05,1,Labour Day,劳动节
|
|
147
|
+
2025-10-07,2,National Day,国庆节
|
|
148
|
+
2025-10-08,3,National Day,国庆节
|
|
149
|
+
2026-01-02,5,New Year's Day,元旦
|
|
150
|
+
2026-02-20,5,Spring Festival,春节
|
|
151
|
+
2026-02-23,1,Spring Festival,春节
|
|
152
|
+
2026-05-05,2,Labour Day,劳动节
|
|
153
|
+
2026-10-06,2,National Day,国庆节
|
|
154
|
+
2026-10-07,3,National Day,国庆节
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
workdays in weekends (双休日调休形成的于双休日工作的工作日) since year 2004; weekday: 0 (Sun), 1 (Mon), ... 6 (Sat)
|
|
2
|
+
节假日安排由国务院发布,一般每年11月前后发布,请及时更新数据
|
|
3
|
+
date,week_day,enname,cnname
|
|
4
|
+
2004-01-17,6,Spring Festival,春节
|
|
5
|
+
2004-01-18,0,Spring Festival,春节
|
|
6
|
+
2004-05-08,6,Labour Day,劳动节
|
|
7
|
+
2004-05-09,0,Labour Day,劳动节
|
|
8
|
+
2004-10-09,6,National Day,国庆节
|
|
9
|
+
2004-10-10,0,National Day,国庆节
|
|
10
|
+
2005-02-05,6,Spring Festival,春节
|
|
11
|
+
2005-02-06,0,Spring Festival,春节
|
|
12
|
+
2005-04-30,6,Labour Day,劳动节
|
|
13
|
+
2005-05-08,0,Labour Day,劳动节
|
|
14
|
+
2005-10-08,6,National Day,国庆节
|
|
15
|
+
2005-10-09,0,National Day,国庆节
|
|
16
|
+
2006-01-28,6,Spring Festival,春节
|
|
17
|
+
2006-02-05,0,Spring Festival,春节
|
|
18
|
+
2006-04-29,6,Labour Day,劳动节
|
|
19
|
+
2006-04-30,0,Labour Day,劳动节
|
|
20
|
+
2006-09-30,6,National Day,国庆节
|
|
21
|
+
2006-10-08,0,National Day,国庆节
|
|
22
|
+
2006-12-30,6,New Year's Day,元旦
|
|
23
|
+
2006-12-31,0,New Year's Day,元旦
|
|
24
|
+
2007-02-17,6,Spring Festival,春节
|
|
25
|
+
2007-02-25,0,Spring Festival,春节
|
|
26
|
+
2007-04-28,6,Labour Day,劳动节
|
|
27
|
+
2007-04-29,0,Labour Day,劳动节
|
|
28
|
+
2007-09-29,6,National Day,国庆节
|
|
29
|
+
2007-09-30,0,National Day,国庆节
|
|
30
|
+
2007-12-29,6,New Year's Day,元旦
|
|
31
|
+
2008-02-02,6,Spring Festival,春节
|
|
32
|
+
2008-02-03,0,Spring Festival,春节
|
|
33
|
+
2008-05-04,0,Labour Day,劳动节
|
|
34
|
+
2008-09-27,6,National Day,国庆节
|
|
35
|
+
2008-09-28,0,National Day,国庆节
|
|
36
|
+
2009-01-04,0,New Year's Day,元旦
|
|
37
|
+
2009-01-24,6,Spring Festival,春节
|
|
38
|
+
2009-02-01,0,Spring Festival,春节
|
|
39
|
+
2009-05-31,0,Dragon Boat Festival,端午
|
|
40
|
+
2009-09-27,0,National Day,国庆节
|
|
41
|
+
2009-10-10,6,National Day,国庆节
|
|
42
|
+
2010-02-20,6,Spring Festival,春节
|
|
43
|
+
2010-02-21,0,Spring Festival,春节
|
|
44
|
+
2010-06-12,6,Dragon Boat Festival,端午
|
|
45
|
+
2010-06-13,0,Dragon Boat Festival,端午
|
|
46
|
+
2010-09-19,0,Mid-autumn Festival,中秋
|
|
47
|
+
2010-09-25,6,Mid-autumn Festival,中秋
|
|
48
|
+
2010-09-26,0,National Day,国庆节
|
|
49
|
+
2010-10-09,6,National Day,国庆节
|
|
50
|
+
2011-01-30,0,Spring Festival,春节
|
|
51
|
+
2011-02-12,6,Spring Festival,春节
|
|
52
|
+
2011-04-02,6,Tomb-sweeping Day,清明
|
|
53
|
+
2011-10-08,6,National Day,国庆节
|
|
54
|
+
2011-10-09,0,National Day,国庆节
|
|
55
|
+
2011-12-31,6,New Year's Day,元旦
|
|
56
|
+
2012-01-21,6,Spring Festival,春节
|
|
57
|
+
2012-01-29,0,Spring Festival,春节
|
|
58
|
+
2012-03-31,6,Tomb-sweeping Day,清明
|
|
59
|
+
2012-04-01,0,Tomb-sweeping Day,清明
|
|
60
|
+
2012-04-28,6,Labour Day,劳动节
|
|
61
|
+
2012-09-29,6,National Day,国庆节
|
|
62
|
+
2013-01-05,6,New Year's Day,元旦
|
|
63
|
+
2013-01-06,0,New Year's Day,元旦
|
|
64
|
+
2013-02-16,6,Spring Festival,春节
|
|
65
|
+
2013-02-17,0,Spring Festival,春节
|
|
66
|
+
2013-04-07,0,Tomb-sweeping Day,清明
|
|
67
|
+
2013-04-27,6,Labour Day,劳动节
|
|
68
|
+
2013-04-28,0,Labour Day,劳动节
|
|
69
|
+
2013-06-08,6,Dragon Boat Festival,端午
|
|
70
|
+
2013-06-09,0,Dragon Boat Festival,端午
|
|
71
|
+
2013-09-22,0,Mid-autumn Festival,中秋
|
|
72
|
+
2013-09-29,0,National Day,国庆节
|
|
73
|
+
2013-10-12,6,National Day,国庆节
|
|
74
|
+
2014-01-26,0,Spring Festival,春节
|
|
75
|
+
2014-02-08,6,Spring Festival,春节
|
|
76
|
+
2014-05-04,0,Labour Day,劳动节
|
|
77
|
+
2014-09-28,0,National Day,国庆节
|
|
78
|
+
2014-10-11,6,National Day,国庆节
|
|
79
|
+
2015-01-04,0,New Year's Day,元旦
|
|
80
|
+
2015-02-15,0,Spring Festival,春节
|
|
81
|
+
2015-02-28,6,Spring Festival,春节
|
|
82
|
+
2015-09-06,0,Anti-Fascist 70th Day,中国人民抗日战争暨世界反法西斯战争胜利70周年纪念日
|
|
83
|
+
2015-10-10,6,National Day,国庆节
|
|
84
|
+
2016-02-06,6,Spring Festival,春节
|
|
85
|
+
2016-02-14,0,Spring Festival,春节
|
|
86
|
+
2016-06-12,0,Dragon Boat Festival,端午
|
|
87
|
+
2016-09-18,0,Mid-autumn Festival,中秋
|
|
88
|
+
2016-10-08,6,National Day,国庆节
|
|
89
|
+
2016-10-09,0,National Day,国庆节
|
|
90
|
+
2017-01-22,0,Spring Festival,春节
|
|
91
|
+
2017-02-04,6,Spring Festival,春节
|
|
92
|
+
2017-04-01,6,Tomb-sweeping Day,清明
|
|
93
|
+
2017-05-27,6,Dragon Boat Festival,端午
|
|
94
|
+
2017-09-30,6,National Day,国庆节
|
|
95
|
+
2018-02-11,0,Spring Festival,春节
|
|
96
|
+
2018-02-24,6,Spring Festival,春节
|
|
97
|
+
2018-04-08,0,Tomb-sweeping Day,清明
|
|
98
|
+
2018-04-28,6,Labour Day,劳动节
|
|
99
|
+
2018-09-29,6,National Day,国庆节
|
|
100
|
+
2018-09-30,0,National Day,国庆节
|
|
101
|
+
2018-12-29,6,New Year's Day,元旦
|
|
102
|
+
2019-02-02,6,Spring Festival,春节
|
|
103
|
+
2019-02-03,0,Spring Festival,春节
|
|
104
|
+
2019-04-28,0,Labour Day,劳动节
|
|
105
|
+
2019-05-05,0,Labour Day,劳动节
|
|
106
|
+
2019-09-29,0,National Day,国庆节
|
|
107
|
+
2019-10-12,6,National Day,国庆节
|
|
108
|
+
2020-01-19,0,Spring Festival,春节
|
|
109
|
+
2020-04-26,0,Labour Day,劳动节
|
|
110
|
+
2020-05-09,6,Labour Day,劳动节
|
|
111
|
+
2020-06-28,0,Dragon Boat Festival,端午
|
|
112
|
+
2020-09-27,0,National Day,国庆节
|
|
113
|
+
2020-10-10,6,National Day,国庆节
|
|
114
|
+
2021-02-07,0,Spring Festival,春节
|
|
115
|
+
2021-02-20,6,Spring Festival,春节
|
|
116
|
+
2021-04-25,0,Labour Day,劳动节
|
|
117
|
+
2021-05-08,6,Labour Day,劳动节
|
|
118
|
+
2021-09-18,6,Mid-autumn Festival,中秋
|
|
119
|
+
2021-09-26,0,National Day,国庆节
|
|
120
|
+
2021-10-09,6,National Day,国庆节
|
|
121
|
+
2022-01-29,6,Spring Festival,春节
|
|
122
|
+
2022-01-30,0,Spring Festival,春节
|
|
123
|
+
2022-04-02,6,Tomb-sweeping Day,清明
|
|
124
|
+
2022-04-24,0,Labour Day,劳动节
|
|
125
|
+
2022-05-07,6,Labour Day,劳动节
|
|
126
|
+
2022-10-08,6,National Day,国庆节
|
|
127
|
+
2022-10-09,0,National Day,国庆节
|
|
128
|
+
2023-01-28,6,Spring Festival,春节
|
|
129
|
+
2023-01-29,0,Spring Festival,春节
|
|
130
|
+
2023-04-23,0,Labour Day,劳动节
|
|
131
|
+
2023-05-06,6,Labour Day,劳动节
|
|
132
|
+
2023-06-25,0,Dragon Boat Festival,端午
|
|
133
|
+
2023-10-07,6,National Day,国庆节
|
|
134
|
+
2023-10-08,0,National Day,国庆节
|
|
135
|
+
2024-02-04,0,Spring Festival,春节
|
|
136
|
+
2024-02-18,0,Spring Festival,春节
|
|
137
|
+
2024-04-07,0,Tomb-sweeping Day,清明
|
|
138
|
+
2024-04-28,0,Labour Day,劳动节
|
|
139
|
+
2024-05-11,6,Labour Day,劳动节
|
|
140
|
+
2024-09-14,6,Mid-autumn Festival,中秋
|
|
141
|
+
2024-09-29,0,National Day,国庆节
|
|
142
|
+
2024-10-12,6,National Day,国庆节
|
|
143
|
+
2025-01-26,0,Spring Festival,春节
|
|
144
|
+
2025-02-08,6,Spring Festival,春节
|
|
145
|
+
2025-04-27,0,Labour Day,劳动节
|
|
146
|
+
2025-09-28,0,National Day,国庆节
|
|
147
|
+
2025-10-11,6,National Day,国庆节
|
|
148
|
+
2026-01-04,0,New Year's Day,元旦
|
|
149
|
+
2026-02-14,6,Spring Festival,春节
|
|
150
|
+
2026-02-28,6,Spring Festival,春节
|
|
151
|
+
2026-05-09,6,Labour Day,劳动节
|
|
152
|
+
2026-09-20,0,National Day,国庆节
|
|
153
|
+
2026-10-10,6,National Day,国庆节
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cnexchcal
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Exchange Calendars: issession, trade_date_range
|
|
5
|
+
Author-email: rhozhang <rhozhang@163.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/rhozhang/cnexchcal
|
|
8
|
+
Project-URL: Issues, https://github.com/rhozhang/cnexchcal/issues
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.12
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: polars
|
|
15
|
+
Dynamic: license-file
|
|
16
|
+
|
|
17
|
+
# Holidays in China
|
|
18
|
+
|
|
19
|
+
## Background
|
|
20
|
+
|
|
21
|
+
We classify calendar days into:
|
|
22
|
+
|
|
23
|
+
- regular workdays
|
|
24
|
+
- regular weekends (Saturday and Sunday) not working
|
|
25
|
+
- festivals: true or legal holidays
|
|
26
|
+
- quasi-holidays: extra holidays swapped with weekend workdays
|
|
27
|
+
- weekend workdays:workdays in weekends for swapped extra holidays
|
|
28
|
+
|
|
29
|
+
For example, 2025-12-31 (Wednesday) is a regular workday.
|
|
30
|
+
|
|
31
|
+
2025-01-01 (Thursday) is a festival holiday (New Year)
|
|
32
|
+
|
|
33
|
+
2025-01-02 (Friday) is a quasi-holiday, though we need not to work on this day, but we need to work on 2026-01-04 (Sunday) to swap with this extra holiday.
|
|
34
|
+
|
|
35
|
+
2025-01-03 (Saturday) is a regular weekend.
|
|
36
|
+
|
|
37
|
+
2025-01-04 (Sunday) is a weekend workday. Though it a weekend, but we to work on this day to swap with extra extra holiday on 2025-01-02.
|
|
38
|
+
|
|
39
|
+
On weekend workdays, exchanges in China mainland are closed, although they are workdays.
|
|
40
|
+
|
|
41
|
+
In November each year, the state council of China announces the holiday arrangement for next year. Please update the holiday data accordingly.
|
|
42
|
+
|
|
43
|
+
## cnexchcal Package
|
|
44
|
+
|
|
45
|
+
This package provides a class to handle holidays and trading days in China mainland since year 2004. We does not touch holidays before 2004.
|
|
46
|
+
|
|
47
|
+
### Installation
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
pip install cnexchcal
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Usage
|
|
54
|
+
|
|
55
|
+
**Instantiation**:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
from cnexchcal import ExchCal
|
|
59
|
+
cal = ExchCal()
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
To return holiday names in Chinese or English
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
cal.holiday_cnnames
|
|
66
|
+
cal.holiday_ennames
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
To determine if a given date is a holiday or workday, uese:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
cal.isholiday('2026-01-04') # False
|
|
73
|
+
cal.isworkday('2026-01-04') # True
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
To determine if a given date is a trading day:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
cal.issession('2026-01-04') # False
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
To get the previous trading day, use:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
cal.previoussession('2026-01-04') # 2025-12-31
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
To get the next trading day, use:
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
cal.nextsession('2026-01-01') # 2026-01-05
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
To get the n-th trading day after a given date, use:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
cal.next_nth_tradingday('2026-01-01', 3) # 2026-01-07
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
To get all trading dates between two given dates, use:
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
cal.trade_date_range('2025-12-20', '2026-02-28')
|
|
104
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
cnexchcal/__init__.py,sha256=20gXKRE8QFFrJiIDsI7GQgzXgRTXvMAWHpbWd_sPRxs,7233
|
|
2
|
+
cnexchcal/asset/extra_holidays.csv,sha256=RVzbjvBiAjzNWG9WWJ2WF6P3yMBglIGfqPIRrIogvQM,260
|
|
3
|
+
cnexchcal/asset/festivals.csv,sha256=KidVzbPPvzLujmLPZ6SNEwhSjkBZFHfANK7YrgPpjmA,9617
|
|
4
|
+
cnexchcal/asset/quasi_holidays.csv,sha256=R51aum52Nk0by95_D_BVIsnQ7igqNQgZRjcTEG4jC6g,5775
|
|
5
|
+
cnexchcal/asset/weekend_workdays.csv,sha256=Tab-jOsJqknLHSONVcQXwV4sudDuhThIWDOjfZR66Fw,5745
|
|
6
|
+
cnexchcal-0.2.0.dist-info/licenses/LICENSE,sha256=JFbY5Il4KtG4sBGRX8oWh0NWBLINbIQ4-OyMypndAsY,1065
|
|
7
|
+
cnexchcal-0.2.0.dist-info/METADATA,sha256=QSJMb5Xw3huKARsqj75EE27fmnqpYZ4iINv3WyM5HPI,2687
|
|
8
|
+
cnexchcal-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
+
cnexchcal-0.2.0.dist-info/top_level.txt,sha256=_Lq7KZO5X7tbgt1izKmLVgbuC4hXXFZSNRMZT8McTKE,10
|
|
10
|
+
cnexchcal-0.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 RhoZhang
|
|
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 @@
|
|
|
1
|
+
cnexchcal
|