siat 2.12.3__py3-none-any.whl → 2.12.4__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/financial_statements.py +10 -2
- siat/financials.py +2 -0
- siat/financials2.py +19 -2
- {siat-2.12.3.dist-info → siat-2.12.4.dist-info}/METADATA +1 -1
- {siat-2.12.3.dist-info → siat-2.12.4.dist-info}/RECORD +7 -7
- {siat-2.12.3.dist-info → siat-2.12.4.dist-info}/WHEEL +0 -0
- {siat-2.12.3.dist-info → siat-2.12.4.dist-info}/top_level.txt +0 -0
siat/financial_statements.py
CHANGED
@@ -246,6 +246,9 @@ def get_income_statements(symbol):
|
|
246
246
|
stmt.sort_values(by=['asOfDate','periodType'],inplace=True)
|
247
247
|
#去掉重复记录: 保留年报数据项多,去掉数据项少的季报
|
248
248
|
stmt.drop_duplicates(subset=['asOfDate'],keep='first',inplace=True)
|
249
|
+
|
250
|
+
#把periodType中的TTM改成3M
|
251
|
+
stmt['periodType']=stmt['periodType'].apply(lambda x: '3M' if x=='TTM' else x)
|
249
252
|
|
250
253
|
#字段缺失处理
|
251
254
|
if 'InterestExpense' not in list(stmt):
|
@@ -353,6 +356,9 @@ def get_cashflow_statements(symbol):
|
|
353
356
|
stmt.sort_values(by=['asOfDate','periodType'],inplace=True)
|
354
357
|
#去掉重复记录: 保留年报数据项多,去掉数据项少的季报
|
355
358
|
stmt.drop_duplicates(subset=['asOfDate'],keep='first',inplace=True)
|
359
|
+
|
360
|
+
#把periodType中的TTM改成3M
|
361
|
+
stmt['periodType']=stmt['periodType'].apply(lambda x: '3M' if x=='TTM' else x)
|
356
362
|
|
357
363
|
#字段缺失处理
|
358
364
|
if 'CashDividendsPaid' not in list(stmt):
|
@@ -445,10 +451,12 @@ def get_financial_statements(ticker):
|
|
445
451
|
|
446
452
|
#合并1:资产负债表+利润表
|
447
453
|
import pandas as pd
|
448
|
-
fbs_fis=pd.merge(fbs,fis,on=['asOfDate','periodType'])
|
454
|
+
#fbs_fis=pd.merge(fbs,fis,on=['asOfDate','periodType'])
|
455
|
+
fbs_fis=pd.merge(fbs,fis,how='left',on=['asOfDate'],suffixes=('', '_y'))
|
449
456
|
|
450
457
|
#合并2:+现金流量表
|
451
|
-
fbs_fis_fcf=pd.merge(fbs_fis,fcf,on=['asOfDate','periodType','NetIncome'])
|
458
|
+
#fbs_fis_fcf=pd.merge(fbs_fis,fcf,on=['asOfDate','periodType','NetIncome'])
|
459
|
+
fbs_fis_fcf=pd.merge(fbs_fis,fcf,how='left',on=['asOfDate'],suffixes=('', '_y'))
|
452
460
|
|
453
461
|
fbs_fis_fcf['ticker']=ticker
|
454
462
|
#将所有的nan替换为0
|
siat/financials.py
CHANGED
siat/financials2.py
CHANGED
@@ -87,6 +87,8 @@ if __name__=='__main__':
|
|
87
87
|
fs_analysis(tickers,fsdates,analysis_type='profile',category='business',business_period='annual')
|
88
88
|
fs_analysis(tickers,fsdates,analysis_type='profile',category='valuation')
|
89
89
|
fs_analysis(tickers,fsdates,analysis_type='profile',category='financial')
|
90
|
+
|
91
|
+
tickers='03333.HK'; analysis_type='financial indicator'
|
90
92
|
|
91
93
|
def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
92
94
|
category='profile',business_period='annual', \
|
@@ -674,6 +676,10 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
674
676
|
with HiddenPrints():
|
675
677
|
dftmp=get_financial_rates(t)
|
676
678
|
|
679
|
+
if dftmp is None:
|
680
|
+
print(" #Warning(fs_analysis): none of financial indicators found for stock",t)
|
681
|
+
continue
|
682
|
+
|
677
683
|
if business_period=='recent':
|
678
684
|
dftmp2=dftmp.tail(1)
|
679
685
|
elif business_period=='annual':
|
@@ -683,8 +689,19 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
683
689
|
else:
|
684
690
|
dftmp2=dftmp.tail(1)
|
685
691
|
|
686
|
-
dftmp2=pd.DataFrame(dftmp2)
|
687
|
-
|
692
|
+
#dftmp2=pd.DataFrame(dftmp2)
|
693
|
+
#dftmp2['ticker1']=dftmp2['ticker']
|
694
|
+
#dftmp2.set_index('ticker1',inplace=True)
|
695
|
+
|
696
|
+
#删除重复的列名,若存在重复列会出现错误InvalidIndexError: Reindexing only valid with uniquely valued Index objects
|
697
|
+
dftmp2t=dftmp2.T
|
698
|
+
dftmp2t.drop_duplicates(keep='first',inplace=True)
|
699
|
+
dftmp3=dftmp2t.T
|
700
|
+
|
701
|
+
if fsdf is None:
|
702
|
+
fsdf=dftmp3
|
703
|
+
else:
|
704
|
+
fsdf=pd.concat([fsdf,dftmp3],ignore_index=True)
|
688
705
|
|
689
706
|
# 变换年报/季报
|
690
707
|
fsdf['periodType']=fsdf['periodType'].apply(lambda x: 'Annual' if x=='12M' else 'Quarterly')
|
@@ -33,11 +33,11 @@ siat/exchange_bond_china.pickle,sha256=78r6E3vPFZlCYPcmS1asgVbe0FGAxsCWaw8ek42Sd
|
|
33
33
|
siat/fama_french.py,sha256=tNtr0WRyPxDbgN6Nu_ZnDtVC-RIiQfh6w0JiPjevWa0,47538
|
34
34
|
siat/fama_french_test.py,sha256=M4O23lBKsJxhWHRluwCb3l7HSEn3OFTjzGMpehcevRg,4678
|
35
35
|
siat/financial_base.py,sha256=j961-1YS9qBl6LmOzI4gCOpdTmk0d1JgNXMzLmV-lrs,41062
|
36
|
-
siat/financial_statements.py,sha256=
|
36
|
+
siat/financial_statements.py,sha256=su_9CYUZVuhmv6gmYYhjQuJ_kAzGMuqi-9j72DwjGlc,23929
|
37
37
|
siat/financial_statements_test.py,sha256=FLhx8JD-tVVWSBGux6AMz1jioXX4U4bp9DmgFHYXb_w,716
|
38
|
-
siat/financials.py,sha256=
|
38
|
+
siat/financials.py,sha256=GPWJhLC47yRwY4gWUAJcLNxDuiEejkXq-zTBrUlTHn0,78795
|
39
39
|
siat/financials2 - 副本.py,sha256=dKlNjIfKeoSy055fQ6E6TUj9HEoO5Ney9grD84J5kfk,14389
|
40
|
-
siat/financials2.py,sha256=
|
40
|
+
siat/financials2.py,sha256=t6fJQkISM7FXYCj-UM0cHzHcWL7tZwhoxDBfnK9HsRE,36752
|
41
41
|
siat/financials_china.py,sha256=nUSPS4SDLP1RaOZF6uIvel8pFl3X_aBO_I0Opl1O8RI,177685
|
42
42
|
siat/financials_china2.py,sha256=12wgmTz1iV7N3IKm6Z0b6_punUzlkBMQ8I8yqvBsScU,73675
|
43
43
|
siat/financials_china2_test.py,sha256=Erz5k4LyOplBBvYls2MypuqHpVNJ3daiLdyeJezNPu0,2722
|
@@ -124,7 +124,7 @@ siat/valuation.py,sha256=3VKrO9b9xY9dOJGGuF0ZhytzB5d2pCx3kO3TtMml7mo,44025
|
|
124
124
|
siat/valuation_china.py,sha256=oEQRrktJNHiOG1mJSQN1aSSQAQrwrg-ppIHyNVjMjNg,67603
|
125
125
|
siat/valuation_market_china_test.py,sha256=gbJ0ioauuo4koTPH6WKUkqcXiQPafnbhU5eKJ6lpdLA,1571
|
126
126
|
siat/var_model_validation.py,sha256=zB_Skk_tmzIR15l6oAW3am4HBGVIG-eZ8gJhCdXZ8Qw,14859
|
127
|
-
siat-2.12.
|
128
|
-
siat-2.12.
|
129
|
-
siat-2.12.
|
130
|
-
siat-2.12.
|
127
|
+
siat-2.12.4.dist-info/METADATA,sha256=6NhKLQQ9tjw3I5LJ6gaqMwIcceEDWkh4DWUM5tXCnDg,1378
|
128
|
+
siat-2.12.4.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
129
|
+
siat-2.12.4.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
|
130
|
+
siat-2.12.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|