siat 3.10.125__py3-none-any.whl → 3.10.126__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/common.py +106 -2
- siat/exchange_bond_china.pickle +0 -0
- siat/fund_china.pickle +0 -0
- siat/stock.py +10 -2
- siat/stock_info.pickle +0 -0
- {siat-3.10.125.dist-info → siat-3.10.126.dist-info}/METADATA +234 -226
- siat-3.10.126.dist-info/RECORD +76 -0
- {siat-3.10.125.dist-info → siat-3.10.126.dist-info}/WHEEL +1 -1
- {siat-3.10.125.dist-info → siat-3.10.126.dist-info/licenses}/LICENSE +0 -0
- {siat-3.10.125.dist-info → siat-3.10.126.dist-info}/top_level.txt +0 -0
- siat/__init__ -20240701.py +0 -65
- siat/__init__.py.backup_20250214.py +0 -73
- siat/alpha_vantage_test.py +0 -24
- siat/assets_liquidity_test.py +0 -44
- siat/barrons_scraping_test.py +0 -276
- siat/beta_adjustment_test.py +0 -77
- siat/bond_test.py +0 -142
- siat/capm_beta_test.py +0 -49
- siat/cmat_commons.py +0 -961
- siat/compare_cross_test.py +0 -117
- siat/concepts_iwencai.py +0 -86
- siat/concepts_kpl.py +0 -93
- siat/cryptocurrency_test.py +0 -71
- siat/derivative.py +0 -1111
- siat/economy-20230125.py +0 -1206
- siat/economy_test.py +0 -360
- siat/esg_test.py +0 -63
- siat/fama_french_test.py +0 -115
- siat/financial_statements_test.py +0 -31
- siat/financials2 - /321/205/320/231/320/277/321/206/320/254/320/274.py" +0 -341
- siat/financials_china2_test.py +0 -67
- siat/financials_china2_test2.py +0 -88
- siat/financials_china2_test3.py +0 -87
- siat/financials_china_test.py +0 -475
- siat/financials_china_test2.py +0 -197
- siat/financials_china_test2_fin_indicator.py +0 -197
- siat/financials_test.py +0 -713
- siat/fred_test.py +0 -40
- siat/fund_china_test.py +0 -175
- siat/fund_test.py +0 -40
- siat/future_china_test.py +0 -37
- siat/global_index_test.py +0 -66
- siat/grafix_test.py +0 -112
- siat/holding_risk_test.py +0 -13
- siat/local_debug_test.py +0 -100
- siat/markowitz2-20240620.py +0 -2614
- siat/markowitz_ccb_test.py +0 -37
- siat/markowitz_ef_test.py +0 -136
- siat/markowitz_old.py +0 -871
- siat/markowitz_simple-20230709.py +0 -370
- siat/markowitz_test.py +0 -164
- siat/markowitz_test2.py +0 -69
- siat/ml_cases_example1.py +0 -60
- siat/option_china_test.py +0 -447
- siat/option_pricing_test.py +0 -81
- siat/option_sina_api_test.py +0 -112
- siat/proxy_test.py +0 -84
- siat/quandl_test.py +0 -39
- siat/risk_adjusted_return_test.py +0 -81
- siat/risk_evaluation_test.py +0 -96
- siat/risk_free_rate_test.py +0 -127
- siat/sector_china_test.py +0 -203
- siat/security_price.py +0 -831
- siat/security_prices_test.py +0 -310
- siat/security_trend2-20240620.py +0 -493
- siat/setup.py +0 -41
- siat/shenwan index history test.py +0 -41
- siat/stock_china_test.py +0 -38
- siat/stock_info_test.py +0 -189
- siat/stock_list_china_test.py +0 -33
- siat/stock_technical-20240620.py +0 -2736
- siat/stock_test.py +0 -487
- siat/temp.py +0 -36
- siat/test2_graphviz.py +0 -484
- siat/test_graphviz.py +0 -411
- siat/test_markowitz_simple.py +0 -198
- siat/test_markowitz_simple_revised.py +0 -215
- siat/test_markowitz_simple_revised2.py +0 -218
- siat/transaction_test.py +0 -436
- siat/translate-20230125.py +0 -2107
- siat/translate-20230206.py +0 -2109
- siat/translate-20230215.py +0 -2158
- siat/translate_20240606.py +0 -4206
- siat/translate_241003_keep.py +0 -4300
- siat/universal_test.py +0 -100
- siat/valuation_market_china_test.py +0 -36
- siat-3.10.125.dist-info/RECORD +0 -152
@@ -1,341 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
"""
|
3
|
-
本模块功能:计算财务报表比例,应用层
|
4
|
-
所属工具包:证券投资分析工具SIAT
|
5
|
-
SIAT:Security Investment Analysis Tool
|
6
|
-
创建日期:2023年11月23日
|
7
|
-
最新修订日期:2023年11月23日
|
8
|
-
作者:王德宏 (WANG Dehong, Peter)
|
9
|
-
作者单位:北京外国语大学国际商学院
|
10
|
-
作者邮件:wdehong2000@163.com
|
11
|
-
版权所有:王德宏
|
12
|
-
用途限制:仅限研究与教学使用,不可商用!商用需要额外授权。
|
13
|
-
特别声明:作者不对使用本工具进行证券投资导致的任何损益负责!
|
14
|
-
"""
|
15
|
-
#==============================================================================
|
16
|
-
#关闭所有警告
|
17
|
-
import warnings; warnings.filterwarnings('ignore')
|
18
|
-
#==============================================================================
|
19
|
-
#本模块的公共引用
|
20
|
-
from siat.common import *
|
21
|
-
from siat.translate import *
|
22
|
-
from siat.financial_statements import *
|
23
|
-
from siat.financials import *
|
24
|
-
from siat.grafix import *
|
25
|
-
#==============================================================================
|
26
|
-
import matplotlib.pyplot as plt
|
27
|
-
|
28
|
-
plt.rcParams['figure.figsize']=(12.8,7.2)
|
29
|
-
plt.rcParams['figure.dpi']=300
|
30
|
-
plt.rcParams['font.size'] = 13
|
31
|
-
plt.rcParams['xtick.labelsize']=11 #横轴字体大小
|
32
|
-
plt.rcParams['ytick.labelsize']=11 #纵轴字体大小
|
33
|
-
|
34
|
-
title_txt_size=16
|
35
|
-
ylabel_txt_size=14
|
36
|
-
xlabel_txt_size=14
|
37
|
-
legend_txt_size=14
|
38
|
-
|
39
|
-
#设置绘图风格:网格虚线
|
40
|
-
plt.rcParams['axes.grid']=True
|
41
|
-
#plt.rcParams['grid.color']='steelblue'
|
42
|
-
#plt.rcParams['grid.linestyle']='dashed'
|
43
|
-
#plt.rcParams['grid.linewidth']=0.5
|
44
|
-
#plt.rcParams['axes.facecolor']='whitesmoke'
|
45
|
-
|
46
|
-
#处理绘图汉字乱码问题
|
47
|
-
import sys; czxt=sys.platform
|
48
|
-
if czxt in ['win32','win64']:
|
49
|
-
plt.rcParams['font.sans-serif'] = ['SimHei'] # 设置默认字体
|
50
|
-
mpfrc={'font.family': 'SimHei'}
|
51
|
-
|
52
|
-
if czxt in ['darwin']: #MacOSX
|
53
|
-
plt.rcParams['font.family']= ['Heiti TC']
|
54
|
-
mpfrc={'font.family': 'Heiti TC'}
|
55
|
-
|
56
|
-
if czxt in ['linux']: #website Jupyter
|
57
|
-
plt.rcParams['font.family']= ['Heiti TC']
|
58
|
-
mpfrc={'font.family':'Heiti TC'}
|
59
|
-
|
60
|
-
# 解决保存图像时'-'显示为方块的问题
|
61
|
-
plt.rcParams['axes.unicode_minus'] = False
|
62
|
-
#==============================================================================
|
63
|
-
if __name__=='__main__':
|
64
|
-
tickers=["JD","00700.HK",'BABA','09999.HK']
|
65
|
-
fsdates='2022-12-31'
|
66
|
-
|
67
|
-
analysis_type='Balance Sheet'
|
68
|
-
analysis_type='Income Statement'
|
69
|
-
analysis_type='Cash Flow Statement'
|
70
|
-
|
71
|
-
fs_analysis(tickers,fsdates,analysis_type='balance sheet')
|
72
|
-
fs_analysis(tickers,fsdates,analysis_type='income statement')
|
73
|
-
fs_analysis(tickers,fsdates,analysis_type='cash flow statement')
|
74
|
-
|
75
|
-
tickers=["000002.SZ","600266.SS",'600383.SS','600048.SS']
|
76
|
-
fsdates=['2021-12-31','2020-12-31','2019-12-31','2018-12-31']
|
77
|
-
fs_analysis(tickers,fsdates,analysis_type='fs summary')
|
78
|
-
fs_analysis(tickers,fsdates,analysis_type='financial indicator')
|
79
|
-
|
80
|
-
tickers='00700.HK'
|
81
|
-
analysis_type='profile'
|
82
|
-
category='profile'
|
83
|
-
fs_analysis(tickers,fsdates,analysis_type='profile')
|
84
|
-
fs_analysis(tickers,fsdates,analysis_type='profile',category='shareholder')
|
85
|
-
fs_analysis(tickers,fsdates,analysis_type='profile',category='dividend')
|
86
|
-
fs_analysis(tickers,fsdates,analysis_type='profile',category='business')
|
87
|
-
fs_analysis(tickers,fsdates,analysis_type='profile',category='business',business_period='annual')
|
88
|
-
fs_analysis(tickers,fsdates,analysis_type='profile',category='valuation')
|
89
|
-
fs_analysis(tickers,fsdates,analysis_type='profile',category='financial')
|
90
|
-
|
91
|
-
def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
92
|
-
category='profile',business_period='annual', \
|
93
|
-
printout=True,gview=False, \
|
94
|
-
loc1='upper left',loc2='upper right', \
|
95
|
-
):
|
96
|
-
"""
|
97
|
-
功能:tickers为股票列表,fsdates为财报日期,可为单个日期或日期列表
|
98
|
-
注意1:仅从雅虎财经获取数据
|
99
|
-
注意2:不同经济体上市公司报表币种可能不同,金额项目仅进行同公司对比,不进行公司间对比
|
100
|
-
注意3:公司间仅对比财务比率
|
101
|
-
注意4:不同经济体上市公司年报季报日期不同,需要列示报表日期和类型(年报或季报)
|
102
|
-
|
103
|
-
business_period:取季报'quarterly',年报'annual',最近的6次报告'recent'
|
104
|
-
"""
|
105
|
-
|
106
|
-
# 统一转小写,便于判断
|
107
|
-
analysis_type1=analysis_type.lower()
|
108
|
-
|
109
|
-
import datetime as dt
|
110
|
-
todaydt=dt.date.today().strftime('%Y-%m-%d')
|
111
|
-
|
112
|
-
million=1000000
|
113
|
-
billion=million * 1000
|
114
|
-
|
115
|
-
if ('profile' in analysis_type1):
|
116
|
-
# 股票需为单只股票,若为列表则仅取第一个
|
117
|
-
if not isinstance(tickers,str):
|
118
|
-
if isinstance(tickers,list): tickers=tickers[0]
|
119
|
-
else:
|
120
|
-
print(" #Warning(fs_analysis_china): must be one ticker or first ticker in a list for",tickers)
|
121
|
-
return
|
122
|
-
|
123
|
-
# 检查category
|
124
|
-
category_list=['profile','officers','market_rates','dividend','stock_split','fin_rates','risk_general','risk_esg']
|
125
|
-
if category not in category_list:
|
126
|
-
print(" Unsupported category:",category,"\b. Supported categories as follows:")
|
127
|
-
print_list(category_list,leading_blanks=2)
|
128
|
-
|
129
|
-
if category == 'profile':
|
130
|
-
info=get_stock_profile(ticker)
|
131
|
-
elif category == 'dividend':
|
132
|
-
info=stock_dividend(ticker,fromdate='1990-1-1',todate=todaydt)
|
133
|
-
elif category == 'stock_split':
|
134
|
-
info=stock_split(ticker,fromdate='1990-1-1',todate=todaydt)
|
135
|
-
else:
|
136
|
-
info=get_stock_profile(ticker,info_type=category)
|
137
|
-
|
138
|
-
return
|
139
|
-
|
140
|
-
elif ('balance' in analysis_type1) or ('sheet' in analysis_type1) \
|
141
|
-
or ('asset' in analysis_type1) or ('liability' in analysis_type1):
|
142
|
-
# 股票需为单只股票,若为列表则仅取第一个
|
143
|
-
if not isinstance(tickers,str):
|
144
|
-
if isinstance(tickers,list): tickers=tickers[0]
|
145
|
-
else:
|
146
|
-
print(" #Warning(fs_analysis_china): must be one ticker or first ticker in a list for",tickers)
|
147
|
-
return
|
148
|
-
|
149
|
-
# 分析资产负债表
|
150
|
-
fsdf=get_balance_sheet(symbol=tickers)
|
151
|
-
|
152
|
-
fsdf['reportDate']=fsdf['asOfDate'].apply(lambda x: x.strftime('%Y-%m-%d'))
|
153
|
-
fsdf.set_index('reportDate',inplace=True)
|
154
|
-
fsdf.fillna(0,inplace=True)
|
155
|
-
|
156
|
-
fsdf2=fsdf.copy()
|
157
|
-
collist=list(fsdf2)
|
158
|
-
for c in collist:
|
159
|
-
try:
|
160
|
-
fsdf2[c]=round(fsdf2[c] / billion,2)
|
161
|
-
except:
|
162
|
-
continue
|
163
|
-
|
164
|
-
# 变换年报/季报
|
165
|
-
fsdf2['periodType']=fsdf2['periodType'].apply(lambda x: 'Annual' if x=='12M' else 'Quarterly')
|
166
|
-
|
167
|
-
# 删除不用的列
|
168
|
-
currency=fsdf2['currencyCode'].values[0]
|
169
|
-
droplist=['currencyCode','TA-TL-TE','asOfDate']
|
170
|
-
fsdf2.drop(droplist,axis=1,inplace=True)
|
171
|
-
|
172
|
-
# 打印前处理
|
173
|
-
if printout:
|
174
|
-
# 降序排列
|
175
|
-
fsdf3=fsdf2.sort_index(ascending=False)
|
176
|
-
|
177
|
-
business_period=business_period.lower()
|
178
|
-
if business_period == 'recent':
|
179
|
-
fsdf4=fsdf3.head(6)
|
180
|
-
elif business_period == 'quarterly':
|
181
|
-
fsdf4=fsdf3[fsdf3['periodType']=='Quarterly']
|
182
|
-
elif business_period == 'annual':
|
183
|
-
fsdf4=fsdf3[fsdf3['periodType']=='Annual']
|
184
|
-
# 转置
|
185
|
-
fsdf4=fsdf4.T
|
186
|
-
|
187
|
-
fsdf4.replace(0,'---',inplace=True)
|
188
|
-
|
189
|
-
titletxt="\n***** "+codetranslate(tickers)+": BALANCE SHEET"+" (In unit of "+currency+" billion"+') *****'
|
190
|
-
print(titletxt)
|
191
|
-
"""
|
192
|
-
tablefmt_list=["plain","simple","github","grid","simple_grid","rounded_grid", \
|
193
|
-
"heavy_grid","mixed_grid","double_grid","fancy_grid","outline", \
|
194
|
-
"simple_outline","rounded_outline","heavy_outline", \
|
195
|
-
"mixed_outline","double_outline","fancy_outline","pipe", \
|
196
|
-
"orgtbl","asciidoc","jira","presto","pretty","psql", \
|
197
|
-
"rst","mediawiki","moinmoin","youtrack","html","unsafehtml", \
|
198
|
-
"latex","latex_raw","latex_booktabs","latex_longtable", \
|
199
|
-
"textile","tsv"]
|
200
|
-
for t in tablefmt_list:
|
201
|
-
print("\n\n ========== tablefmt: "+t+" ============\n")
|
202
|
-
alignlist=['left']+['right']*(len(list(fsdf3))-1)
|
203
|
-
print(fsdf3.to_markdown(tablefmt=t,index=True,colalign=alignlist))
|
204
|
-
"""
|
205
|
-
#print(fsdf3)
|
206
|
-
"""
|
207
|
-
collist=list(fsdf3)
|
208
|
-
fsdf3['Item']=fsdf3.index
|
209
|
-
fsdf4=fsdf3[['Item']+collist]
|
210
|
-
pandas2prettytable(fsdf4,titletxt,firstColSpecial=False,leftColAlign='l',otherColAlign='r')
|
211
|
-
"""
|
212
|
-
|
213
|
-
alignlist=['left']+['right']*(len(list(fsdf4))-1)
|
214
|
-
print(fsdf4.to_markdown(tablefmt='plain',index=True,colalign=alignlist))
|
215
|
-
|
216
|
-
footnote="\n*** Data source: Yahoo Finance, "+todaydt
|
217
|
-
print(footnote)
|
218
|
-
|
219
|
-
return
|
220
|
-
|
221
|
-
elif ('income' in analysis_type1) or ('cost' in analysis_type1) \
|
222
|
-
or ('expense' in analysis_type1) or ('earning' in analysis_type1):
|
223
|
-
# 检查股票列表
|
224
|
-
if not isinstance(tickers,list):
|
225
|
-
tickers=[tickers]
|
226
|
-
|
227
|
-
if not isinstance(fsdates,list):
|
228
|
-
fsdates=gen_yoy_dates(fsdates,num=4)
|
229
|
-
|
230
|
-
# 分析利润表
|
231
|
-
income_cost_china(tickers,fsdates)
|
232
|
-
return
|
233
|
-
|
234
|
-
elif ('cash' in analysis_type1) or ('flow' in analysis_type1):
|
235
|
-
# 检查股票列表
|
236
|
-
if not isinstance(tickers,list):
|
237
|
-
tickers=[tickers]
|
238
|
-
|
239
|
-
if not isinstance(fsdates,list):
|
240
|
-
fsdates=gen_yoy_dates(fsdates,num=4)
|
241
|
-
|
242
|
-
# 分析现金流量表
|
243
|
-
cash_flow_china(tickers,fsdates)
|
244
|
-
return
|
245
|
-
|
246
|
-
elif ('summary' in analysis_type1):
|
247
|
-
# 股票可为单只股票(单只股票深度分析)或股票列表(多只股票对比)
|
248
|
-
# 检查股票
|
249
|
-
if isinstance(tickers,str):
|
250
|
-
if not isinstance(fsdates,list):
|
251
|
-
fsdates=gen_yoy_dates(fsdates,num=4)
|
252
|
-
"""
|
253
|
-
print(" #Warning(fs_analysis_china): must be date list for",fsdates)
|
254
|
-
return
|
255
|
-
"""
|
256
|
-
|
257
|
-
# 检查股票列表
|
258
|
-
if isinstance(tickers,list):
|
259
|
-
if not isinstance(fsdates,str):
|
260
|
-
fsdates=fsdates[0]
|
261
|
-
"""
|
262
|
-
print(" #Warning(fs_analysis_china): must be a date for",fsdates)
|
263
|
-
return
|
264
|
-
"""
|
265
|
-
|
266
|
-
# 分析财报摘要
|
267
|
-
from siat.financials_china import compare_fin_summary_china
|
268
|
-
df_summary=compare_fin_summary_china(tickers,fsdates)
|
269
|
-
return
|
270
|
-
|
271
|
-
elif ('indicator' in analysis_type1):
|
272
|
-
# 股票可为单只股票(单只股票深度分析)或股票列表(多只股票对比)
|
273
|
-
# 检查股票
|
274
|
-
if isinstance(tickers,str):
|
275
|
-
if not isinstance(fsdates,list):
|
276
|
-
fsdates=gen_yoy_dates(fsdates,num=4)
|
277
|
-
"""
|
278
|
-
print(" #Warning(fs_analysis_china): must be date list for",fsdates)
|
279
|
-
return
|
280
|
-
"""
|
281
|
-
|
282
|
-
# 检查股票列表
|
283
|
-
if isinstance(tickers,list):
|
284
|
-
if not isinstance(fsdates,str):
|
285
|
-
fsdates=fsdates[0]
|
286
|
-
"""
|
287
|
-
print(" #Warning(fs_analysis_china): must be a date for",fsdates)
|
288
|
-
return
|
289
|
-
"""
|
290
|
-
|
291
|
-
# 分析主要财务指标和比率
|
292
|
-
from siat.financials_china import compare_fin_indicator_china
|
293
|
-
df_ind=compare_fin_indicator_china(tickers,fsdates)
|
294
|
-
return
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
elif ('dupont' in analysis_type1) and (('identity' in analysis_type1) or ('analysis' in analysis_type1)):
|
299
|
-
# 股票需为股票列表
|
300
|
-
if not isinstance(tickers,list):
|
301
|
-
print(" #Warning(fs_analysis_china): must be ticker list for",tickers)
|
302
|
-
return
|
303
|
-
# 日期需为一个日期
|
304
|
-
if not isinstance(fsdates,str):
|
305
|
-
fsdates=fsdates[0]
|
306
|
-
"""
|
307
|
-
print(" #Warning(fs_analysis_china): must one date for",fsdates)
|
308
|
-
return
|
309
|
-
"""
|
310
|
-
|
311
|
-
# 多只股票的杜邦分析对比
|
312
|
-
from siat.financials_china import compare_dupont_china
|
313
|
-
df_db=compare_dupont_china(tickers,fsdate=fsdates,printout=printout)
|
314
|
-
return
|
315
|
-
|
316
|
-
elif ('dupont' in analysis_type1) and ('decompose' in analysis_type1):
|
317
|
-
# 股票需为单只股票列表
|
318
|
-
if not isinstance(tickers,str):
|
319
|
-
print(" #Warning(fs_analysis_china): must be one ticker for",tickers)
|
320
|
-
return
|
321
|
-
# 日期需为一个日期
|
322
|
-
if not isinstance(fsdates,str):
|
323
|
-
fsdates=fsdates[0]
|
324
|
-
"""
|
325
|
-
print(" #Warning(fs_analysis_china): must one date for",fsdates)
|
326
|
-
return
|
327
|
-
"""
|
328
|
-
|
329
|
-
# 单只股票的多层杜邦分解
|
330
|
-
from siat.financials_china import dupont_decompose_china
|
331
|
-
df_dbd=dupont_decompose_china(ticker=tickers,fsdate=fsdates,gview=gview)
|
332
|
-
return
|
333
|
-
|
334
|
-
else:
|
335
|
-
print(" #Warning(fs_analysis_china): sorry, no idea on what to do for",analysis_type)
|
336
|
-
return
|
337
|
-
|
338
|
-
|
339
|
-
#==============================================================================
|
340
|
-
#==============================================================================
|
341
|
-
#==============================================================================
|
siat/financials_china2_test.py
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
|
4
|
-
import os; os.chdir("S:/siat")
|
5
|
-
from siat.financials_china2 import *
|
6
|
-
|
7
|
-
tickers=['000002.SZ','600383.SS','600048.SS','600266.SS','600606.SS','000031.SZ']
|
8
|
-
fsdates=['2021-12-31','2020-12-31','2019-12-31','2018-12-31']
|
9
|
-
#注意:fsdates中的财报日期需要延后一期,以便获得期初数。
|
10
|
-
df=get_fin_stmt_ak_multi(tickers,fsdates)
|
11
|
-
|
12
|
-
items1=["货币资金","应收票据","应收账款"]
|
13
|
-
dfp1=fs_item_analysis_1(df, "000002.SZ",'2021-12-31',items1)
|
14
|
-
|
15
|
-
items2=["货币资金","应收账款","存货","长期股权投资","固定资产净额","资产总计"]
|
16
|
-
dfp2=fs_item_analysis_1(df, "000002.SZ",'2021-12-31',items2)
|
17
|
-
|
18
|
-
dfs=find_fs_items(df,itemword1='借款',itemword2='')
|
19
|
-
dfs=find_fs_items(df,itemword1='预收',itemword2='')
|
20
|
-
dfs=find_fs_items(df,itemword1='税',itemword2='应')
|
21
|
-
dfs=find_fs_items(df,itemword1='薪',itemword2='应')
|
22
|
-
dfs=find_fs_items(df,itemword1='债',itemword2='计')
|
23
|
-
items3=["短期借款","长期借款","应付账款","预收款项","应交税费","应付职工薪酬","负债合计"]
|
24
|
-
dfp3=fs_item_analysis_1(df, "000002.SZ",'2021-12-31',items3)
|
25
|
-
|
26
|
-
|
27
|
-
dfs=find_fs_items(df,itemword1='实',itemword2='资')
|
28
|
-
dfs=find_fs_items(df,itemword1='权益',itemword2='')
|
29
|
-
dfs=find_fs_items(df,itemword1='税',itemword2='应')
|
30
|
-
dfs=find_fs_items(df,itemword1='薪',itemword2='应')
|
31
|
-
dfs=find_fs_items(df,itemword1='债',itemword2='计')
|
32
|
-
items4=["实收资本(或股本)","资本公积","盈余公积","未分配利润","所有者权益合计"]
|
33
|
-
dfp4=fs_item_analysis_1(df, "000002.SZ",'2021-12-31',items4)
|
34
|
-
|
35
|
-
fsdates1=['2021-12-31','2020-12-31','2019-12-31']
|
36
|
-
items5=["应收账款","资产总计"]
|
37
|
-
dfp=fs_item_analysis_2(df,"000002.SZ",fsdates1,items5)
|
38
|
-
|
39
|
-
items8=["存货","资产总计"]
|
40
|
-
dfp=fs_item_analysis_2(df,"000002.SZ",fsdates1,items8)
|
41
|
-
|
42
|
-
dfs=find_fs_items(df,itemword1='流动',itemword2='')
|
43
|
-
|
44
|
-
dfp=fs_item_analysis_3(df,"000002.SZ",fsdates1)
|
45
|
-
|
46
|
-
dfp=fs_item_analysis_4(df,"000002.SZ",fsdates1)
|
47
|
-
|
48
|
-
dfp=fs_item_analysis_5(df,"000002.SZ",fsdates1)
|
49
|
-
|
50
|
-
dfs=find_fs_items(df,itemword1='应收账款',itemword2='')
|
51
|
-
fsdates2=['2021-12-31','2020-12-31']
|
52
|
-
items9=['应收账款','营业收入']
|
53
|
-
dfp=fs_item_analysis_6(df,"000002.SZ",fsdates2,items9)
|
54
|
-
|
55
|
-
items10=['存货','营业收入']
|
56
|
-
dfp=fs_item_analysis_6(df,"000002.SZ",fsdates2,items10)
|
57
|
-
|
58
|
-
items11=['存货','资产总计','存货占比%']
|
59
|
-
dfp=fs_item_analysis_7(df,tickers,'2021-12-31',items11)
|
60
|
-
|
61
|
-
items12=['资产总计','负债合计','资产负债率%','流动资产合计','速动资产合计', \
|
62
|
-
'流动负债合计','流动比率%','速动比率%']
|
63
|
-
dfp=fs_item_analysis_8(df,tickers,'2021-12-31',items12)
|
64
|
-
|
65
|
-
if __name__=='__main__':
|
66
|
-
asset_liab_structure(tickers,fsdates)
|
67
|
-
|
siat/financials_china2_test2.py
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
|
4
|
-
import os; os.chdir("S:/siat")
|
5
|
-
from siat.financials_china2 import *
|
6
|
-
|
7
|
-
tickers=['000002.SZ','600383.SS','600048.SS','600266.SS','600606.SS','000031.SZ']
|
8
|
-
fsdates=['2021-12-31','2020-12-31','2019-12-31','2018-12-31']
|
9
|
-
#注意:fsdates中的财报日期需要延后一期,以便获得期初数。
|
10
|
-
df=get_fin_stmt_ak_multi(tickers,fsdates)
|
11
|
-
|
12
|
-
#====================================================================
|
13
|
-
|
14
|
-
ticker="000002.SZ"
|
15
|
-
fsdate='2021-12-31'
|
16
|
-
items1=["营业总收入","营业总成本","营业成本","利润总额","所得税费用","净利润","归母净利润"]
|
17
|
-
dfp=fs_item_analysis_1(df,ticker,fsdate,items1)
|
18
|
-
#====================================================================
|
19
|
-
dfs=find_fs_items(df,itemword1='费用',itemword2='')
|
20
|
-
dfs=find_fs_items(df,itemword1='损失',itemword2='')
|
21
|
-
dfs=find_fs_items(df,itemword1='总额',itemword2='')
|
22
|
-
|
23
|
-
items2=["营业总成本","营业成本","营业税金及附加","销售费用","管理费用","研发费用",
|
24
|
-
"应付利息","公允价值变动损失","资产处置损失",'资产处置损失',
|
25
|
-
"资产减值损失","营业外支出"]
|
26
|
-
dfp2=fs_item_analysis_1(df, "000002.SZ",'2021-12-31',items2)
|
27
|
-
#====================================================================
|
28
|
-
fsdates1=['2021-12-31','2020-12-31','2019-12-31']
|
29
|
-
items3=["营业总成本","营业总收入"]
|
30
|
-
dfp=fs_item_analysis_2(df,"000002.SZ",fsdates1,items3)
|
31
|
-
#====================================================================
|
32
|
-
items4=["营业成本","营业总成本"]
|
33
|
-
dfp=fs_item_analysis_2(df,"000002.SZ",fsdates1,items4)
|
34
|
-
|
35
|
-
items5=["营业成本","营业总收入"]
|
36
|
-
dfp=fs_item_analysis_2(df,"000002.SZ",fsdates1,items5)
|
37
|
-
#====================================================================
|
38
|
-
items6=["销售费用","营业总收入"]
|
39
|
-
dfp=fs_item_analysis_2(df,"000002.SZ",fsdates1,items6)
|
40
|
-
#====================================================================
|
41
|
-
items7=["管理费用","营业总收入"]
|
42
|
-
dfp=fs_item_analysis_2(df,"000002.SZ",fsdates1,items7)
|
43
|
-
#====================================================================
|
44
|
-
items8=["营业利润","营业总收入"]
|
45
|
-
dfp=fs_item_analysis_2(df,"000002.SZ",fsdates1,items8)
|
46
|
-
#====================================================================
|
47
|
-
items9=["净利润","营业总收入"]
|
48
|
-
dfp=fs_item_analysis_2(df,"000002.SZ",fsdates1,items9)
|
49
|
-
#====================================================================
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
items8=["存货","营业总收入"]
|
61
|
-
dfp=asset_liab_analysis_2(df,"000002.SZ",fsdates1,items8)
|
62
|
-
|
63
|
-
dfs=find_fs_items(df,itemword1='流动',itemword2='')
|
64
|
-
|
65
|
-
dfp=asset_liab_analysis_3(df,"000002.SZ",fsdates1)
|
66
|
-
|
67
|
-
dfp=asset_liab_analysis_4(df,"000002.SZ",fsdates1)
|
68
|
-
|
69
|
-
dfp=asset_liab_analysis_5(df,"000002.SZ",fsdates1)
|
70
|
-
|
71
|
-
dfs=find_fs_items(df,itemword1='应收账款',itemword2='')
|
72
|
-
fsdates2=['2021-12-31','2020-12-31']
|
73
|
-
items9=['应收账款','营业收入']
|
74
|
-
dfp=asset_liab_analysis_6(df,"000002.SZ",fsdates2,items9)
|
75
|
-
|
76
|
-
items10=['存货','营业收入']
|
77
|
-
dfp=asset_liab_analysis_6(df,"000002.SZ",fsdates2,items10)
|
78
|
-
|
79
|
-
items11=['存货','资产总计','存货占比%']
|
80
|
-
dfp=asset_liab_analysis_7(df,tickers,'2021-12-31',items11)
|
81
|
-
|
82
|
-
items12=['资产总计','负债合计','资产负债率%','流动资产合计','速动资产合计', \
|
83
|
-
'流动负债合计','流动比率%','速动比率%']
|
84
|
-
dfp=asset_liab_analysis_8(df,tickers,'2021-12-31',items12)
|
85
|
-
|
86
|
-
if __name__=='__main__':
|
87
|
-
asset_liab_structure(tickers,fsdates)
|
88
|
-
|
siat/financials_china2_test3.py
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
|
4
|
-
import os; os.chdir("S:/siat")
|
5
|
-
from siat.financials_china2 import *
|
6
|
-
|
7
|
-
tickers=['000002.SZ','600383.SS','600048.SS','600266.SS','600606.SS','000031.SZ']
|
8
|
-
fsdates=['2021-12-31','2020-12-31','2019-12-31','2018-12-31']
|
9
|
-
#注意:fsdates中的财报日期需要延后一期,以便获得期初数。
|
10
|
-
df=get_fin_stmt_ak_multi(tickers,fsdates)
|
11
|
-
|
12
|
-
#====================================================================
|
13
|
-
dfs=find_fs_items(df,itemword1='资本',itemword2='')
|
14
|
-
|
15
|
-
ticker="000002.SZ"
|
16
|
-
fsdate='2021-12-31'
|
17
|
-
items1=["经营活动现金流净额","经营活动现金流入","经营活动现金流出",
|
18
|
-
"投资活动现金流净额","投资活动现金流入","投资活动现金流出",
|
19
|
-
"筹资活动现金流净额","筹资活动现金流入","筹资活动现金流出",
|
20
|
-
"汇率对现金流的影响","现金流量净增加额"]
|
21
|
-
dfp1=fs_item_analysis_1(df,ticker,fsdate,items1)
|
22
|
-
|
23
|
-
#占比变动分析:近三年
|
24
|
-
fsdates1=fsdates[:3]
|
25
|
-
items3=["经营活动现金流入","营业总收入"]
|
26
|
-
dfp3=fs_item_analysis_2(df,"000002.SZ",fsdates1,items3)
|
27
|
-
|
28
|
-
items4=["经营活动现金流净额","营业利润"]
|
29
|
-
dfp3=fs_item_analysis_2(df,"000002.SZ",fsdates1,items4)
|
30
|
-
|
31
|
-
#增幅分析:近两年
|
32
|
-
fsdates2=fsdates[:2]
|
33
|
-
items12=['经营活动现金流入','经营活动现金流出','经营活动现金流净额']
|
34
|
-
dfp12=fs_item_analysis_6(df,ticker,fsdates2,items12)
|
35
|
-
|
36
|
-
#同行比较
|
37
|
-
items14=['短期现金偿债能力%','长期现金偿债能力%']
|
38
|
-
dfp12=fs_item_analysis_8(df,tickers,fsdate,items14)
|
39
|
-
|
40
|
-
items15=['现金支付股利能力(元)','现金综合支付能力%','支付给职工的现金比率%']
|
41
|
-
dfp12=fs_item_analysis_8(df,tickers,fsdate,items15)
|
42
|
-
|
43
|
-
items16=['销售现金比率%','现金购销比率%','营业现金回笼率%']
|
44
|
-
dfp12=fs_item_analysis_8(df,tickers,fsdate,items16)
|
45
|
-
|
46
|
-
items17=['盈利现金比率%','现金流入流出比率%','资产现金回收率%']
|
47
|
-
dfp12=fs_item_analysis_8(df,tickers,fsdate,items17)
|
48
|
-
#====================================================================
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
items8=["存货","营业总收入"]
|
60
|
-
dfp=asset_liab_analysis_2(df,"000002.SZ",fsdates1,items8)
|
61
|
-
|
62
|
-
dfs=find_fs_items(df,itemword1='流动',itemword2='')
|
63
|
-
|
64
|
-
dfp=asset_liab_analysis_3(df,"000002.SZ",fsdates1)
|
65
|
-
|
66
|
-
dfp=asset_liab_analysis_4(df,"000002.SZ",fsdates1)
|
67
|
-
|
68
|
-
dfp=asset_liab_analysis_5(df,"000002.SZ",fsdates1)
|
69
|
-
|
70
|
-
dfs=find_fs_items(df,itemword1='应收账款',itemword2='')
|
71
|
-
fsdates2=['2021-12-31','2020-12-31']
|
72
|
-
items9=['应收账款','营业收入']
|
73
|
-
dfp=asset_liab_analysis_6(df,"000002.SZ",fsdates2,items9)
|
74
|
-
|
75
|
-
items10=['存货','营业收入']
|
76
|
-
dfp=asset_liab_analysis_6(df,"000002.SZ",fsdates2,items10)
|
77
|
-
|
78
|
-
items11=['存货','资产总计','存货占比%']
|
79
|
-
dfp=asset_liab_analysis_7(df,tickers,'2021-12-31',items11)
|
80
|
-
|
81
|
-
items12=['资产总计','负债合计','资产负债率%','流动资产合计','速动资产合计', \
|
82
|
-
'流动负债合计','流动比率%','速动比率%']
|
83
|
-
dfp=asset_liab_analysis_8(df,tickers,'2021-12-31',items12)
|
84
|
-
|
85
|
-
if __name__=='__main__':
|
86
|
-
asset_liab_structure(tickers,fsdates)
|
87
|
-
|