siat 3.8.27__py3-none-any.whl → 3.8.28__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.
- siat/valuation_china.py +32 -10
- {siat-3.8.27.dist-info → siat-3.8.28.dist-info}/METADATA +2 -10
- {siat-3.8.27.dist-info → siat-3.8.28.dist-info}/RECORD +6 -6
- {siat-3.8.27.dist-info → siat-3.8.28.dist-info}/WHEEL +1 -1
- {siat-3.8.27.dist-info → siat-3.8.28.dist-info}/LICENSE +0 -0
- {siat-3.8.27.dist-info → siat-3.8.28.dist-info}/top_level.txt +0 -0
siat/valuation_china.py
CHANGED
@@ -123,7 +123,13 @@ def get_valuation_market_china(start,end,measure='pe',method='lyr',value='value'
|
|
123
123
|
mp['Date']=mp['date']
|
124
124
|
mp.sort_values(by=['Date'],ascending=True,inplace=True)
|
125
125
|
mp.set_index(['Date'],inplace=True)
|
126
|
-
|
126
|
+
|
127
|
+
try:
|
128
|
+
mp1=mp[(mp.index >= startpd) & (mp.index <=endpd)]
|
129
|
+
except:
|
130
|
+
startpd=startpd.date()
|
131
|
+
endpd=endpd.date()
|
132
|
+
mp1=mp[(mp.index >= startpd) & (mp.index <=endpd)]
|
127
133
|
|
128
134
|
mp9=mp1[['date',field,'close']]
|
129
135
|
mp9['field']=mp9[field]
|
@@ -149,7 +155,13 @@ def get_valuation_market_china(start,end,measure='pe',method='lyr',value='value'
|
|
149
155
|
mp['Date']=mp['date']
|
150
156
|
mp.sort_values(by=['Date'],ascending=True,inplace=True)
|
151
157
|
mp.set_index(['Date'],inplace=True)
|
152
|
-
|
158
|
+
|
159
|
+
try:
|
160
|
+
mp1=mp[(mp.index >= startpd) & (mp.index <=endpd)]
|
161
|
+
except:
|
162
|
+
startpd=startpd.date()
|
163
|
+
endpd=endpd.date()
|
164
|
+
mp1=mp[(mp.index >= startpd) & (mp.index <=endpd)]
|
153
165
|
|
154
166
|
mp9=mp1[['date',field,'close']]
|
155
167
|
mp9['field']=mp9[field]
|
@@ -177,20 +189,27 @@ if __name__ =="__main__":
|
|
177
189
|
measures='pe'; methods=['lyr','ttm']; values='value'; statistics='median'
|
178
190
|
|
179
191
|
|
180
|
-
def valuation_market_china(start,end,measures=['pe','pb'], \
|
192
|
+
def valuation_market_china(start='MRY',end='today',measures=['pe','pb'], \
|
181
193
|
methods='lyr',values='value',statistics='median', \
|
182
194
|
twinx=False,loc1='best',loc2='best'):
|
183
195
|
"""
|
196
|
+
===========================================================================
|
184
197
|
功能:比较中国全A股市场的估值指标变化趋势
|
185
|
-
|
186
|
-
|
187
|
-
end:
|
198
|
+
start: 开始日期,格式YYYY-MM-DD。
|
199
|
+
或者简写版,例如'MRY'近1年、'L3Y'表示近3年等。
|
200
|
+
end: 结束日期,默认今天。
|
201
|
+
|
188
202
|
measures: 估值指标市盈率'pe'或市净率'pb',不支持股息率
|
189
203
|
methods: 滚动'ttm/静态取样'lyr'.
|
190
204
|
values: 直接采用估值指标数值'value'或分位数'quantile'
|
191
205
|
statistics: 采用中位数'median'或等权均值'equal-weighted'
|
192
|
-
|
206
|
+
twinx:是否使用双轴绘图法,默认否False。
|
207
|
+
如果同时选择了市盈率'pe'或市净率'pb',建议打开该选项True。
|
208
|
+
loc1/loc2:图例1/2的位置,默认自动决定'best'。
|
209
|
+
如果自动位置不理想,可以手动设置位置。
|
193
210
|
"""
|
211
|
+
#处理日期
|
212
|
+
start,end=start_end_preprocess(start,end)
|
194
213
|
|
195
214
|
#解析比较的指标,以第一个双指标为准
|
196
215
|
found2=False
|
@@ -222,7 +241,7 @@ def valuation_market_china(start,end,measures=['pe','pb'], \
|
|
222
241
|
found2=True
|
223
242
|
|
224
243
|
if not found2:
|
225
|
-
print(" #Warning(valuation_market_china):
|
244
|
+
print(" #Warning(valuation_market_china):parameters mismatch among",parmlist)
|
226
245
|
#return None,None
|
227
246
|
"""
|
228
247
|
print("measures1=",measures1,"measures2=",measures2)
|
@@ -235,6 +254,9 @@ def valuation_market_china(start,end,measures=['pe','pb'], \
|
|
235
254
|
ylabeltxt='估值比率'
|
236
255
|
else:
|
237
256
|
ylabeltxt='分位数'
|
257
|
+
|
258
|
+
print(" Working on valuating China stock market ... ...")
|
259
|
+
|
238
260
|
titletxt='中国全A股市场估值的变化趋势'
|
239
261
|
|
240
262
|
import datetime
|
@@ -244,7 +266,7 @@ def valuation_market_china(start,end,measures=['pe','pb'], \
|
|
244
266
|
#获取指标1
|
245
267
|
df1=get_valuation_market_china(start,end,measure=measures1,method=methods1,value=values1,statistic=statistics1)
|
246
268
|
if df1 is None:
|
247
|
-
print(" #Error(valuation_market_china):no data available for the
|
269
|
+
print(" #Error(valuation_market_china):no data available for the combine of",measures1,methods1,values1,statistics1)
|
248
270
|
return None,None
|
249
271
|
|
250
272
|
ticker1=df1['desc'].values[0]
|
@@ -260,7 +282,7 @@ def valuation_market_china(start,end,measures=['pe','pb'], \
|
|
260
282
|
#获取指标2
|
261
283
|
df2=get_valuation_market_china(start,end,measure=measures2,method=methods2,value=values2,statistic=statistics2)
|
262
284
|
if df2 is None:
|
263
|
-
print(" #Error(valuation_market_china):
|
285
|
+
print(" #Error(valuation_market_china):data unavailable for the combine of",measures2,methods2,values2,statistics2)
|
264
286
|
return None,None
|
265
287
|
|
266
288
|
ticker2=df2['desc'].values[0]
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.1
|
2
2
|
Name: siat
|
3
|
-
Version: 3.8.
|
3
|
+
Version: 3.8.28
|
4
4
|
Summary: Securities Investment Analysis Tools (siat)
|
5
5
|
Home-page: https://pypi.org/project/siat/
|
6
6
|
Author: Prof. WANG Dehong, International Business School, Beijing Foreign Studies University
|
@@ -40,14 +40,6 @@ Requires-Dist: translators
|
|
40
40
|
Requires-Dist: nbconvert
|
41
41
|
Requires-Dist: ipywidgets
|
42
42
|
Requires-Dist: playwright
|
43
|
-
Dynamic: author
|
44
|
-
Dynamic: author-email
|
45
|
-
Dynamic: description
|
46
|
-
Dynamic: description-content-type
|
47
|
-
Dynamic: home-page
|
48
|
-
Dynamic: license
|
49
|
-
Dynamic: requires-dist
|
50
|
-
Dynamic: summary
|
51
43
|
|
52
44
|
|
53
45
|
# What is siat?
|
@@ -140,12 +140,12 @@ siat/translate_20240606.py,sha256=63IyHWEU3Uz9mjwyuAX3fqY4nUMdwh0ICQAgmgPXP7Y,21
|
|
140
140
|
siat/translate_241003_keep.py,sha256=un7Fqe1v35MXsja5exZgjmLzrZtt66NARZIGlyFuGGU,218747
|
141
141
|
siat/universal_test.py,sha256=CDAOffW1Rvs-TcNN5giWVvHMlch1w4dp-w5SIV9jXL0,3936
|
142
142
|
siat/valuation.py,sha256=K7epQC_UtELjRR5cyjJp4gskSyJMxXy-jHIAS0SUEj8,51801
|
143
|
-
siat/valuation_china.py,sha256=
|
143
|
+
siat/valuation_china.py,sha256=izg7EhnkZkHQQuVmkLTvPdOETJgQ8epAeEmQVBOEg1g,70607
|
144
144
|
siat/valuation_market_china_test.py,sha256=gbJ0ioauuo4koTPH6WKUkqcXiQPafnbhU5eKJ6lpdLA,1571
|
145
145
|
siat/var_model_validation.py,sha256=R0caWnuZarrRg9939hxh3vJIIpIyPfvelYmzFNZtPbo,14910
|
146
146
|
siat/yf_name.py,sha256=laNKMTZ9hdenGX3IZ7G0a2RLBKEWtUQJFY9CWuk_fp8,24058
|
147
|
-
siat-3.8.
|
148
|
-
siat-3.8.
|
149
|
-
siat-3.8.
|
150
|
-
siat-3.8.
|
151
|
-
siat-3.8.
|
147
|
+
siat-3.8.28.dist-info/LICENSE,sha256=NTEMMROY9_4U1szoKC3N2BLHcDd_o5uTgqdVH8tbApw,1071
|
148
|
+
siat-3.8.28.dist-info/METADATA,sha256=-znpXFY93SnCc5fC9dnEraPjh_vwbitlZSkqjwkGpTo,8144
|
149
|
+
siat-3.8.28.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
150
|
+
siat-3.8.28.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
|
151
|
+
siat-3.8.28.dist-info/RECORD,,
|
File without changes
|
File without changes
|