日日操夜夜添-日日操影院-日日草夜夜操-日日干干-精品一区二区三区波多野结衣-精品一区二区三区高清免费不卡

公告:魔扣目錄網(wǎng)為廣大站長提供免費收錄網(wǎng)站服務(wù),提交前請做好本站友鏈:【 網(wǎng)站目錄:http://www.ylptlb.cn 】, 免友鏈快審服務(wù)(50元/站),

點擊這里在線咨詢客服
新站提交
  • 網(wǎng)站:51998
  • 待審:31
  • 小程序:12
  • 文章:1030137
  • 會員:747

"""
Python/ target=_blank class=infotextkey>Python 獲取上市公司財務(wù)利潤表數(shù)據(jù)
"""
import time
import datetime
import tushare as ts
#注冊獲取token
ts.set_token('your token')
pro = ts.pro_api()

def get_data_income(ts_code='', start_date='', end_date='', retry_count=3, pause=2):
    #獲取上市公司財務(wù)利潤表數(shù)據(jù)
    for g in range(retry_count):
        try:
            fiel1 = 'ts_code,ann_date,f_ann_date,end_date,report_type,comp_type,end_type,basic_eps,'
            fiel2 = 'diluted_eps,total_revenue,revenue,int_income,prem_earned,comm_income,'
            fiel3 = 'n_commis_income,n_oth_income,n_oth_b_income,prem_income,out_prem,une_prem_reser,'
            fiel4 = 'reins_income,n_sec_tb_income,n_sec_uw_income,n_asset_mg_income,oth_b_income,'
            fiel5 = 'fv_value_chg_gain,invest_income,ass_invest_income,forex_gain,total_cogs,'
            fiel6 = 'oper_cost,int_exp,comm_exp,biz_tax_surchg,sell_exp,admin_exp,fin_exp,'
            fiel7 = 'assets_impair_loss,prem_refund,compens_payout,reser_insur_liab,div_payt,'
            fiel8 = 'reins_exp,oper_exp,compens_payout_refu,insur_reser_refu,reins_cost_refund,'
            fiel9 = 'other_bus_cost,operate_profit,non_oper_income,non_oper_exp,nca_disploss,'
            fiel10 = 'total_profit,income_tax,n_income,n_income_attr_p,minority_gain,oth_compr_income,'
            fiel11 = 't_compr_income,compr_inc_attr_p,compr_inc_attr_m_s,ebit,ebitda,insurance_exp,'
            fiel12 = 'undist_profit,distable_profit,rd_exp,fin_exp_int_exp,fin_exp_int_inc,'
            fiel13 = 'transfer_surplus_rese,transfer_housing_imprest,transfer_oth,adj_lossgain,'
            fiel14 = 'withdra_legal_surplus,withdra_legal_pubfund,withdra_biz_devfund,'
            fiel15 = 'withdra_rese_fund,withdra_oth_ersu,workers_welfare,distr_profit_shrhder,'
            fiel16 = 'prfshare_payable_dvd,comshare_payable_dvd,capit_comstock_div,'
            fiel17 ='.NET_after_nr_lp_correct,credit_impa_loss,net_expo_hedging_benefits,'
            fiel18 = 'oth_impair_loss_assets,total_opcost,amodcost_fin_assets,oth_income,'
            fiel19 = 'asset_disp_income,continued_net_profit,end_net_profit,update_flag'
            fiel0 = fiel1+fiel2+fiel3+fiel4+fiel5+fiel6+fiel7+fiel8+fiel9+fiel10+fiel11+fiel12+fiel13+fiel14+fiel15+
                    fiel16+fiel17+fiel18+fiel19
            df = pro.income(ts_code=ts_code, start_date=start_date, end_date=end_date, fields=fiel0)
        except Exception as err:
            time.sleep(pause)
        else:
            return df

def date_func(days=0):
    try:
        time_temp = datetime.datetime.now() - datetime.timedelta(days=days)
        dt = time_temp.strftime('%Y%m%d')
        return dt
    except Exception as err:
        print('end_dt is err', err)


if __name__ == '__main__':
    # 日期格式為 YYYYMMDD 如 20221122
    # 行情終止日期
    end_dt = date_func(days=0)
    start_dt = date_func(days=365)
    print('start_dt,end_dt:', start_dt, end_dt)
    # 以佛慈制藥為例
    code_wm = '002644.SZ'

    # 獲取南嶺民爆一年的利潤表數(shù)據(jù)數(shù)據(jù)
    df_wm = get_data_income(ts_code=code_wm, start_date=start_dt, end_date=end_dt, retry_count=3, pause=2)
    print(df_wm.head(8))

    """運行結(jié)果
    start_dt,end_dt: 20211122 20221122
         ts_code  ann_date f_ann_date  ...  total_opcost amodcost_fin_assets update_flag
    0  002644.SZ  20221027   20221027  ...  6.479623e+08                None           1
    1  002644.SZ  20220825   20220825  ...  4.089990e+08                None           1
    2  002644.SZ  20220427   20220427  ...  2.114988e+08                None           1
    3  002644.SZ  20220427   20220427  ...  2.114988e+08                None           0
    4  002644.SZ  20220316   20220316  ...  7.528933e+08                None           1
    
    [5 rows x 94 columns]
    
    Process finished with exit code 0
    """""" 
    Pgabc 2022000036 
    更多函數(shù),安裝工具包
    pip install pgabc
    pgabc@sohu.com
    www.wmdbsoft.com
    """

分享到:
標(biāo)簽:Python
用戶無頭像

網(wǎng)友整理

注冊時間:

網(wǎng)站:5 個   小程序:0 個  文章:12 篇

  • 51998

    網(wǎng)站

  • 12

    小程序

  • 1030137

    文章

  • 747

    會員

趕快注冊賬號,推廣您的網(wǎng)站吧!
最新入駐小程序

數(shù)獨大挑戰(zhàn)2018-06-03

數(shù)獨一種數(shù)學(xué)游戲,玩家需要根據(jù)9

答題星2018-06-03

您可以通過答題星輕松地創(chuàng)建試卷

全階人生考試2018-06-03

各種考試題,題庫,初中,高中,大學(xué)四六

運動步數(shù)有氧達人2018-06-03

記錄運動步數(shù),積累氧氣值。還可偷

每日養(yǎng)生app2018-06-03

每日養(yǎng)生,天天健康

體育訓(xùn)練成績評定2018-06-03

通用課目體育訓(xùn)練成績評定