siat 3.0.15__py3-none-any.whl → 3.0.20__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 +114 -1
- siat/financials_china.py +55 -26
- siat/financials_china2.py +82 -22
- siat/grafix.py +22 -18
- siat/stock_china.py +159 -52
- {siat-3.0.15.dist-info → siat-3.0.20.dist-info}/METADATA +1 -1
- {siat-3.0.15.dist-info → siat-3.0.20.dist-info}/RECORD +9 -9
- {siat-3.0.15.dist-info → siat-3.0.20.dist-info}/WHEEL +1 -1
- {siat-3.0.15.dist-info → siat-3.0.20.dist-info}/top_level.txt +0 -0
siat/common.py
CHANGED
@@ -3671,6 +3671,119 @@ def ticker_type_preprocess_mticker_mixed(ticker,ticker_type='auto'):
|
|
3671
3671
|
|
3672
3672
|
|
3673
3673
|
#==============================================================================
|
3674
|
+
if __name__=='__main__':
|
3675
|
+
df=get_price('600519.SS','2024-4-1','2024-4-20')
|
3676
|
+
titletxt='This is the Tilte'
|
3677
|
+
titletxt=''
|
3678
|
+
footnote='This is the footnote'
|
3679
|
+
facecolor='papayawhip'
|
3680
|
+
decimals=2
|
3681
|
+
|
3682
|
+
#在Spyder中无法测试效果
|
3683
|
+
df_display_CSS(df,titletxt,footnote,facecolor,decimals)
|
3684
|
+
|
3685
|
+
def df_display_CSS(df,titletxt='',footnote='',facecolor='papayawhip',decimals=2, \
|
3686
|
+
first_col_align='left',second_col_align='right', \
|
3687
|
+
last_col_align='right',other_col_align='right', \
|
3688
|
+
titile_font_size='18px',heading_font_size='17px', \
|
3689
|
+
data_font_size='17px'):
|
3690
|
+
"""
|
3691
|
+
功能:采样CSS式样显示df,适用于Jupyter环境,整齐紧凑,不挑浏览器
|
3692
|
+
注意:若facecolor不被支持,则自动改为papayawhip
|
3693
|
+
"""
|
3694
|
+
#检查df是否为空
|
3695
|
+
if len(df)==0: return
|
3696
|
+
|
3697
|
+
#替换nan和inf
|
3698
|
+
import pandas as pd
|
3699
|
+
import numpy as np
|
3700
|
+
df.replace([np.inf, -np.inf],'-', inplace=True)
|
3701
|
+
df.replace([np.nan],'-', inplace=True)
|
3702
|
+
|
3703
|
+
#默认的facecolor,一旦不支持则改为这个颜色
|
3704
|
+
facecolor_default='papayawhip'
|
3705
|
+
|
3706
|
+
#不显示索引列,注意style1已经不是DaraFrame了
|
3707
|
+
style1=df.style.hide()
|
3708
|
+
|
3709
|
+
#设置数值字段的千分位符号,同时设置数值字段的小数点精度
|
3710
|
+
style2=style1.format(precision=decimals,thousands=',',na_rep='-')
|
3711
|
+
|
3712
|
+
#设置标题/列名:对齐,颜色,背景
|
3713
|
+
try:
|
3714
|
+
style3=style2.set_caption(titletxt).set_table_styles(
|
3715
|
+
[{'selector':'caption', #设置标题对齐
|
3716
|
+
'props':[('color','black'),('font-size',titile_font_size),('font-weight','bold')]}, \
|
3717
|
+
|
3718
|
+
{'selector':'th.col_heading', #设置列名对齐
|
3719
|
+
'props':[('color','black'),('background-color',facecolor), \
|
3720
|
+
('font-size',heading_font_size),('text-align','center'),('margin','auto')]}])
|
3721
|
+
except:
|
3722
|
+
style3=style2.set_caption(titletxt).set_table_styles(
|
3723
|
+
[{'selector':'caption', #设置标题对齐
|
3724
|
+
'props':[('color','black'),('font-size',titile_font_size),('font-weight','bold')]}, \
|
3725
|
+
|
3726
|
+
{'selector':'th.col_heading', #设置列名对齐
|
3727
|
+
'props':[('color','black'),('background-color',facecolor_default), \
|
3728
|
+
('font-size',heading_font_size),('text-align','center'),('margin','auto')]}])
|
3729
|
+
|
3730
|
+
#设置数据:字体大小
|
3731
|
+
style4=style3.set_properties(**{'font-size':data_font_size})
|
3732
|
+
|
3733
|
+
#设置数据:对齐,第一列,最后列,中间列
|
3734
|
+
col_list=list(df)
|
3735
|
+
style5=style4.set_properties(**{'text-align':other_col_align}).\
|
3736
|
+
set_properties(**{'text-align':first_col_align},subset=[col_list[0]]).\
|
3737
|
+
set_properties(**{'text-align':second_col_align},subset=[col_list[1]]).\
|
3738
|
+
set_properties(**{'text-align':last_col_align},subset=[col_list[-1]])
|
3739
|
+
|
3740
|
+
#设置数据:背景颜色
|
3741
|
+
try:
|
3742
|
+
style6=style5.set_properties(**{'background-color':facecolor,'color':'black'})
|
3743
|
+
except:
|
3744
|
+
print(" #Warning(df_display_CSS): unsupported color",facecolor,"\b, changed to default")
|
3745
|
+
style6=style5.set_properties(**{'background-color':facecolor_default,'color':'black'})
|
3746
|
+
|
3747
|
+
#打印数据框本身
|
3748
|
+
print('') #空一行
|
3749
|
+
from IPython.display import display
|
3750
|
+
display(style6)
|
3751
|
+
|
3752
|
+
print(footnote)
|
3753
|
+
print('') #空一行
|
3754
|
+
|
3755
|
+
return
|
3756
|
+
|
3674
3757
|
#==============================================================================
|
3675
|
-
|
3758
|
+
def upgrade_siat():
|
3759
|
+
"""
|
3760
|
+
功能:一次性升级siat及其相关插件
|
3761
|
+
|
3762
|
+
注意:在Spyder中可用,但在Jupyter中不能用,可能是路径问题!
|
3763
|
+
"""
|
3764
|
+
#系统路径
|
3765
|
+
import sys
|
3766
|
+
python_dir=sys.path
|
3767
|
+
|
3768
|
+
#插件列表
|
3769
|
+
pip_list=['siat','akshare','pandas','pandas_datareader','yfinance','yahooquery']
|
3770
|
+
pip_cmd='pip install --upgrade '
|
3771
|
+
|
3772
|
+
import subprocess
|
3773
|
+
for p in pip_list:
|
3774
|
+
print(" Upgrading",p,"\b, please wait ... ...")
|
3775
|
+
command = pip_cmd + p
|
3776
|
+
#result = subprocess.run(command, shell=True, text=True, capture_output=True)
|
3777
|
+
result = subprocess.run(command.split(' '), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
3778
|
+
|
3779
|
+
if result.returncode == 0:
|
3780
|
+
print(' Successfully upgraded', p)
|
3781
|
+
else:
|
3782
|
+
print(' Upgrade failed:', result.returncode)
|
3783
|
+
print(' Error message:', result.stderr)
|
3784
|
+
|
3785
|
+
return
|
3676
3786
|
|
3787
|
+
#==============================================================================
|
3788
|
+
#==============================================================================
|
3789
|
+
#==============================================================================
|
siat/financials_china.py
CHANGED
@@ -799,8 +799,11 @@ def compare_dupont_china(tickerlist,fsdate='latest',scale1 = 10,scale2 = 10, \
|
|
799
799
|
footnote1="2、表中数值基于期末数字直接计算,而非期初期末均值,可能与公告数字存在差异。"
|
800
800
|
footnote2="*** 数据来源:sina/EM,"+str(today)
|
801
801
|
footnote=footnote0+'\n'+footnote1+'\n'+footnote2
|
802
|
-
|
802
|
+
|
803
803
|
#print(df.to_string(index=False))
|
804
|
+
#df_directprint(df,title_txt,footnote)
|
805
|
+
df_display_CSS(df=df,titletxt=title_txt,footnote=footnote, \
|
806
|
+
facecolor=facecolor,decimals=4)
|
804
807
|
|
805
808
|
|
806
809
|
#合并所有历史记录
|
@@ -3621,14 +3624,14 @@ def compare_fin_summary_china(tickers,fsdates,facecolor='whitesmoke'):
|
|
3621
3624
|
|
3622
3625
|
# 注释
|
3623
3626
|
notesdict={'常用指标': \
|
3624
|
-
'
|
3627
|
+
'注:\n'+ \
|
3625
3628
|
'1. 毛利率=毛利润 / 营业(总)收入 ×100% \n'+ \
|
3626
3629
|
'2. 毛利润=营业(总)收入-营业(总)成本 \n'+ \
|
3627
3630
|
'3. 销售净利率=净利润 / 营业(总)收入 ×100% \n'+ \
|
3628
3631
|
'4. 期间费用率=期间费用 / 营业(总)收入 ×100%,期间费用包括管理费用,销售费用和财务费用。 \n', \
|
3629
3632
|
|
3630
3633
|
'每股指标': \
|
3631
|
-
'
|
3634
|
+
'注:\n'+ \
|
3632
3635
|
'1. 稀释每股指标:假设企业所有发行在外的稀释性潜在普通股期间内均转换为普通股,导致普通股股数增加 \n'+ \
|
3633
3636
|
'2. 潜在普通股:指赋予其持有者在报告期或以后期间享有取得普通股权利的金融工具或者其他合同,例如公司可转债、认股权证、股份期权等 \n'+ \
|
3634
3637
|
'3. 摊薄每股指标:使用期末数值计算,而非期初期末均值,其结果更能反应期末情况,可能大于、小于或等于每股指标 \n'+ \
|
@@ -3646,13 +3649,13 @@ def compare_fin_summary_china(tickers,fsdates,facecolor='whitesmoke'):
|
|
3646
3649
|
'15.(企业)自由现金流可以理解为归属于股东与债权人的最大现金流,而股东(股权)自由现金流则是归属于股东的最大现金流。 \n', \
|
3647
3650
|
|
3648
3651
|
'营运能力': \
|
3649
|
-
'
|
3652
|
+
'注:\n'+ \
|
3650
3653
|
'1. 指标周转率/周转次数:营业(总)收入 / 指标的起初期末均值。一般来说数值越大越好 \n'+ \
|
3651
3654
|
'2. 指标周转天数:360/周转率(或周转次数)。一般来说数值越小越好 \n'+ \
|
3652
3655
|
'3. 注意:本表指标主要针对非金融行业,部分指标不适用于金融行业。 \n', \
|
3653
3656
|
|
3654
3657
|
'盈利能力':
|
3655
|
-
'
|
3658
|
+
'注:\n'+ \
|
3656
3659
|
'1. 毛利润=营业(总)收入-营业(总)成本 \n'+ \
|
3657
3660
|
'2. 营业利润=毛利润-营业税金及附加-期间费用-资产减值损失+公允价值变动损益+投资损益 \n'+ \
|
3658
3661
|
'3. 营业利润率=营业利润 / 营业(总)收入 x100% \n'+ \
|
@@ -3676,18 +3679,18 @@ def compare_fin_summary_china(tickers,fsdates,facecolor='whitesmoke'):
|
|
3676
3679
|
'21.投入资本回报率的意义:更多地从投资而非财务角度看,每单位投资的资本所能赚取息税前利润的多少。 \n', \
|
3677
3680
|
|
3678
3681
|
'收益质量':
|
3679
|
-
'
|
3682
|
+
'注:\n'+ \
|
3680
3683
|
'1. 销售成本率=营业(总)成本 / 营业(总)收入 x100%,=1-毛利润 \n'+ \
|
3681
3684
|
'2. 成本费用率=(营业(总)成本+期间费用) / 营业(总)收入 x100%,=销售成本率+期间费用率,可评价企业对成本费用的控制能力 \n'+ \
|
3682
3685
|
'3. 期间费用率=期间费用 / 营业(总)收入 x100% \n',
|
3683
3686
|
|
3684
3687
|
'成长能力':
|
3685
|
-
'
|
3688
|
+
'注:\n'+ \
|
3686
3689
|
'1. 扣费(后)净利润=净利润-非经常性损益,即扣除了偶然的不可持续或不常发生的收益,可持续性更强,可能大于或小于净利润 \n'+ \
|
3687
3690
|
'2. 归属母公司净利润:简称归母净利润,指企业合并报表中归属控股公司(母公司)的利润,不包括归属子公司中非控股股东的利润。 \n',
|
3688
3691
|
|
3689
3692
|
'财务风险':
|
3690
|
-
'
|
3693
|
+
'注:\n'+ \
|
3691
3694
|
'1. 保守速动比率:又称超速动比率,=(现金+短期证券投资+应收账款净额) / 流动负债,比速动比能够更好地评价企业短期偿债能力 \n'+ \
|
3692
3695
|
'2. 应收账款净额:指应收账款和其他应收款减去备抵坏账的净额,实质即为信誉高客户的应收款净额 \n'+ \
|
3693
3696
|
'3. 产权比率(equity ratio)=负债总额 / 所有者权益总额(净资产) x100%,从一个方面说明企业长期偿债能力,越高越弱 \n'+ \
|
@@ -3698,8 +3701,11 @@ def compare_fin_summary_china(tickers,fsdates,facecolor='whitesmoke'):
|
|
3698
3701
|
# 一只股票情形:多日期
|
3699
3702
|
if len(tickers_found) == 1:
|
3700
3703
|
ticker1=tickers[0]
|
3704
|
+
"""
|
3701
3705
|
titletxt="\n===== 上市公司财务报表摘要:"+ticker_name(ticker1)+" ====="
|
3702
3706
|
print(titletxt)
|
3707
|
+
"""
|
3708
|
+
titletxt=ticker_name(ticker1)+':'+"财报摘要"
|
3703
3709
|
|
3704
3710
|
fsdf1=fsdf[fsdf['ticker']==ticker1]
|
3705
3711
|
for ty in typelist:
|
@@ -3714,11 +3720,15 @@ def compare_fin_summary_china(tickers,fsdates,facecolor='whitesmoke'):
|
|
3714
3720
|
dft.index=dft.index + 1
|
3715
3721
|
dft2=dft.drop(labels=['选项','ticker'],axis=1)
|
3716
3722
|
|
3723
|
+
"""
|
3717
3724
|
print("\n***",ty+':')
|
3718
3725
|
colalign=['center','left']+['right']*(len(list(dft2)) - 1)
|
3719
3726
|
print(dft2.to_markdown(tablefmt='Simple',index=True,colalign=colalign))
|
3720
3727
|
print(notesdict[ty])
|
3721
|
-
|
3728
|
+
"""
|
3729
|
+
titletxt1=titletxt+','+ty
|
3730
|
+
df_display_CSS(df=dft2,titletxt=titletxt1,footnote=notesdict[ty], \
|
3731
|
+
facecolor=facecolor,decimals=2)
|
3722
3732
|
|
3723
3733
|
# 多只股票情形:单日期
|
3724
3734
|
import pandas as pd
|
@@ -3730,9 +3740,12 @@ def compare_fin_summary_china(tickers,fsdates,facecolor='whitesmoke'):
|
|
3730
3740
|
fsdates3=sorted(fsdates2,reverse=True)
|
3731
3741
|
|
3732
3742
|
if len(tickers_found) > 1:
|
3743
|
+
"""
|
3733
3744
|
titletxt="\n===== 上市公司财务报表摘要对比:报表日期"+fsdates3[0]+" ====="
|
3734
3745
|
print('\n'+titletxt)
|
3735
|
-
|
3746
|
+
"""
|
3747
|
+
titletxt="财报摘要:报表日"+fsdates3[0]
|
3748
|
+
|
3736
3749
|
mdf=pd.DataFrame()
|
3737
3750
|
for t in tickers_found:
|
3738
3751
|
dft=fsdf[fsdf['ticker']==t]
|
@@ -3759,12 +3772,16 @@ def compare_fin_summary_china(tickers,fsdates,facecolor='whitesmoke'):
|
|
3759
3772
|
dft.reset_index(drop=True,inplace=True)
|
3760
3773
|
dft.index=dft.index + 1
|
3761
3774
|
dft2=dft.drop(labels=['选项'],axis=1)
|
3762
|
-
|
3775
|
+
"""
|
3763
3776
|
print("\n***",ty+':')
|
3764
3777
|
colalign=['center','left']+['right']*(len(list(dft2)) - 1)
|
3765
3778
|
print(dft2.to_markdown(tablefmt='Simple',index=True,colalign=colalign))
|
3766
3779
|
print(notesdict[ty])
|
3767
|
-
|
3780
|
+
"""
|
3781
|
+
titletxt1=titletxt+','+ty
|
3782
|
+
df_display_CSS(df=dft2,titletxt=titletxt1,footnote=notesdict[ty], \
|
3783
|
+
facecolor=facecolor,decimals=2)
|
3784
|
+
|
3768
3785
|
return dft2
|
3769
3786
|
|
3770
3787
|
#==============================================================================
|
@@ -4084,12 +4101,12 @@ def compare_fin_indicator_china(tickers,fsdates,facecolor='papayawhip'):
|
|
4084
4101
|
|
4085
4102
|
# 注释
|
4086
4103
|
notesdict={'规模指标': \
|
4087
|
-
'
|
4104
|
+
'注:\n'+ \
|
4088
4105
|
'1. 短期=一年以内,长期=一年以上 \n'+ \
|
4089
4106
|
'2. 非经常性损益=非经常性或偶然活动带来的损益,一般不可持续。 \n', \
|
4090
4107
|
|
4091
4108
|
'利润回报': \
|
4092
|
-
'
|
4109
|
+
'注:\n'+ \
|
4093
4110
|
'1. 销售毛利率=毛利率=毛利润/营业(总)收入*100%,毛利润=营业(总)收入-营业(总)成本 \n'+ \
|
4094
4111
|
'2. 主营业务利润率=主营业务利润/主营业务收入*100%,主营业务利润=主营业务收入-主营业务成本-主营业务税金及附加 \n'+ \
|
4095
4112
|
'3. 营业利润率=营业利润/营业(总)收入*100%,营业利润=主营业务利润+其他业务利润-期间费用+其他损益 \n'+ \
|
@@ -4113,7 +4130,7 @@ def compare_fin_indicator_china(tickers,fsdates,facecolor='papayawhip'):
|
|
4113
4130
|
'21.股息发放率=股利支付率=股利/净利润*100%,反映公司的股利分配政策,比例高表明公司不需更多的资金进行再投入。 \n', \
|
4114
4131
|
|
4115
4132
|
'每股指标': \
|
4116
|
-
'
|
4133
|
+
'注:\n'+ \
|
4117
4134
|
'1. 每股收益=净利润/流通股数量,其中流通股数量按期初期末均值计算 \n'+ \
|
4118
4135
|
'2. 扣除非经常性损益后的每股收益=扣除非经常性损益后的净利润/流通股数量 \n'+ \
|
4119
4136
|
'3. 加权每股收益=净利润/加权流通股数量,加权流通股数量含期间内流通股数量的变化(增发新股、送股、转增股本或配股等) \n'+ \
|
@@ -4125,20 +4142,20 @@ def compare_fin_indicator_china(tickers,fsdates,facecolor='papayawhip'):
|
|
4125
4142
|
'9. 每股资本公积金=资本公积金/流通股数量,资本公积金含发行股份的溢价、资产重估增值、接受捐赠等,仅可用于转增股本。 \n', \
|
4126
4143
|
|
4127
4144
|
'营运能力':
|
4128
|
-
'
|
4145
|
+
'注:\n'+ \
|
4129
4146
|
'1. 指标周转率/周转次数:营业(总)收入 / 指标的起初期末均值,从企业自身角度来说越大越好,但若涉及供应商则可能相反 \n'+ \
|
4130
4147
|
'2. 指标周转天数:360/周转率(或周转次数),从企业自身角度来说越小越好,但若涉及供应商则可能相反 \n'+ \
|
4131
4148
|
'3. 注意:本表指标主要针对非金融行业,部分指标不适用于金融行业。 \n', \
|
4132
4149
|
|
4133
4150
|
'现金指标':
|
4134
|
-
'
|
4151
|
+
'注:\n'+ \
|
4135
4152
|
'1. 现金流量比率=经营活动产生的现金净流量/期末流动负债*100%,反映企业短期偿债能力 \n'+ \
|
4136
4153
|
'2. 经营现金净流量对销售收入比率=销售现金比率,与赊销政策有关,若企业有虚假收入,也会使该指标过低 \n'+ \
|
4137
4154
|
'3. 资产的经营现金流量回报率=经营现金流量净额/总资产*100%,体现企业经营活动的收现能力 \n'+ \
|
4138
4155
|
'4. 经营现金净流量与净利润的比率=净现比=经营现金流量净额/净利润*100%。比率越大,企业盈利质量越高。 \n',
|
4139
4156
|
|
4140
4157
|
'偿债能力':
|
4141
|
-
'
|
4158
|
+
'注:\n'+ \
|
4142
4159
|
'1. 流动比率=流动资产/流动负债,反映企业的短期偿债能力,属于宽松指标 \n'+ \
|
4143
4160
|
'2. 速动比率=(流动资产-存货)/流动负债,反映企业的短期偿债能力,属于较严的指标 \n'+ \
|
4144
4161
|
'3. 现金比率=(货币资金+短期有价证券)/流动负债*100%,反映企业的短期偿债能力,属于严厉的指标 \n'+ \
|
@@ -4153,17 +4170,17 @@ def compare_fin_indicator_china(tickers,fsdates,facecolor='papayawhip'):
|
|
4153
4170
|
'12. 经营现金净流量对负债比率=现金流量负债比=经营活动现金流量净额/负债总额*100%,比率越高,财务弹性越好。 \n',
|
4154
4171
|
|
4155
4172
|
'应收账款':
|
4156
|
-
'
|
4173
|
+
'注:\n'+ \
|
4157
4174
|
'1. 使用账龄法对应收账款/其他应收款分类 \n'+ \
|
4158
4175
|
'2. 一般而言,应收款项的账龄越长,成为呆坏账的可能性就越大。 \n',
|
4159
4176
|
|
4160
4177
|
'预付账款':
|
4161
|
-
'
|
4178
|
+
'注:\n'+ \
|
4162
4179
|
'1. 一般而言,预付款项数额越大,企业在供应链中的地位越低 \n'+ \
|
4163
4180
|
'2. 一般而言,预付款项的账龄越长,企业在供应链中的地位越低。 \n',
|
4164
4181
|
|
4165
4182
|
'其他指标':
|
4166
|
-
'
|
4183
|
+
'注:\n'+ \
|
4167
4184
|
'1. 长期资产与长期资金比率=非流动资产/(长期负债+股东权益)*100%,长期资金少,流动负债较多,财务风险较大 \n'+ \
|
4168
4185
|
'2. 资本化比率=长期负债/(长期负债+股东权益)*100%,指标值越小,负债的资本化程度就越低,长期偿债压力就越小 \n'+ \
|
4169
4186
|
'3. 固定资产净值率=(固定资产原值-累计折旧)/固定资产原值*100%,反映企业全部固定资产平均新旧程度 \n'+ \
|
@@ -4180,8 +4197,11 @@ def compare_fin_indicator_china(tickers,fsdates,facecolor='papayawhip'):
|
|
4180
4197
|
# 一只股票情形:多日期
|
4181
4198
|
if len(tickers_found) == 1:
|
4182
4199
|
ticker1=tickers[0]
|
4200
|
+
"""
|
4183
4201
|
titletxt="\n===== 上市公司主要财务比率和重要指标:"+ticker_name(ticker1)+" ====="
|
4184
4202
|
print(titletxt)
|
4203
|
+
"""
|
4204
|
+
titletxt="主要财务比率和指标:"+ticker_name(ticker1)
|
4185
4205
|
|
4186
4206
|
fsdf1=fsdf[fsdf['ticker']==ticker1]
|
4187
4207
|
for ty in typelist:
|
@@ -4206,16 +4226,19 @@ def compare_fin_indicator_china(tickers,fsdates,facecolor='papayawhip'):
|
|
4206
4226
|
dft2.reset_index(drop=True,inplace=True)
|
4207
4227
|
dft2.index=dft2.index + 1
|
4208
4228
|
dft3=dft2.drop(labels=['选项','ticker'],axis=1)
|
4209
|
-
|
4229
|
+
"""
|
4210
4230
|
print("\n***",ty+':')
|
4211
4231
|
colalign=['center','left']+['right']*(len(list(dft3)) - 1)
|
4212
4232
|
print(dft3.to_markdown(tablefmt='Simple',index=True,colalign=colalign))
|
4233
|
+
print(notesdict[ty])
|
4234
|
+
"""
|
4213
4235
|
"""
|
4214
4236
|
注意:若dft3为空,则会出现错误:list assignment index out of range
|
4215
4237
|
无论如何修改colalign都没用
|
4216
4238
|
"""
|
4217
|
-
|
4218
|
-
|
4239
|
+
titletxt1=titletxt+','+ty
|
4240
|
+
df_display_CSS(df=dft3,titletxt=titletxt1,footnote=notesdict[ty], \
|
4241
|
+
facecolor=facecolor,decimals=2)
|
4219
4242
|
|
4220
4243
|
return dft3
|
4221
4244
|
|
@@ -4245,9 +4268,11 @@ def compare_fin_indicator_china(tickers,fsdates,facecolor='papayawhip'):
|
|
4245
4268
|
mdf=dft2
|
4246
4269
|
else:
|
4247
4270
|
mdf=mdf.merge(dft2,how='outer',left_on=['选项','指标'], right_on=['选项','指标'])
|
4248
|
-
|
4271
|
+
"""
|
4249
4272
|
titletxt="\n===== 上市公司财务报表主要比率和重要项目对比:报表日期"+fsdates3[0]+" ====="
|
4250
4273
|
print('\n'+titletxt)
|
4274
|
+
"""
|
4275
|
+
titletxt="主要财务比率和指标:报表日"+fsdates3[0]
|
4251
4276
|
|
4252
4277
|
for ty in typelist:
|
4253
4278
|
dft=mdf[mdf['选项']==ty]
|
@@ -4263,11 +4288,15 @@ def compare_fin_indicator_china(tickers,fsdates,facecolor='papayawhip'):
|
|
4263
4288
|
dft2.reset_index(drop=True,inplace=True)
|
4264
4289
|
dft2.index=dft2.index + 1
|
4265
4290
|
dft3=dft2.drop(labels=['选项'],axis=1)
|
4266
|
-
|
4291
|
+
"""
|
4267
4292
|
print("\n***",ty+':')
|
4268
4293
|
colalign=['center','left']+['right']*(len(list(dft3))-2)
|
4269
4294
|
print(dft3.to_markdown(tablefmt='Simple',index=True,colalign=colalign))
|
4270
4295
|
print(notesdict[ty])
|
4296
|
+
"""
|
4297
|
+
titletxt1=titletxt+','+ty
|
4298
|
+
df_display_CSS(df=dft3,titletxt=titletxt1,footnote=notesdict[ty], \
|
4299
|
+
facecolor=facecolor,decimals=2)
|
4271
4300
|
|
4272
4301
|
return dft3
|
4273
4302
|
|
siat/financials_china2.py
CHANGED
@@ -608,8 +608,11 @@ def fs_item_analysis_1(df,ticker,fsdate,items,title_txt='',notes='',facecolor='p
|
|
608
608
|
else:
|
609
609
|
foottext=notes+'\n'+footnote
|
610
610
|
|
611
|
-
df_directprint(dfp,title_txt,foottext,facecolor=facecolor)
|
612
|
-
|
611
|
+
#df_directprint(dfp,title_txt,foottext,facecolor=facecolor)
|
612
|
+
df_display_CSS(df=dfp,titletxt=title_txt,footnote=foottext, \
|
613
|
+
first_col_align='left', \
|
614
|
+
facecolor=facecolor,decimals=2)
|
615
|
+
|
613
616
|
return dfp
|
614
617
|
|
615
618
|
|
@@ -668,8 +671,11 @@ def fs_item_analysis_2(df,ticker,fsdates,items,title_txt='',notes='',facecolor='
|
|
668
671
|
else:
|
669
672
|
foottext=notes+'\n'+footnote
|
670
673
|
|
671
|
-
df_directprint(dfp,title_txt,foottext,facecolor=facecolor)
|
672
|
-
|
674
|
+
#df_directprint(dfp,title_txt,foottext,facecolor=facecolor)
|
675
|
+
df_display_CSS(df=dfp,titletxt=title_txt,footnote=foottext, \
|
676
|
+
first_col_align='left', \
|
677
|
+
facecolor=facecolor,decimals=2)
|
678
|
+
|
673
679
|
return dfp
|
674
680
|
|
675
681
|
#==============================================================================
|
@@ -723,7 +729,10 @@ def fs_item_analysis_3(df,ticker,fsdates,title_txt='',notes='',facecolor='papaya
|
|
723
729
|
else:
|
724
730
|
foottext=notes+'\n'+footnote
|
725
731
|
|
726
|
-
df_directprint(dfp,title_txt,foottext,facecolor=facecolor)
|
732
|
+
#df_directprint(dfp,title_txt,foottext,facecolor=facecolor)
|
733
|
+
df_display_CSS(df=dfp,titletxt=title_txt,footnote=foottext, \
|
734
|
+
first_col_align='left', \
|
735
|
+
facecolor=facecolor,decimals=2)
|
727
736
|
|
728
737
|
return dfp
|
729
738
|
|
@@ -798,8 +807,10 @@ def fs_item_analysis_4(df,ticker,fsdates,title_txt='',notes='',facecolor='papaya
|
|
798
807
|
else:
|
799
808
|
foottext=notes+'\n'+footnote
|
800
809
|
|
801
|
-
df_directprint(dfp,title_txt,foottext,facecolor=facecolor)
|
802
|
-
|
810
|
+
#df_directprint(dfp,title_txt,foottext,facecolor=facecolor)
|
811
|
+
df_display_CSS(df=dfp,titletxt=title_txt,footnote=foottext, \
|
812
|
+
first_col_align='left', \
|
813
|
+
facecolor=facecolor,decimals=2)
|
803
814
|
return dfp
|
804
815
|
|
805
816
|
#==============================================================================
|
@@ -853,8 +864,10 @@ def fs_item_analysis_5(df,ticker,fsdates,title_txt='',notes='',facecolor='papaya
|
|
853
864
|
else:
|
854
865
|
foottext=notes+'\n'+footnote
|
855
866
|
|
856
|
-
df_directprint(dfp,title_txt,foottext,facecolor=facecolor)
|
857
|
-
|
867
|
+
#df_directprint(dfp,title_txt,foottext,facecolor=facecolor)
|
868
|
+
df_display_CSS(df=dfp,titletxt=title_txt,footnote=foottext, \
|
869
|
+
first_col_align='left', \
|
870
|
+
facecolor=facecolor,decimals=2)
|
858
871
|
return dfp
|
859
872
|
|
860
873
|
#==============================================================================
|
@@ -976,8 +989,10 @@ def fs_item_analysis_6(df,ticker,fsdates,items,title_txt='',notes='',facecolor='
|
|
976
989
|
else:
|
977
990
|
foottext=notes+'\n'+footnote
|
978
991
|
|
979
|
-
df_directprint(dfp,title_txt,foottext,facecolor=facecolor)
|
980
|
-
|
992
|
+
#df_directprint(dfp,title_txt,foottext,facecolor=facecolor)
|
993
|
+
df_display_CSS(df=dfp,titletxt=title_txt,footnote=foottext, \
|
994
|
+
first_col_align='left', \
|
995
|
+
facecolor=facecolor,decimals=2)
|
981
996
|
return dfp
|
982
997
|
|
983
998
|
#==============================================================================
|
@@ -1117,8 +1132,10 @@ def fs_item_analysis_7(df,tickers,fsdate,items,title_txt='',notes='',facecolor='
|
|
1117
1132
|
else:
|
1118
1133
|
foottext=notes+'\n'+footnote
|
1119
1134
|
|
1120
|
-
df_directprint(dfp,title_txt,foottext,facecolor=facecolor)
|
1121
|
-
|
1135
|
+
#df_directprint(dfp,title_txt,foottext,facecolor=facecolor)
|
1136
|
+
df_display_CSS(df=dfp,titletxt=title_txt,footnote=foottext, \
|
1137
|
+
first_col_align='left', \
|
1138
|
+
facecolor=facecolor,decimals=2)
|
1122
1139
|
return dfp
|
1123
1140
|
|
1124
1141
|
#==============================================================================
|
@@ -1197,8 +1214,10 @@ def fs_item_analysis_8(df,tickers,fsdate,items,title_txt='',notes='',facecolor='
|
|
1197
1214
|
else:
|
1198
1215
|
foottext=notes+'\n'+footnote
|
1199
1216
|
|
1200
|
-
df_directprint(dfp,title_txt,foottext,facecolor=facecolor)
|
1201
|
-
|
1217
|
+
#df_directprint(dfp,title_txt,foottext,facecolor=facecolor)
|
1218
|
+
df_display_CSS(df=dfp,titletxt=title_txt,footnote=foottext, \
|
1219
|
+
first_col_align='left', \
|
1220
|
+
facecolor=facecolor,decimals=2)
|
1202
1221
|
return dfp
|
1203
1222
|
|
1204
1223
|
#==============================================================================
|
@@ -1301,12 +1320,12 @@ def asset_liab_structure_china(tickers,fsdates,facecolor='papayawhip'):
|
|
1301
1320
|
notes3="注3:长期股权投资是指企业对其子公司、合营企业及联营企业的权益性投资"
|
1302
1321
|
notes4="注4:固定资产净额 = 固定资产原值 - 累计折旧 - 资产减值准备"
|
1303
1322
|
notes=notes1+'\n'+notes2+'\n'+notes3+'\n'+notes4
|
1304
|
-
dfp2=fs_item_analysis_1(df,ticker,fsdate,items2,title_txt,notes)
|
1323
|
+
dfp2=fs_item_analysis_1(df,ticker,fsdate,items2,title_txt,notes,facecolor=facecolor)
|
1305
1324
|
|
1306
1325
|
#负债变动趋势
|
1307
1326
|
title_txt=title_head+"主要负债项目"
|
1308
1327
|
items3=["短期借款","长期借款","应付账款","预收款项","应交税费","应付职工薪酬","负债合计"]
|
1309
|
-
dfp3=fs_item_analysis_1(df,ticker,fsdate,items3,title_txt)
|
1328
|
+
dfp3=fs_item_analysis_1(df,ticker,fsdate,items3,title_txt,facecolor=facecolor)
|
1310
1329
|
|
1311
1330
|
#所有者权益变动趋势
|
1312
1331
|
title_txt=title_head+"主要权益项目"
|
@@ -1330,7 +1349,7 @@ def asset_liab_structure_china(tickers,fsdates,facecolor='papayawhip'):
|
|
1330
1349
|
notesB=notes8+'\n'+notes9+'\n'+notes10+'\n'+notes11+'\n'+notes12+'\n'+notes13+'\n'+notes14
|
1331
1350
|
|
1332
1351
|
notes=notesA+'\n'+notesB
|
1333
|
-
dfp4=fs_item_analysis_1(df,ticker,fsdate,items4,title_txt,notes)
|
1352
|
+
dfp4=fs_item_analysis_1(df,ticker,fsdate,items4,title_txt,notes,facecolor=facecolor)
|
1334
1353
|
|
1335
1354
|
### 货币资金与应收项目
|
1336
1355
|
#资产变动趋势1:"货币资金","应收票据","应收账款"
|
@@ -1767,8 +1786,49 @@ def fs_analysis_china(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
1767
1786
|
category='profile',business_period='recent', \
|
1768
1787
|
printout=False,gview=False, \
|
1769
1788
|
loc1='upper left',loc2='upper right', \
|
1770
|
-
facecolor='
|
1789
|
+
facecolor='whitesmoke'):
|
1771
1790
|
"""
|
1791
|
+
【功能】财务报表分析,仅适用于中国A股,注意不适用于港股和美股(含中概股)
|
1792
|
+
|
1793
|
+
选项tickers:必选
|
1794
|
+
单只股票:用于单只股票历史财报对比
|
1795
|
+
股票列表:用于股票之间同期财报横向对比
|
1796
|
+
|
1797
|
+
选项fsdates:必选
|
1798
|
+
单个财报日期:适用于选项tickers为股票列表时
|
1799
|
+
财报日期列表:适用于选项tickers为单只股票时,至少四个财报日期,便于对比
|
1800
|
+
|
1801
|
+
选项analysis_type:
|
1802
|
+
资产负债表分析(默认):balance sheet, asset liability
|
1803
|
+
利润表分析:income statement, cost, expense, earning
|
1804
|
+
现金流量表分析:cash flow, cashflow statement
|
1805
|
+
财报概述:financial summary
|
1806
|
+
财务指标:financial indicator
|
1807
|
+
股票画像:stock profile, 下面还可分别选择不同的category项目
|
1808
|
+
杜邦分析:dupont identify, dupont analysis
|
1809
|
+
杜邦分解:dupont decompose,需要安装graphviz插件
|
1810
|
+
|
1811
|
+
选项category:
|
1812
|
+
基本信息(默认):profile
|
1813
|
+
股东信息:shareholder
|
1814
|
+
历史分红:dividend
|
1815
|
+
主营业务:business
|
1816
|
+
市场估值:valuation
|
1817
|
+
财务概况:financial
|
1818
|
+
|
1819
|
+
选项business_period:
|
1820
|
+
最新(默认):recent,可能为最新可获得的季报或中报或年报
|
1821
|
+
最新的季报:quarterly
|
1822
|
+
最新的中报:semiannual
|
1823
|
+
最新的年报:annual
|
1824
|
+
|
1825
|
+
选项loc1/loc2:适用于需要绘图时指定图例的位置,仅在双图例重叠时手动调整
|
1826
|
+
|
1827
|
+
选项facecolor:指定表格/绘图的背景颜色
|
1828
|
+
烟白色(默认):whitesmoke
|
1829
|
+
其他颜色:参见matplotlib颜色列表,例如淡雅小麦色papayawhip
|
1830
|
+
|
1831
|
+
【备注】封装说明
|
1772
1832
|
套壳函数1:tickers为股票列表,fsdates为财报日期,可为单个日期或日期列表
|
1773
1833
|
asset_liab_china, income_cost_china, cash_flow_china
|
1774
1834
|
|
@@ -1779,9 +1839,9 @@ def fs_analysis_china(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
1779
1839
|
compare_fin_indicator_china
|
1780
1840
|
|
1781
1841
|
套壳函数4:tickers为股票代码,fsdates不需要,
|
1782
|
-
|
1783
|
-
|
1784
|
-
|
1842
|
+
stock_profile_china
|
1843
|
+
|
1844
|
+
套壳函数5/6:杜邦分析compare_dupont_china / 杜邦分解dupont_decompose
|
1785
1845
|
"""
|
1786
1846
|
|
1787
1847
|
# 统一转小写,便于判断
|
siat/grafix.py
CHANGED
@@ -352,6 +352,9 @@ def plot2_line2(df1,ticker1,colname1,label1, \
|
|
352
352
|
date_range=False,date_freq=False,date_fmt='%Y-%m-%d', \
|
353
353
|
color1='red',color2='blue',facecolor='whitesmoke'):
|
354
354
|
"""
|
355
|
+
注意:可能有问题,左纵坐标轴和横坐标轴标记可能发生重叠!
|
356
|
+
facecolor不起作用
|
357
|
+
|
355
358
|
功能:绘制两个证券的折线图。如果power=0不绘制趋势图,否则绘制多项式趋势图
|
356
359
|
假定:数据表有索引,且已经按照索引排序
|
357
360
|
输入:
|
@@ -370,9 +373,9 @@ def plot2_line2(df1,ticker1,colname1,label1, \
|
|
370
373
|
"""
|
371
374
|
#空值判断
|
372
375
|
if len(df1) ==0:
|
373
|
-
print (" #Warning(
|
376
|
+
print (" #Warning(plot2_line2): no data to plot df1.")
|
374
377
|
if len(df2) ==0:
|
375
|
-
print (" #Warning(
|
378
|
+
print (" #Warning(plot2_line2): no data to plot df2.")
|
376
379
|
if (len(df1) ==0) and (len(df2) ==0):
|
377
380
|
return
|
378
381
|
|
@@ -944,7 +947,7 @@ def plot_line2_twinx2(df01,ticker1,colname1,label1, \
|
|
944
947
|
except:
|
945
948
|
print(" #Warning(plot_line2_twinx2): color",facecolor,"is unsupported, changed to default setting")
|
946
949
|
fig.gca().set_facecolor("whitesmoke")
|
947
|
-
|
950
|
+
|
948
951
|
ax = fig.add_subplot(111)
|
949
952
|
|
950
953
|
if ticker1 == '':
|
@@ -957,6 +960,7 @@ def plot_line2_twinx2(df01,ticker1,colname1,label1, \
|
|
957
960
|
|
958
961
|
date_start=df1.index[0]
|
959
962
|
date_end=df1.index[-1]
|
963
|
+
|
960
964
|
if date_range and not date_freq:
|
961
965
|
ax.xaxis.set_major_formatter(mdate.DateFormatter(date_fmt))
|
962
966
|
plt.xticks(pd.date_range(date_start,date_end))
|
@@ -995,6 +999,18 @@ def plot_line2_twinx2(df01,ticker1,colname1,label1, \
|
|
995
999
|
else:
|
996
1000
|
label1txt=ticker_name(ticker1,ticker_type_list[0])+"("+trend_txt+")"
|
997
1001
|
ax.plot(df1.index, f(df1.id),"r--", label=label1txt,linewidth=1)
|
1002
|
+
|
1003
|
+
ax.set_xlabel(footnote,fontsize=xlabel_txt_size)
|
1004
|
+
|
1005
|
+
if ticker1 == '':
|
1006
|
+
label1txt=label1
|
1007
|
+
else:
|
1008
|
+
if label1 == "":
|
1009
|
+
label1txt=ticker_name(ticker1,ticker_type_list[0])
|
1010
|
+
else:
|
1011
|
+
label1txt=label1+'('+ticker_name(ticker1,ticker_type_list[0])+')'
|
1012
|
+
ax.set_ylabel(label1txt,fontsize=ylabel_txt_size)
|
1013
|
+
ax.legend(loc=loc1,fontsize=legend_txt_size)
|
998
1014
|
|
999
1015
|
#绘证券2:建立第二y轴
|
1000
1016
|
ax2 = ax.twinx()
|
@@ -1010,13 +1026,13 @@ def plot_line2_twinx2(df01,ticker1,colname1,label1, \
|
|
1010
1026
|
date_start=df2.index[0]
|
1011
1027
|
date_end=df2.index[-1]
|
1012
1028
|
if date_range and not date_freq:
|
1013
|
-
|
1029
|
+
ax2.xaxis.set_major_formatter(mdate.DateFormatter(date_fmt))
|
1014
1030
|
plt.xticks(pd.date_range(date_start,date_end))
|
1015
1031
|
if not date_range and date_freq:
|
1016
|
-
|
1032
|
+
ax2.xaxis.set_major_formatter(mdate.DateFormatter(date_fmt))
|
1017
1033
|
plt.xticks(pd.date_range(freq=date_freq))
|
1018
1034
|
if date_range and date_freq:
|
1019
|
-
|
1035
|
+
ax2.xaxis.set_major_formatter(mdate.DateFormatter(date_fmt))
|
1020
1036
|
plt.xticks(pd.date_range(date_start,date_end,freq=date_freq))
|
1021
1037
|
|
1022
1038
|
lwadjust=linewidth_adjust(df2)
|
@@ -1048,18 +1064,6 @@ def plot_line2_twinx2(df01,ticker1,colname1,label1, \
|
|
1048
1064
|
label2txt=ticker_name(ticker2,ticker_type_list[1])+"("+trend_txt+")"
|
1049
1065
|
|
1050
1066
|
ax2.plot(df2.index, f(df2.id),"c--", label=label2txt,linewidth=1)
|
1051
|
-
|
1052
|
-
ax.set_xlabel(footnote,fontsize=xlabel_txt_size)
|
1053
|
-
|
1054
|
-
if ticker1 == '':
|
1055
|
-
label1txt=label1
|
1056
|
-
else:
|
1057
|
-
if label1 == "":
|
1058
|
-
label1txt=ticker_name(ticker1,ticker_type_list[0])
|
1059
|
-
else:
|
1060
|
-
label1txt=label1+'('+ticker_name(ticker1,ticker_type_list[0])+')'
|
1061
|
-
ax.set_ylabel(label1txt,fontsize=ylabel_txt_size)
|
1062
|
-
ax.legend(loc=loc1,fontsize=legend_txt_size)
|
1063
1067
|
|
1064
1068
|
if ticker2 == '':
|
1065
1069
|
label2txt=label2
|
siat/stock_china.py
CHANGED
@@ -1100,8 +1100,11 @@ def stock_profile_china(ticker,category='profile', \
|
|
1100
1100
|
business_period='recent', \
|
1101
1101
|
financial_quarters=8, \
|
1102
1102
|
valuation_start='2020-1-1', \
|
1103
|
+
|
1104
|
+
#参数prettytab和tabborder弃用,保留只为了兼容性
|
1103
1105
|
prettytab=False, \
|
1104
1106
|
tabborder=False, \
|
1107
|
+
|
1105
1108
|
loc1='upper left',loc2='upper right', \
|
1106
1109
|
facecolor='papayawhip'):
|
1107
1110
|
"""
|
@@ -1122,6 +1125,8 @@ def stock_profile_china(ticker,category='profile', \
|
|
1122
1125
|
返回值:无。
|
1123
1126
|
建议运行环境:Anaconda Jupyter Notebook,其他环境未测试。
|
1124
1127
|
"""
|
1128
|
+
DEBUG=False
|
1129
|
+
|
1125
1130
|
#检查是否A股
|
1126
1131
|
_,_,suffix=split_prefix_suffix(ticker)
|
1127
1132
|
if not (suffix.upper() in ['SS','SZ','BJ']):
|
@@ -1148,15 +1153,15 @@ def stock_profile_china(ticker,category='profile', \
|
|
1148
1153
|
baiwan=1000000.0
|
1149
1154
|
wan=10000.0
|
1150
1155
|
|
1151
|
-
|
1156
|
+
import akshare as ak
|
1152
1157
|
# 个股基本信息======================================================================================
|
1153
|
-
if category
|
1158
|
+
if any(s in category for s in ['profile','basic']): #判断category中是否包含任意子串
|
1154
1159
|
|
1155
1160
|
# 个股基本信息查询1=============================================================================
|
1156
1161
|
try:
|
1157
1162
|
df6=ak.stock_profile_cninfo(symbol=ticker1)
|
1158
1163
|
except:
|
1159
|
-
print(" #Warning(stock_profile_china): profile info not found for",
|
1164
|
+
print(" #Warning(stock_profile_china): profile info not found or inaccessible for",ticker1)
|
1160
1165
|
return
|
1161
1166
|
|
1162
1167
|
# 整理信息
|
@@ -1228,7 +1233,8 @@ def stock_profile_china(ticker,category='profile', \
|
|
1228
1233
|
dftmp15=dftmp14.T
|
1229
1234
|
dftmp15.reset_index(inplace=True)
|
1230
1235
|
|
1231
|
-
titletxt=ticker_name(ticker)
|
1236
|
+
titletxt=ticker_name(ticker)
|
1237
|
+
"""
|
1232
1238
|
if prettytab:
|
1233
1239
|
pandas2prettytable(dftmp15,titletxt,firstColSpecial=False,leftColAlign='l',otherColAlign='l',tabborder=tabborder)
|
1234
1240
|
print(' ','数据来源:巨潮资讯,',str(today))
|
@@ -1236,16 +1242,21 @@ def stock_profile_china(ticker,category='profile', \
|
|
1236
1242
|
print('\n*** '+titletxt+'\n')
|
1237
1243
|
print(dftmp15.to_markdown(tablefmt='Simple',index=False,colalign=['left']))
|
1238
1244
|
print('\n数据来源:巨潮资讯,',str(today))
|
1239
|
-
|
1240
|
-
|
1245
|
+
"""
|
1246
|
+
titletxt1=titletxt+":基本信息"
|
1247
|
+
footnote='数据来源:巨潮资讯,'+str(today)
|
1248
|
+
df_display_CSS(df=dftmp15,titletxt=titletxt1,footnote=footnote, \
|
1249
|
+
facecolor=facecolor,decimals=2,last_col_align='left')
|
1250
|
+
|
1251
|
+
print("*****",titletxt+":业务范围")
|
1241
1252
|
longtext=df6.iloc[0]["主营业务"]
|
1242
1253
|
print_sentence(longtext,mid_symbol=[';','。'])
|
1243
1254
|
|
1244
|
-
print("\n
|
1255
|
+
print("\n*****",titletxt+":经营范围")
|
1245
1256
|
longtext=df6.iloc[0]["经营范围"]
|
1246
1257
|
print_sentence(longtext,mid_symbol=[';','。'])
|
1247
1258
|
|
1248
|
-
print("\n
|
1259
|
+
print("\n*****",titletxt+":机构简介")
|
1249
1260
|
longtext=df6.iloc[0]["机构简介"]
|
1250
1261
|
print_sentence(longtext,mid_symbol=[';','。'])
|
1251
1262
|
|
@@ -1296,7 +1307,8 @@ def stock_profile_china(ticker,category='profile', \
|
|
1296
1307
|
cols2=['分类方向','分类','营业收入-同比增长','营业成本-同比增长','毛利率','毛利率-同比增长']
|
1297
1308
|
|
1298
1309
|
dftmp1=dftmp[cols1]
|
1299
|
-
titletxt1=ticker_name(ticker)+':主营业务构成,'+period
|
1310
|
+
titletxt1=ticker_name(ticker)+':主营业务构成,'+period
|
1311
|
+
"""
|
1300
1312
|
if prettytab:
|
1301
1313
|
pandas2prettytable(dftmp1,titletxt1,firstColSpecial=True,leftColAlign='l',otherColAlign='c',tabborder=tabborder)
|
1302
1314
|
print(' ','数据来源:益盟-F10,',str(today))
|
@@ -1304,9 +1316,15 @@ def stock_profile_china(ticker,category='profile', \
|
|
1304
1316
|
print('\n*** '+titletxt1+'\n')
|
1305
1317
|
print(dftmp1.to_markdown(tablefmt='Simple',index=False,colalign=['left','left','right','right','right','right','right']))
|
1306
1318
|
print('\n数据来源:益盟-F10,',str(today))
|
1319
|
+
"""
|
1320
|
+
footnote='数据来源:益盟-F10,'+str(today)
|
1321
|
+
df_display_CSS(df=dftmp1,titletxt=titletxt1,footnote=footnote, \
|
1322
|
+
first_col_align='left',second_col_align='left', \
|
1323
|
+
facecolor=facecolor,decimals=2)
|
1307
1324
|
|
1308
1325
|
dftmp2=dftmp[cols2]
|
1309
|
-
titletxt2=ticker_name(ticker)+':主营业务增长,'+period
|
1326
|
+
titletxt2=ticker_name(ticker)+':主营业务增长,'+period
|
1327
|
+
"""
|
1310
1328
|
if prettytab:
|
1311
1329
|
pandas2prettytable(dftmp2,titletxt2,firstColSpecial=True,leftColAlign='l',otherColAlign='c',tabborder=tabborder)
|
1312
1330
|
print(' ','数据来源:益盟-F10,',str(today))
|
@@ -1314,7 +1332,11 @@ def stock_profile_china(ticker,category='profile', \
|
|
1314
1332
|
print('\n*** '+titletxt2+'\n')
|
1315
1333
|
print(dftmp2.to_markdown(tablefmt='Simple',index=False,colalign=['left','left','right','right','right','right']))
|
1316
1334
|
print('\n数据来源:益盟-F10,',str(today))
|
1317
|
-
|
1335
|
+
"""
|
1336
|
+
df_display_CSS(df=dftmp2,titletxt=titletxt2,footnote=footnote, \
|
1337
|
+
first_col_align='left',second_col_align='left', \
|
1338
|
+
facecolor=facecolor,decimals=2)
|
1339
|
+
|
1318
1340
|
# 历史分红信息查询=============================================================================
|
1319
1341
|
"""
|
1320
1342
|
if category == 'dividend':
|
@@ -1357,7 +1379,8 @@ def stock_profile_china(ticker,category='profile', \
|
|
1357
1379
|
print(dftmp3.to_markdown(tablefmt='Simple',index=False,colalign=['left','center','center','right','center','center','center','left']))
|
1358
1380
|
print('\n数据来源:巨潮资讯,',str(today))
|
1359
1381
|
"""
|
1360
|
-
if category
|
1382
|
+
#if category in ['dividend','split']:
|
1383
|
+
if any(s in category for s in ['dividend','split']):
|
1361
1384
|
# 分红
|
1362
1385
|
titletxt=ticker_name(ticker)+':分红历史'
|
1363
1386
|
try:
|
@@ -1384,6 +1407,7 @@ def stock_profile_china(ticker,category='profile', \
|
|
1384
1407
|
dftmp3=dftmp[newcols]
|
1385
1408
|
|
1386
1409
|
titletxt=ticker_name(ticker)+':分红历史'
|
1410
|
+
"""
|
1387
1411
|
if prettytab:
|
1388
1412
|
pandas2prettytable(dftmp3,titletxt,firstColSpecial=False,leftColAlign='l',otherColAlign='c',tabborder=tabborder)
|
1389
1413
|
print('【注】送股/转增:股数/10股,派息:元(税前)/10股,数据来源:新浪财经,',str(today))
|
@@ -1392,6 +1416,10 @@ def stock_profile_china(ticker,category='profile', \
|
|
1392
1416
|
alignlist=['center']+['right']*(len(list(dftmp3))-1)
|
1393
1417
|
print(dftmp3.to_markdown(tablefmt='Simple',index=False,colalign=alignlist))
|
1394
1418
|
print('【注】送股/转增:股数/10股,派息:元(税前)/10股,数据来源:新浪财经,',str(today))
|
1419
|
+
"""
|
1420
|
+
footnote='【注】送股/转增:股数/10股,派息:元(税前)/10股,数据来源:新浪财经,'+str(today)
|
1421
|
+
df_display_CSS(df=dftmp3,titletxt=titletxt,footnote=footnote, \
|
1422
|
+
facecolor=facecolor,decimals=2)
|
1395
1423
|
|
1396
1424
|
# 配股
|
1397
1425
|
titletxt=ticker_name(ticker)+':配股历史'
|
@@ -1400,13 +1428,13 @@ def stock_profile_china(ticker,category='profile', \
|
|
1400
1428
|
except:
|
1401
1429
|
print('')
|
1402
1430
|
print(titletxt)
|
1403
|
-
print(" #Warning(stock_profile_china):
|
1431
|
+
print(" #Warning(stock_profile_china): allotment info not found for stock",ticker)
|
1404
1432
|
return
|
1405
1433
|
|
1406
1434
|
if len(df3p)==0:
|
1407
1435
|
print('')
|
1408
1436
|
print(titletxt)
|
1409
|
-
print("
|
1437
|
+
print(" #Warning(stock_profile_china): no allotment info found for stock",ticker)
|
1410
1438
|
return
|
1411
1439
|
|
1412
1440
|
# 整理信息
|
@@ -1415,7 +1443,7 @@ def stock_profile_china(ticker,category='profile', \
|
|
1415
1443
|
|
1416
1444
|
newcols=['公告日期','配股方案','配股价格','股权登记日','除权日','缴款起始日','缴款终止日','配股上市日']
|
1417
1445
|
dftmp3=dftmp[newcols]
|
1418
|
-
|
1446
|
+
"""
|
1419
1447
|
if prettytab:
|
1420
1448
|
pandas2prettytable(dftmp3,titletxt,firstColSpecial=False,leftColAlign='l',otherColAlign='c',tabborder=tabborder)
|
1421
1449
|
print('【注】配股方案:每10股的配股数,配股价格为元。数据来源:新浪财经,',str(today))
|
@@ -1424,10 +1452,15 @@ def stock_profile_china(ticker,category='profile', \
|
|
1424
1452
|
alignlist=['center']+['right']*(len(list(dftmp3))-1)
|
1425
1453
|
print(dftmp3.to_markdown(tablefmt='Simple',index=False,colalign=alignlist))
|
1426
1454
|
print('【注】配股方案:每10股的配股数,配股价格为元。数据来源:新浪财经,',str(today))
|
1427
|
-
|
1455
|
+
"""
|
1456
|
+
footnote='【注】配股方案:每10股的配股数,配股价格为元。数据来源:新浪财经,'+str(today)
|
1457
|
+
df_display_CSS(df=dftmp3,titletxt=titletxt,footnote=footnote, \
|
1458
|
+
facecolor=facecolor,decimals=2)
|
1459
|
+
|
1428
1460
|
|
1429
1461
|
# 主要股东信息查询=============================================================================
|
1430
|
-
if category
|
1462
|
+
#if category in ['shareholder','investor']:
|
1463
|
+
if any(s in category for s in ['shareholder','investor']):
|
1431
1464
|
try:
|
1432
1465
|
df4=ak.stock_main_stock_holder(stock=ticker1)
|
1433
1466
|
except:
|
@@ -1470,7 +1503,9 @@ def stock_profile_china(ticker,category='profile', \
|
|
1470
1503
|
return
|
1471
1504
|
|
1472
1505
|
#df4b=df4a[df4a['持股比例'] != 0]
|
1473
|
-
df4a['持股比例'].replace(0,'unknown',inplace=True)
|
1506
|
+
#df4a['持股比例'].replace(0,'unknown',inplace=True)
|
1507
|
+
#df4a['持股比例'].replace(0,'?',inplace=True)
|
1508
|
+
df4a['持股比例'].replace(0,'--',inplace=True)
|
1474
1509
|
dftmp=df4a.head(10).copy(deep=True)
|
1475
1510
|
|
1476
1511
|
enddate=str(dftmp.head(1)['截至日期'][0])
|
@@ -1498,7 +1533,7 @@ def stock_profile_china(ticker,category='profile', \
|
|
1498
1533
|
#newcols=['编号','股东名称','股本性质','持股比例(%)','持股数量(百万股)']
|
1499
1534
|
newcols=['编号','股东名称','股本性质','持股比例(%)']
|
1500
1535
|
dftmp1=dftmp[newcols]
|
1501
|
-
|
1536
|
+
"""
|
1502
1537
|
if prettytab:
|
1503
1538
|
pandas2prettytable(dftmp1,titletxt,firstColSpecial=False,leftColAlign='c',otherColAlign='c',tabborder=tabborder)
|
1504
1539
|
print(' ','数据来源:新浪财经,',str(today))
|
@@ -1507,10 +1542,16 @@ def stock_profile_china(ticker,category='profile', \
|
|
1507
1542
|
#print(dftmp1.to_markdown(tablefmt='Simple',index=False,colalign=['center','left','left','right','right']))
|
1508
1543
|
print(dftmp1.to_markdown(tablefmt='Simple',index=False,colalign=['center','left','left','right']))
|
1509
1544
|
print('\n数据来源:新浪财经,',str(today))
|
1510
|
-
|
1545
|
+
"""
|
1546
|
+
footnote='数据来源:新浪财经,'+str(today)
|
1547
|
+
df_display_CSS(df=dftmp1,titletxt=titletxt,footnote=footnote, \
|
1548
|
+
first_col_align='center',second_col_align='left', \
|
1549
|
+
facecolor=facecolor,decimals=2)
|
1550
|
+
|
1511
1551
|
|
1512
1552
|
# 主要市场指标查询=============================================================================
|
1513
|
-
if category == 'valuation':
|
1553
|
+
#if category == 'valuation':
|
1554
|
+
if any(s in category for s in ['valuation','market']):
|
1514
1555
|
try:
|
1515
1556
|
#df5=ak.stock_a_lg_indicator(symbol=ticker1)
|
1516
1557
|
df5=ak.stock_a_indicator_lg(symbol=ticker1)
|
@@ -1544,7 +1585,8 @@ def stock_profile_china(ticker,category='profile', \
|
|
1544
1585
|
footnote3="数据来源:乐咕乐股,"+str(today)
|
1545
1586
|
|
1546
1587
|
# 计算市盈率的均值,中位数、最大最小值
|
1547
|
-
va='pe'; va_name="市盈率"
|
1588
|
+
#va='pe'; va_name="市盈率"
|
1589
|
+
va='pe_ttm'; va_name="市盈率TTM"
|
1548
1590
|
va_mean=round(dftmp2[va].mean(),1)
|
1549
1591
|
va_median=round(dftmp2[va].median(),1)
|
1550
1592
|
va_max=round(dftmp2[va].max(),1)
|
@@ -1554,12 +1596,23 @@ def stock_profile_china(ticker,category='profile', \
|
|
1554
1596
|
footnote=va_txt+";"+mv_txt+"\n"+footnote3
|
1555
1597
|
|
1556
1598
|
# 市盈率与总市值
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1599
|
+
if DEBUG:
|
1600
|
+
display(dftmp2)
|
1601
|
+
"""
|
1602
|
+
plot2_line2(df1=dftmp2,ticker1='',colname1=va,label1=va_name, \
|
1603
|
+
df2=dftmp2,ticker2='',colname2='total_mv(yi)',label2='总市值(亿元)', \
|
1604
|
+
ylabeltxt='',titletxt=titletxt,footnote=footnote, \
|
1605
|
+
date_range=True,date_freq='Q',date_fmt='%Y-%m',twinx=True, \
|
1606
|
+
resample_freq='D', \
|
1607
|
+
loc1=loc1,loc2=loc2, \
|
1608
|
+
color1='red',color2='blue',facecolor=facecolor)
|
1609
|
+
"""
|
1610
|
+
plot_line2(df1=dftmp2,ticker1='',colname1=va,label1=va_name, \
|
1611
|
+
df2=dftmp2,ticker2='',colname2='total_mv(yi)',label2='总市值(亿元)', \
|
1612
|
+
ylabeltxt='',titletxt=titletxt,footnote=footnote, \
|
1613
|
+
twinx=True, \
|
1614
|
+
resample_freq='D',loc1='best',loc2='best', \
|
1615
|
+
color1='red',color2='blue',facecolor='whitesmoke')
|
1563
1616
|
|
1564
1617
|
# 计算市净率的均值,中位数、最大最小值
|
1565
1618
|
va='pb'; va_name="市净率"
|
@@ -1571,16 +1624,24 @@ def stock_profile_china(ticker,category='profile', \
|
|
1571
1624
|
|
1572
1625
|
footnote=va_txt+";"+mv_txt+"\n"+footnote3
|
1573
1626
|
|
1574
|
-
#
|
1627
|
+
# 市净率与总市值
|
1628
|
+
"""
|
1575
1629
|
plot2_line2(dftmp2,'',va,va_name, \
|
1576
1630
|
dftmp2,'','total_mv(yi)','总市值(亿元)', \
|
1577
1631
|
'',titletxt,footnote, \
|
1578
1632
|
date_range=True,date_freq='Q',date_fmt='%Y-%m',twinx=True, \
|
1579
1633
|
resample_freq='D',loc1=loc1,loc2=loc2, \
|
1580
|
-
color1='red',color2='blue')
|
1581
|
-
|
1634
|
+
color1='red',color2='blue',facecolor=facecolor)
|
1635
|
+
"""
|
1636
|
+
plot_line2(df1=dftmp2,ticker1='',colname1=va,label1=va_name, \
|
1637
|
+
df2=dftmp2,ticker2='',colname2='total_mv(yi)',label2='总市值(亿元)', \
|
1638
|
+
ylabeltxt='',titletxt=titletxt,footnote=footnote, \
|
1639
|
+
twinx=True, \
|
1640
|
+
resample_freq='D',loc1='best',loc2='best', \
|
1641
|
+
color1='red',color2='blue',facecolor='whitesmoke')
|
1642
|
+
|
1582
1643
|
# 计算市销率的均值,中位数、最大最小值
|
1583
|
-
va='
|
1644
|
+
va='ps_ttm'; va_name="市销率TTM"
|
1584
1645
|
va_mean=round(dftmp2[va].mean(),1)
|
1585
1646
|
va_median=round(dftmp2[va].median(),1)
|
1586
1647
|
va_max=round(dftmp2[va].max(),1)
|
@@ -1589,16 +1650,25 @@ def stock_profile_china(ticker,category='profile', \
|
|
1589
1650
|
|
1590
1651
|
footnote=va_txt+";"+mv_txt+"\n"+footnote3
|
1591
1652
|
|
1592
|
-
#
|
1653
|
+
# 市销率与总市值
|
1654
|
+
"""
|
1593
1655
|
plot2_line2(dftmp2,'',va,va_name, \
|
1594
1656
|
dftmp2,'','total_mv(yi)','总市值(亿元)', \
|
1595
1657
|
'',titletxt,footnote, \
|
1596
1658
|
date_range=True,date_freq='Q',date_fmt='%Y-%m',twinx=True, \
|
1597
1659
|
resample_freq='D',loc1=loc1,loc2=loc2, \
|
1598
|
-
color1='red',color2='blue')
|
1660
|
+
color1='red',color2='blue',facecolor=facecolor)
|
1661
|
+
"""
|
1662
|
+
plot_line2(df1=dftmp2,ticker1='',colname1=va,label1=va_name, \
|
1663
|
+
df2=dftmp2,ticker2='',colname2='total_mv(yi)',label2='总市值(亿元)', \
|
1664
|
+
ylabeltxt='',titletxt=titletxt,footnote=footnote, \
|
1665
|
+
twinx=True, \
|
1666
|
+
resample_freq='D',loc1='best',loc2='best', \
|
1667
|
+
color1='red',color2='blue',facecolor='whitesmoke')
|
1599
1668
|
|
1600
1669
|
# 计算股息率的均值,中位数、最大最小值
|
1601
|
-
va='dv_ratio'; va_name="股息率"
|
1670
|
+
#va='dv_ratio'; va_name="股息率"
|
1671
|
+
va='dv_ttm'; va_name="股息率TTM"
|
1602
1672
|
va_mean=round(dftmp2[va].mean(),1)
|
1603
1673
|
va_median=round(dftmp2[va].median(),1)
|
1604
1674
|
va_max=round(dftmp2[va].max(),1)
|
@@ -1607,16 +1677,26 @@ def stock_profile_china(ticker,category='profile', \
|
|
1607
1677
|
|
1608
1678
|
footnote=va_txt+";"+mv_txt+"\n"+footnote3
|
1609
1679
|
|
1610
|
-
#
|
1680
|
+
# 股息率与总市值
|
1681
|
+
"""
|
1611
1682
|
plot2_line2(dftmp2,'',va,va_name+'%', \
|
1612
1683
|
dftmp2,'','total_mv(yi)','总市值(亿元)', \
|
1613
1684
|
'',titletxt,footnote, \
|
1614
1685
|
date_range=True,date_freq='Q',date_fmt='%Y-%m',twinx=True, \
|
1615
|
-
|
1616
|
-
color1='red',color2='blue')
|
1617
|
-
|
1686
|
+
loc1=loc1,loc2=loc2, \
|
1687
|
+
color1='red',color2='blue',facecolor=facecolor)
|
1688
|
+
"""
|
1689
|
+
plot_line2(df1=dftmp2,ticker1='',colname1=va,label1=va_name+'%', \
|
1690
|
+
df2=dftmp2,ticker2='',colname2='total_mv(yi)',label2='总市值(亿元)', \
|
1691
|
+
ylabeltxt='',titletxt=titletxt,footnote=footnote, \
|
1692
|
+
twinx=True, \
|
1693
|
+
resample_freq='D',loc1='best',loc2='best', \
|
1694
|
+
color1='red',color2='blue',facecolor='whitesmoke')
|
1695
|
+
|
1696
|
+
|
1618
1697
|
# 财务基本面指标查询=============================================================================
|
1619
|
-
if category == 'financial':
|
1698
|
+
#if category == 'financial':
|
1699
|
+
if any(s in category for s in ['financial','healthy']):
|
1620
1700
|
|
1621
1701
|
try:
|
1622
1702
|
df7=ak.stock_financial_analysis_indicator(symbol=ticker1)
|
@@ -1654,7 +1734,7 @@ def stock_profile_china(ticker,category='profile', \
|
|
1654
1734
|
dftmp1=dftmp.T
|
1655
1735
|
dftmp1.reset_index(inplace=True)
|
1656
1736
|
dftmp1.rename(columns={'index':'项目'},inplace=True)
|
1657
|
-
|
1737
|
+
"""
|
1658
1738
|
if prettytab:
|
1659
1739
|
pandas2prettytable(dftmp1,titletxt,firstColSpecial=False,leftColAlign='l',otherColAlign='r',tabborder=tabborder)
|
1660
1740
|
print(' ','数据来源:新浪财经,',str(today))
|
@@ -1663,7 +1743,12 @@ def stock_profile_china(ticker,category='profile', \
|
|
1663
1743
|
colalignList=['left','right','right','right','right','right','right','right','right']
|
1664
1744
|
print(dftmp1.to_markdown(tablefmt='Simple',index=False,colalign=colalignList))
|
1665
1745
|
print('\n数据来源:新浪财经,',str(today))
|
1666
|
-
|
1746
|
+
"""
|
1747
|
+
footnote='数据来源:新浪财经,'+str(today)
|
1748
|
+
df_display_CSS(df=dftmp1,titletxt=titletxt,footnote=footnote, \
|
1749
|
+
facecolor=facecolor,decimals=2, \
|
1750
|
+
heading_font_size='16px',data_font_size='16px')
|
1751
|
+
|
1667
1752
|
"""
|
1668
1753
|
加权平均每股收益:
|
1669
1754
|
指计算时股份数用按月对总股数加权计算的数据,理由是由于公司投入的资本和资产不同,收益产生的基础也不同。
|
@@ -1704,7 +1789,7 @@ def stock_profile_china(ticker,category='profile', \
|
|
1704
1789
|
dftmp1=dftmp.T
|
1705
1790
|
dftmp1.reset_index(inplace=True)
|
1706
1791
|
dftmp1.rename(columns={'index':'项目'},inplace=True)
|
1707
|
-
|
1792
|
+
"""
|
1708
1793
|
if prettytab:
|
1709
1794
|
pandas2prettytable(dftmp1,titletxt,firstColSpecial=False,leftColAlign='l',otherColAlign='r',tabborder=tabborder)
|
1710
1795
|
print(' ','数据来源:新浪财经,',str(today))
|
@@ -1713,7 +1798,12 @@ def stock_profile_china(ticker,category='profile', \
|
|
1713
1798
|
colalignList=['left','right','right','right','right','right','right','right','right']
|
1714
1799
|
print(dftmp1.to_markdown(tablefmt='Simple',index=False,colalign=colalignList))
|
1715
1800
|
print('\n数据来源:新浪财经,',str(today))
|
1716
|
-
|
1801
|
+
"""
|
1802
|
+
df_display_CSS(df=dftmp1,titletxt=titletxt,footnote=footnote, \
|
1803
|
+
facecolor=facecolor,decimals=2, \
|
1804
|
+
heading_font_size='16px',data_font_size='16px')
|
1805
|
+
|
1806
|
+
|
1717
1807
|
"""
|
1718
1808
|
总资产利润率=利润总额/平均总资产
|
1719
1809
|
总资产净利润率=净利润/平均总资产
|
@@ -1744,7 +1834,7 @@ def stock_profile_china(ticker,category='profile', \
|
|
1744
1834
|
dftmp2=dftmp1.T
|
1745
1835
|
dftmp2.reset_index(inplace=True)
|
1746
1836
|
dftmp2.rename(columns={'index':'项目'},inplace=True)
|
1747
|
-
|
1837
|
+
"""
|
1748
1838
|
if prettytab:
|
1749
1839
|
pandas2prettytable(dftmp2,titletxt,firstColSpecial=False,leftColAlign='l',otherColAlign='r',tabborder=tabborder)
|
1750
1840
|
print(' ','数据来源:新浪财经,',str(today))
|
@@ -1753,7 +1843,12 @@ def stock_profile_china(ticker,category='profile', \
|
|
1753
1843
|
colalignList=['left','right','right','right','right','right','right','right','right']
|
1754
1844
|
print(dftmp2.to_markdown(tablefmt='Simple',index=False,colalign=colalignList))
|
1755
1845
|
print('\n数据来源:新浪财经,',str(today))
|
1756
|
-
|
1846
|
+
"""
|
1847
|
+
df_display_CSS(df=dftmp2,titletxt=titletxt,footnote=footnote, \
|
1848
|
+
facecolor=facecolor,decimals=2, \
|
1849
|
+
heading_font_size='16px',data_font_size='16px')
|
1850
|
+
|
1851
|
+
|
1757
1852
|
"""
|
1758
1853
|
净资产收益率=净利润/净资产。净资产=所有者权益+少数股东权益
|
1759
1854
|
|
@@ -1778,7 +1873,7 @@ def stock_profile_china(ticker,category='profile', \
|
|
1778
1873
|
dftmp1=dftmp.T
|
1779
1874
|
dftmp1.reset_index(inplace=True)
|
1780
1875
|
dftmp1.rename(columns={'index':'项目'},inplace=True)
|
1781
|
-
|
1876
|
+
"""
|
1782
1877
|
if prettytab:
|
1783
1878
|
pandas2prettytable(dftmp1,titletxt,firstColSpecial=False,leftColAlign='l',otherColAlign='r',tabborder=tabborder)
|
1784
1879
|
print(' ','数据来源:新浪财经,',str(today))
|
@@ -1789,7 +1884,10 @@ def stock_profile_china(ticker,category='profile', \
|
|
1789
1884
|
print('\n数据来源:新浪财经,',str(today))
|
1790
1885
|
|
1791
1886
|
"""
|
1792
|
-
|
1887
|
+
df_display_CSS(df=dftmp1,titletxt=titletxt,footnote=footnote, \
|
1888
|
+
facecolor=facecolor,decimals=2, \
|
1889
|
+
heading_font_size='16px',data_font_size='16px')
|
1890
|
+
|
1793
1891
|
|
1794
1892
|
titletxt=ticker_name(ticker)+":主要财务信息,资产负债分析"
|
1795
1893
|
colList=['日期','财报类别','流动比率','速动比率','现金比率(%)','利息支付倍数','长期债务与营运资金比率(%)', \
|
@@ -1818,7 +1916,7 @@ def stock_profile_china(ticker,category='profile', \
|
|
1818
1916
|
dftmp1=dftmp.T
|
1819
1917
|
dftmp1.reset_index(inplace=True)
|
1820
1918
|
dftmp1.rename(columns={'index':'项目'},inplace=True)
|
1821
|
-
|
1919
|
+
"""
|
1822
1920
|
if prettytab:
|
1823
1921
|
pandas2prettytable(dftmp1,titletxt,firstColSpecial=False,leftColAlign='l',otherColAlign='r',tabborder=tabborder)
|
1824
1922
|
print(' ','数据来源:新浪财经,',str(today))
|
@@ -1827,7 +1925,12 @@ def stock_profile_china(ticker,category='profile', \
|
|
1827
1925
|
colalignList=['left','right','right','right','right','right','right','right','right']
|
1828
1926
|
print(dftmp1.to_markdown(tablefmt='Simple',index=False,colalign=colalignList))
|
1829
1927
|
print('\n数据来源:新浪财经,',str(today))
|
1830
|
-
|
1928
|
+
"""
|
1929
|
+
df_display_CSS(df=dftmp1,titletxt=titletxt,footnote=footnote, \
|
1930
|
+
facecolor=facecolor,decimals=2, \
|
1931
|
+
heading_font_size='16px',data_font_size='16px')
|
1932
|
+
|
1933
|
+
|
1831
1934
|
"""
|
1832
1935
|
股东权益比率(又称自有资本比率或净资产比率)是股东权益与资产总额的比率。
|
1833
1936
|
固定资产净值率是指固定资产原价扣除其累计磨损额后的余额即固定资产折余价值对固定资产原价的比率。
|
@@ -1859,7 +1962,7 @@ def stock_profile_china(ticker,category='profile', \
|
|
1859
1962
|
dftmp1.reset_index(inplace=True)
|
1860
1963
|
dftmp1.rename(columns={'index':'项目'},inplace=True)
|
1861
1964
|
|
1862
|
-
|
1965
|
+
"""
|
1863
1966
|
if prettytab:
|
1864
1967
|
pandas2prettytable(dftmp1,titletxt,firstColSpecial=False,leftColAlign='l',otherColAlign='r',tabborder=tabborder)
|
1865
1968
|
print(' ','数据来源:新浪财经,',str(today))
|
@@ -1868,7 +1971,11 @@ def stock_profile_china(ticker,category='profile', \
|
|
1868
1971
|
colalignList=['left','right','right','right','right','right','right','right','right']
|
1869
1972
|
print(dftmp1.to_markdown(tablefmt='Simple',index=False,colalign=colalignList))
|
1870
1973
|
print('\n数据来源:新浪财经,',str(today))
|
1871
|
-
|
1974
|
+
"""
|
1975
|
+
df_display_CSS(df=dftmp1,titletxt=titletxt,footnote=footnote, \
|
1976
|
+
facecolor=facecolor,decimals=2, \
|
1977
|
+
heading_font_size='15px',data_font_size='15px')
|
1978
|
+
|
1872
1979
|
"""
|
1873
1980
|
资产的经营现金流量回报率是经营活动产生的现金流量净额/总资产,是体现企业收现能力的指标之一。
|
1874
1981
|
|
@@ -17,7 +17,7 @@ siat/capm_beta.py,sha256=cxXdRVBQBllhbfz1LeTJAIWvyRYhW54nhtNUXv4HwS0,29063
|
|
17
17
|
siat/capm_beta2.py,sha256=hta-X1iWPjNbG1YYIVlQF-YvKA8An3KuEyLmUEZ3hH8,25562
|
18
18
|
siat/capm_beta_test.py,sha256=ImR0c5mc4hIl714XmHztdl7qg8v1E2lycKyiqnFj6qs,1745
|
19
19
|
siat/cmat_commons.py,sha256=Nj9Kf0alywaztVoMVeVVL_EZk5jRERJy8R8kBw88_Tg,38116
|
20
|
-
siat/common.py,sha256=
|
20
|
+
siat/common.py,sha256=egDH2ihlNYMC8hAMQq2JRrJH8_52VenHTYeMBPnVJdI,139936
|
21
21
|
siat/compare_cross.py,sha256=3iP9TH2h3w27F2ARZc7FjKcErYCzWRc-TPiymOyoVtw,24171
|
22
22
|
siat/compare_cross_test.py,sha256=xra5XYmQGEtfIZL2h-GssdH2hLdFIhG3eoCrkDrL3gY,3473
|
23
23
|
siat/concepts_iwencai.py,sha256=m1YEDtECRT6FqtzlKm91pt2I9d3Z_XoP59BtWdRdu8I,3061
|
@@ -40,8 +40,8 @@ siat/financial_statements_test.py,sha256=FLhx8JD-tVVWSBGux6AMz1jioXX4U4bp9DmgFHY
|
|
40
40
|
siat/financials.py,sha256=mbEZSNeHMMFcnPUryQWvdmNlWQvpnOG9eItgS7IVw3k,80458
|
41
41
|
siat/financials2 - 副本.py,sha256=dKlNjIfKeoSy055fQ6E6TUj9HEoO5Ney9grD84J5kfk,14389
|
42
42
|
siat/financials2.py,sha256=c5-QHu4VJn6f67mzX_t4cJc99rE3PmlChHC9VCNdYwY,42332
|
43
|
-
siat/financials_china.py,sha256=
|
44
|
-
siat/financials_china2.py,sha256=
|
43
|
+
siat/financials_china.py,sha256=ffikW5pgL0omDq0C8_7wKih-1nYfcVX1u23UAb1bp4U,188137
|
44
|
+
siat/financials_china2.py,sha256=fkt9JCLS3nYWGrWFeQa9co1gv1H0PPe2pEw9jdRuoeU,82492
|
45
45
|
siat/financials_china2_test.py,sha256=Erz5k4LyOplBBvYls2MypuqHpVNJ3daiLdyeJezNPu0,2722
|
46
46
|
siat/financials_china2_test2.py,sha256=C8CuYTMHN4Mhp-sTu-Bmg0zMXRCaYV6ezGDoYartRYQ,3507
|
47
47
|
siat/financials_china2_test3.py,sha256=UXYSA80DNSPRhHpovc2MA9JkpILWMAQaRatbWCHBNPs,3118
|
@@ -59,7 +59,7 @@ siat/future_china.py,sha256=F-HsIf2Op8Z22RzTjet1g8COzldgnMjFNSXsAkeGyWo,17595
|
|
59
59
|
siat/future_china_test.py,sha256=BrSzmDVaOHki6rntOtosmRn-6dkfOBuLulJNqh7MOpc,1163
|
60
60
|
siat/global_index_test.py,sha256=hnFp3wqqzzL-kAP8mgxDZ54Bd5Ijf6ENi5YJlGBgcXw,2402
|
61
61
|
siat/google_authenticator.py,sha256=ZUbZR8OW0IAKDbcYtlqGqIpZdERpFor9NccFELxg9yI,1637
|
62
|
-
siat/grafix.py,sha256=
|
62
|
+
siat/grafix.py,sha256=yP0wgXtydtNjyesaNjLbJN2FY1Es6d6mntLw_n0vsuA,84883
|
63
63
|
siat/grafix_test.py,sha256=kXvcpLgQNO7wd30g_bWljLj5UH7bIVI0_dUtXbfiKR0,3150
|
64
64
|
siat/holding_risk.py,sha256=X3vL_2rU0zpjiiRtStWxWOXZrAJ323huSsZK3jGgABc,30633
|
65
65
|
siat/holding_risk_test.py,sha256=FRlw_9wFG98BYcg_cSj95HX5WZ1TvkGaOUdXD7-V86s,474
|
@@ -104,7 +104,7 @@ siat/shenwan index history test.py,sha256=JCVAzOSEldHalhSFa3pqD8JI_8_djPMQOxpkuY
|
|
104
104
|
siat/stock.py,sha256=1KC33O7AxQa-poXrMORn3Uvqpleo8LUh1-15OFcwBsQ,138974
|
105
105
|
siat/stock_advice_linear.py,sha256=-twT7IGP-NEplkL1WPSACcNJjggRB2j4mlAQCkzOAuo,31655
|
106
106
|
siat/stock_base.py,sha256=uISvbRyOGy8p9QREA96CVydgflBkn5L3OXOGKl8oanc,1312
|
107
|
-
siat/stock_china.py,sha256=
|
107
|
+
siat/stock_china.py,sha256=6dFY4MGh9xDZ3G0RnkUiC13kmtI2Ro32k-ajCIeJo4k,89837
|
108
108
|
siat/stock_china_test.py,sha256=eO4HWsSvc6qezl0LndjtL24lViEyrBjH_sx2c2Y2Q2M,1294
|
109
109
|
siat/stock_info.pickle,sha256=EUUfZwFS3SMO2f25tOLWcjiJheGRCL3PDt7jII-i_4M,1315662
|
110
110
|
siat/stock_info_test.py,sha256=gfG3DbhDACbtD8wnv_R6zhj0t11XaC8NX8uLD9Qv3Fo,6122
|
@@ -132,7 +132,7 @@ siat/valuation.py,sha256=NKfeZMdDJOW42oLVHob6eSVBXUqlN1OCnnzwyGAst8c,48855
|
|
132
132
|
siat/valuation_china.py,sha256=Tde2LzPDQy3Z7xOQQDw4ckQMPdROp_z0-GjFE6Z5_lI,67639
|
133
133
|
siat/valuation_market_china_test.py,sha256=gbJ0ioauuo4koTPH6WKUkqcXiQPafnbhU5eKJ6lpdLA,1571
|
134
134
|
siat/var_model_validation.py,sha256=f-oDewg7bPzyNanz_Y_jLH68NowAA3gXFehW_weKGG0,14898
|
135
|
-
siat-3.0.
|
136
|
-
siat-3.0.
|
137
|
-
siat-3.0.
|
138
|
-
siat-3.0.
|
135
|
+
siat-3.0.20.dist-info/METADATA,sha256=ovHOM235JnIy97atHOdoHLFImQgA_5mlE0OP_8dEGZk,1448
|
136
|
+
siat-3.0.20.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
137
|
+
siat-3.0.20.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
|
138
|
+
siat-3.0.20.dist-info/RECORD,,
|
File without changes
|