siat 3.0.25__py3-none-any.whl → 3.0.35__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 +32 -8
- siat/financials2.py +92 -65
- siat/financials_china.py +117 -115
- siat/financials_china2.py +138 -72
- siat/sector_china.py +7 -6
- {siat-3.0.25.dist-info → siat-3.0.35.dist-info}/METADATA +1 -1
- {siat-3.0.25.dist-info → siat-3.0.35.dist-info}/RECORD +9 -9
- {siat-3.0.25.dist-info → siat-3.0.35.dist-info}/WHEEL +0 -0
- {siat-3.0.25.dist-info → siat-3.0.35.dist-info}/top_level.txt +0 -0
siat/common.py
CHANGED
@@ -1613,7 +1613,7 @@ if __name__=='__main__':
|
|
1613
1613
|
|
1614
1614
|
def print_progress_percent2(current,total_list,steps=5,leading_blanks=4):
|
1615
1615
|
"""
|
1616
|
-
|
1616
|
+
功能:打印进度百分比,注意需要放在循环体的开始处,不能放在循环体的末尾!
|
1617
1617
|
current:当前完成
|
1618
1618
|
total:需要完成的列表
|
1619
1619
|
steps:分成几个进度点显示
|
@@ -1643,7 +1643,7 @@ def print_progress_percent2(current,total_list,steps=5,leading_blanks=4):
|
|
1643
1643
|
pct=pct_list[pos]
|
1644
1644
|
|
1645
1645
|
if pct=="100%":
|
1646
|
-
print("100% completing")
|
1646
|
+
print("100% completing last job ...")
|
1647
1647
|
else:
|
1648
1648
|
print(pct,end=' ')
|
1649
1649
|
|
@@ -1729,12 +1729,22 @@ def printInLine_md(aList,numberPerLine=5,colalign='left'):
|
|
1729
1729
|
groupedList=groupedList+[tmpList]
|
1730
1730
|
|
1731
1731
|
#装入df
|
1732
|
-
cols=[' ']*numberPerLine
|
1732
|
+
#cols=[' ']*numberPerLine
|
1733
|
+
cols=[i+1 for i in range(numberPerLine)]
|
1734
|
+
|
1733
1735
|
import pandas as pd
|
1734
1736
|
df=pd.DataFrame(groupedList,columns=cols)
|
1737
|
+
|
1738
|
+
"""
|
1735
1739
|
alignlist=[colalign]*numberPerLine
|
1736
1740
|
print(df.to_markdown(index=False,tablefmt='plain',colalign=alignlist))
|
1737
|
-
|
1741
|
+
"""
|
1742
|
+
df_display_CSS(df,titletxt='',footnote='',facecolor='papayawhip',decimals=2, \
|
1743
|
+
first_col_align='left',second_col_align='left', \
|
1744
|
+
last_col_align='left',other_col_align='left', \
|
1745
|
+
titile_font_size='18px',heading_font_size='17px', \
|
1746
|
+
data_font_size='17px')
|
1747
|
+
|
1738
1748
|
return
|
1739
1749
|
|
1740
1750
|
#==============================================================================
|
@@ -3759,7 +3769,7 @@ if __name__=='__main__':
|
|
3759
3769
|
upgrade_siat()
|
3760
3770
|
|
3761
3771
|
def upgrade_siat(module_list=['siat','akshare','pandas','pandas_datareader', \
|
3762
|
-
|
3772
|
+
'yfinance','yahooquery','urllib3','tabulate','twine','mplfinance'], \
|
3763
3773
|
pipcmd="pip install --upgrade"):
|
3764
3774
|
"""
|
3765
3775
|
功能:一次性升级siat及其相关插件
|
@@ -3798,16 +3808,30 @@ def upgrade_siat(module_list=['siat','akshare','pandas','pandas_datareader', \
|
|
3798
3808
|
|
3799
3809
|
#逐个升级插件
|
3800
3810
|
import subprocess
|
3811
|
+
fail_list=[]
|
3801
3812
|
for m in module_list:
|
3813
|
+
#print("Upgrading",m,"... ...",end='')
|
3814
|
+
print_progress_percent2(m,module_list,steps=5,leading_blanks=2)
|
3815
|
+
|
3802
3816
|
cmdstr1=cmdstr+m
|
3803
3817
|
#print(cmdstr1)
|
3804
3818
|
#proc=subprocess.run(cmdstr1.split(' '),stdout=subprocess.PIPE)
|
3805
3819
|
proc=subprocess.run(cmdstr1.split(' '))
|
3806
3820
|
rcode=proc.returncode
|
3807
|
-
if rcode
|
3808
|
-
|
3809
|
-
|
3821
|
+
if rcode !=0: fail_list=fail_list+[m]
|
3822
|
+
|
3823
|
+
"""
|
3824
|
+
if rcode==0: result='done✓'
|
3825
|
+
else: result='FAILed❌, try again manually'
|
3826
|
+
print(result)
|
3827
|
+
"""
|
3810
3828
|
|
3829
|
+
if len(fail_list) == 0:
|
3830
|
+
print(" All specified modules are successfully upgraded!")
|
3831
|
+
else:
|
3832
|
+
print(" All specified modules are successfully upgraded except",end='')
|
3833
|
+
print_list(fail_list,leading_blanks=1)
|
3834
|
+
|
3811
3835
|
return
|
3812
3836
|
#==============================================================================
|
3813
3837
|
#==============================================================================
|
siat/financials2.py
CHANGED
@@ -210,8 +210,9 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
210
210
|
|
211
211
|
fsdf4.replace(0,'---',inplace=True)
|
212
212
|
|
213
|
-
titletxt="\n***** "+ticker_name(tickers)+": BALANCE SHEET"+' *****\n'
|
214
|
-
|
213
|
+
#titletxt="\n***** "+ticker_name(tickers)+": BALANCE SHEET"+' *****\n'
|
214
|
+
titletxt=ticker_name(tickers,'stock')+": BALANCE SHEET"
|
215
|
+
#print(titletxt)
|
215
216
|
"""
|
216
217
|
tablefmt_list=["plain","simple","github","grid","simple_grid","rounded_grid", \
|
217
218
|
"heavy_grid","mixed_grid","double_grid","fancy_grid","outline", \
|
@@ -239,13 +240,17 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
239
240
|
fsdf6=df_filter_row(fsdf5,exclude_collist=['Item'],symbol='---')
|
240
241
|
|
241
242
|
fsdf6=df_sort_priority_list(fsdf6,sort_column='Item',priorityList=['periodType'],ascending=True)
|
242
|
-
|
243
|
+
"""
|
243
244
|
alignlist=['left']+['right']*(len(list(fsdf5))-1)
|
244
245
|
print(fsdf6.to_markdown(tablefmt='plain',index=False,colalign=alignlist))
|
246
|
+
"""
|
245
247
|
|
246
|
-
footnote1="
|
247
|
-
footnote2="
|
248
|
-
|
248
|
+
footnote1="Amount unit: "+currency+" billion, exchange's local accounting standards"
|
249
|
+
footnote2="Data source: Yahoo Finance, "+str(todaydt)
|
250
|
+
footnote='Note:\n'+footnote1+'\n'+footnote2
|
251
|
+
#print('\n',footnote1,'\n',footnote2)
|
252
|
+
df_display_CSS(fsdf6,titletxt=titletxt,footnote=footnote, \
|
253
|
+
titile_font_size='14px',heading_font_size='13px',data_font_size='13px')
|
249
254
|
|
250
255
|
return fsdf6
|
251
256
|
|
@@ -307,8 +312,9 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
307
312
|
|
308
313
|
fsdf4.replace(0,'---',inplace=True)
|
309
314
|
|
310
|
-
titletxt="\n***** "+ticker_name(tickers)+": INCOME STATEMENTS"+' *****\n'
|
311
|
-
|
315
|
+
#titletxt="\n***** "+ticker_name(tickers)+": INCOME STATEMENTS"+' *****\n'
|
316
|
+
titletxt=ticker_name(tickers,'stock')+": INCOME STATEMENTS"
|
317
|
+
#print(titletxt)
|
312
318
|
|
313
319
|
collist=list(fsdf4)
|
314
320
|
fsdf4['Item']=fsdf4.index
|
@@ -316,13 +322,16 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
316
322
|
fsdf6=df_filter_row(fsdf5,exclude_collist=['Item'],symbol='---')
|
317
323
|
|
318
324
|
fsdf6=df_sort_priority_list(fsdf6,sort_column='Item',priorityList=['periodType'],ascending=True)
|
319
|
-
|
325
|
+
"""
|
320
326
|
alignlist=['left']+['right']*(len(list(fsdf5))-1)
|
321
327
|
print(fsdf6.to_markdown(tablefmt='plain',index=False,colalign=alignlist))
|
322
|
-
|
323
|
-
footnote1="
|
324
|
-
footnote2="
|
325
|
-
|
328
|
+
"""
|
329
|
+
footnote1="Amount unit: "+currency+" billion, exchange's local accounting standards"
|
330
|
+
footnote2="Data source: Yahoo Finance, "+str(todaydt)
|
331
|
+
footnote='Note:\n'+footnote1+'\n'+footnote2
|
332
|
+
#print('\n',footnote1,'\n',footnote2)
|
333
|
+
df_display_CSS(fsdf6,titletxt=titletxt,footnote=footnote, \
|
334
|
+
titile_font_size='14px',heading_font_size='13px',data_font_size='13px')
|
326
335
|
|
327
336
|
return fsdf6
|
328
337
|
|
@@ -382,8 +391,9 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
382
391
|
|
383
392
|
fsdf4.replace(0,'---',inplace=True)
|
384
393
|
|
385
|
-
titletxt="\n***** "+ticker_name(tickers)+": CASHFLOW STATEMENTS"+' *****\n'
|
386
|
-
|
394
|
+
#titletxt="\n***** "+ticker_name(tickers)+": CASHFLOW STATEMENTS"+' *****\n'
|
395
|
+
titletxt=ticker_name(tickers,'stock')+": CASHFLOW STATEMENTS"
|
396
|
+
#print(titletxt)
|
387
397
|
|
388
398
|
collist=list(fsdf4)
|
389
399
|
fsdf4['Item']=fsdf4.index
|
@@ -391,14 +401,16 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
391
401
|
fsdf6=df_filter_row(fsdf5,exclude_collist=['Item'],symbol='---')
|
392
402
|
|
393
403
|
fsdf6=df_sort_priority_list(fsdf6,sort_column='Item',priorityList=['periodType'],ascending=True)
|
394
|
-
|
404
|
+
"""
|
395
405
|
alignlist=['left']+['right']*(len(list(fsdf5))-1)
|
396
406
|
print(fsdf6.to_markdown(tablefmt='plain',index=False,colalign=alignlist))
|
397
|
-
|
398
|
-
footnote1="
|
399
|
-
footnote2="
|
400
|
-
|
401
|
-
|
407
|
+
"""
|
408
|
+
footnote1="Amount unit: "+currency+" billion, exchange's local accounting standards"
|
409
|
+
footnote2="Data source: Yahoo Finance, "+str(todaydt)
|
410
|
+
footnote='Note:\n'+footnote1+'\n'+footnote2
|
411
|
+
#print('\n',footnote1,'\n',footnote2)
|
412
|
+
df_display_CSS(fsdf6,titletxt=titletxt,footnote=footnote, \
|
413
|
+
titile_font_size='14px',heading_font_size='13px',data_font_size='13px')
|
402
414
|
return fsdf6
|
403
415
|
|
404
416
|
return fsdf2
|
@@ -488,8 +500,9 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
488
500
|
|
489
501
|
fsdf4.replace(0,'---',inplace=True)
|
490
502
|
|
491
|
-
titletxt="\n***** "+ticker_name(tickers)+": FINANCIAL STATEMENT SUMMARY"+' *****\n'
|
492
|
-
|
503
|
+
#titletxt="\n***** "+ticker_name(tickers)+": FINANCIAL STATEMENT SUMMARY"+' *****\n'
|
504
|
+
titletxt=ticker_name(tickers,'stock')+": FINANCIAL STATEMENT SUMMARY"
|
505
|
+
#print(titletxt)
|
493
506
|
|
494
507
|
collist=list(fsdf4)
|
495
508
|
fsdf4['Item']=fsdf4.index
|
@@ -497,15 +510,17 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
497
510
|
fsdf6=df_filter_row(fsdf5,exclude_collist=['Item'],symbol='---')
|
498
511
|
|
499
512
|
fsdf6=df_sort_priority_list(fsdf6,sort_column='Item',priorityList=['periodType'],ascending=True)
|
500
|
-
|
513
|
+
"""
|
501
514
|
alignlist=['left']+['right']*(len(list(fsdf5))-1)
|
502
515
|
print(fsdf6.to_markdown(tablefmt='plain',index=False,colalign=alignlist))
|
503
|
-
|
504
|
-
footnote1="
|
505
|
-
footnote2="
|
506
|
-
footnote3="
|
507
|
-
|
508
|
-
|
516
|
+
"""
|
517
|
+
footnote1="Amount unit: "+currency+" billion, exchange's local accounting standards"
|
518
|
+
footnote2="ROx/EM/turnover rates are based on periodic mean, others on end-term"
|
519
|
+
footnote3="Data source: Yahoo Finance, "+todaydt
|
520
|
+
footnote='Note:\n'+footnote1+'\n'+footnote2+'\n'+footnote3
|
521
|
+
#print('\n',footnote1,'\n',footnote2,'\n',footnote3)
|
522
|
+
df_display_CSS(fsdf6,titletxt=titletxt,footnote=footnote, \
|
523
|
+
titile_font_size='14px',heading_font_size='13px',data_font_size='13px')
|
509
524
|
return fsdf6
|
510
525
|
|
511
526
|
return fsdf2
|
@@ -586,8 +601,9 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
586
601
|
|
587
602
|
fsdf4.replace(0,'---',inplace=True)
|
588
603
|
|
589
|
-
titletxt="\n***** PEER COMPARISON OF FINANCIAL STATEMENT SUMMARY *****\n"
|
590
|
-
|
604
|
+
#titletxt="\n***** PEER COMPARISON OF FINANCIAL STATEMENT SUMMARY *****\n"
|
605
|
+
titletxt="FINANCIAL STATEMENT SUMMARY: PEER COMPARISON"
|
606
|
+
#print(titletxt)
|
591
607
|
|
592
608
|
collist=list(fsdf4)
|
593
609
|
fsdf4['Item']=fsdf4.index
|
@@ -595,15 +611,17 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
595
611
|
fsdf6=df_filter_row(fsdf5,exclude_collist=['Item'],symbol='---')
|
596
612
|
|
597
613
|
fsdf6=df_sort_priority_list(fsdf6,sort_column='Item',priorityList=['periodType','reportDate','currencyCode'],ascending=True)
|
598
|
-
|
614
|
+
"""
|
599
615
|
alignlist=['left']+['right']*(len(list(fsdf5))-1)
|
600
616
|
print(fsdf6.to_markdown(tablefmt='plain',index=False,colalign=alignlist))
|
601
|
-
|
602
|
-
footnote1="
|
603
|
-
footnote2="
|
604
|
-
footnote3="
|
605
|
-
|
606
|
-
|
617
|
+
"""
|
618
|
+
footnote1="Amount unit: billion, based on exchange's local accounting standards"
|
619
|
+
footnote2="ROx/EM/turnover rates are based on periodic mean, others on end-term"
|
620
|
+
footnote3="Data source: Yahoo Finance, "+str(todaydt)
|
621
|
+
footnote='Note:\n'+footnote1+'\n'+footnote2+'\n'+footnote3
|
622
|
+
#print('\n',footnote1,'\n',footnote2,'\n',footnote3)
|
623
|
+
df_display_CSS(fsdf6,titletxt=titletxt,footnote=footnote, \
|
624
|
+
titile_font_size='14px',heading_font_size='13px',data_font_size='13px')
|
607
625
|
return fsdf6
|
608
626
|
|
609
627
|
return fsdf2
|
@@ -691,8 +709,9 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
691
709
|
|
692
710
|
fsdf4.replace(0,'---',inplace=True)
|
693
711
|
|
694
|
-
titletxt="\n***** "+ticker_name(tickers)+": FINANCIAL INDICATORS"+' *****\n'
|
695
|
-
|
712
|
+
#titletxt="\n***** "+ticker_name(tickers)+": FINANCIAL INDICATORS"+' *****\n'
|
713
|
+
titletxt=ticker_name(tickers,'stock')+": FINANCIAL INDICATORS"
|
714
|
+
#print(titletxt)
|
696
715
|
|
697
716
|
collist=list(fsdf4)
|
698
717
|
fsdf4['Item']=fsdf4.index
|
@@ -700,15 +719,17 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
700
719
|
fsdf6=df_filter_row(fsdf5,exclude_collist=['Item'],symbol='---')
|
701
720
|
|
702
721
|
fsdf6=df_sort_priority_list(fsdf6,sort_column='Item',priorityList=['periodType'],ascending=True)
|
703
|
-
|
722
|
+
"""
|
704
723
|
alignlist=['left']+['right']*(len(list(fsdf5))-1)
|
705
724
|
print(fsdf6.to_markdown(tablefmt='plain',index=False,colalign=alignlist))
|
706
|
-
|
707
|
-
footnote1="
|
708
|
-
footnote2="
|
709
|
-
footnote3="
|
710
|
-
|
711
|
-
|
725
|
+
"""
|
726
|
+
footnote1="Amount unit: "+currency+" billion, exchange's local accounting standards"
|
727
|
+
footnote2="ROx/EM/turnover rates are based on periodic mean, others on end-term"
|
728
|
+
footnote3="Data source: Yahoo Finance, "+str(todaydt)
|
729
|
+
footnote='Note:\n'+footnote1+'\n'+footnote2+'\n'+footnote3
|
730
|
+
#print('\n',footnote1,'\n',footnote2,'\n',footnote3)
|
731
|
+
df_display_CSS(fsdf6,titletxt=titletxt,footnote=footnote, \
|
732
|
+
titile_font_size='14px',heading_font_size='13px',data_font_size='13px')
|
712
733
|
return fsdf6
|
713
734
|
|
714
735
|
return fsdf2
|
@@ -790,8 +811,9 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
790
811
|
|
791
812
|
fsdf4.replace(0,'---',inplace=True)
|
792
813
|
|
793
|
-
titletxt="\n***** PEER COMPARISON OF FINANCIAL INDICATORS *****\n"
|
794
|
-
|
814
|
+
#titletxt="\n***** PEER COMPARISON OF FINANCIAL INDICATORS *****\n"
|
815
|
+
titletxt="FINANCIAL INDICATORS: PEER COMPARISON"
|
816
|
+
#print(titletxt)
|
795
817
|
|
796
818
|
collist=list(fsdf4)
|
797
819
|
fsdf4['Item']=fsdf4.index
|
@@ -799,15 +821,17 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
799
821
|
fsdf6=df_filter_row(fsdf5,exclude_collist=['Item'],symbol='---')
|
800
822
|
|
801
823
|
fsdf6=df_sort_priority_list(fsdf6,sort_column='Item',priorityList=['periodType','reportDate','currencyCode'],ascending=True)
|
802
|
-
|
824
|
+
"""
|
803
825
|
alignlist=['left']+['right']*(len(list(fsdf5))-1)
|
804
826
|
print(fsdf6.to_markdown(tablefmt='plain',index=False,colalign=alignlist))
|
805
|
-
|
806
|
-
footnote1="
|
807
|
-
footnote2="
|
808
|
-
footnote3="
|
809
|
-
|
810
|
-
|
827
|
+
"""
|
828
|
+
footnote1="Amount unit: billion, based on exchange's local accounting standards"
|
829
|
+
footnote2="ROx/EM/turnover rates are based on periodic mean, others on end-term"
|
830
|
+
footnote3="Data source: Yahoo Finance, "+str(todaydt)
|
831
|
+
footnote='Note:\n'+footnote1+'\n'+footnote2+'\n'+footnote3
|
832
|
+
#print('\n',footnote1,'\n',footnote2,'\n',footnote3)
|
833
|
+
df_display_CSS(fsdf6,titletxt=titletxt,footnote=footnote, \
|
834
|
+
titile_font_size='14px',heading_font_size='13px',data_font_size='13px')
|
811
835
|
return fsdf6
|
812
836
|
|
813
837
|
return fsdf2
|
@@ -914,8 +938,9 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
914
938
|
plt.show()
|
915
939
|
|
916
940
|
if printout:
|
917
|
-
title_txt="\n***** Dupont Identity Fact Sheet *****\n"
|
918
|
-
|
941
|
+
#title_txt="\n***** Dupont Identity Fact Sheet *****\n"
|
942
|
+
titletxt="Dupont Identity Fact Sheet"
|
943
|
+
#print(titletxt)
|
919
944
|
|
920
945
|
# 保留四位小数
|
921
946
|
collist=list(df)
|
@@ -927,14 +952,16 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
927
952
|
|
928
953
|
for d in list(df):
|
929
954
|
df[d]=df[d].apply(lambda x: round(x,5) if isinstance(x,float) else x)
|
930
|
-
|
955
|
+
"""
|
931
956
|
alignlist=['left']+['right']*(len(list(df))-1)
|
932
957
|
print(df.to_markdown(tablefmt='plain',index=False,colalign=alignlist))
|
933
|
-
|
934
|
-
footnote1="
|
935
|
-
footnote2="Data source: Yahoo Finance, "+todaydt
|
936
|
-
|
937
|
-
|
958
|
+
"""
|
959
|
+
footnote1="Based on exchange's local accounting standards, EM/TAT are on periodic mean"
|
960
|
+
footnote2="Data source: Yahoo Finance, "+str(todaydt)
|
961
|
+
footnote='Note:\n'+footnote1+'\n'+footnote2
|
962
|
+
#print('\n',footnote1,'\b.',footnote2)
|
963
|
+
df_display_CSS(df,titletxt=titletxt,footnote=footnote, \
|
964
|
+
titile_font_size='14px',heading_font_size='13px',data_font_size='13px')
|
938
965
|
return df2
|
939
966
|
|
940
967
|
else: # analysis_type1
|