每日股息率计算,与原值有误差(平台大佬看下是否正确)

策略分享
标签: #<Tag:0x00007fc069ccc118>

(lu0817) #1

2019-06-26给出的股息率为0.0110941086457536,计算为0.010845
是否可以

克隆策略
In [1]:
dd=DataSource('dividend_send_CN_STOCK_A').read(['000001.SZA'],start_date='2019-05-01', fields=['cash_dividend_ratio','dividend_yield'])
print(dd)
            date  instrument      dividend_yield cash_dividend_ratio
28679 2019-06-26  000001.SZA  0.0110941086457536                1.45
In [2]:
da=DataSource('bar1d_CN_STOCK_A').read(instruments=['000001.SZA'],start_date='2019-05-01',end_date='2019-07-01', fields=['adjust_factor','close'])
print(da.columns)
Index(['date', 'instrument', 'adjust_factor', 'close'], dtype='object')
In [3]:
da['adp']=da['close']/da['adjust_factor']
In [4]:
data  = da.merge(dd, 'left', ['date']) 
#print(data)
data= data.fillna(method='ffill')
data.dropna(inplace=True)
In [5]:
data['cash_dividend_ratio']=data['cash_dividend_ratio'].astype('float')
In [6]:
data['rate']=data.cash_dividend_ratio/data.adp/10
In [7]:
print(data)
         date instrument_x  adjust_factor        close        adp  \
36 2019-06-26   000001.SZA     109.169426  1459.595215  13.370000   
37 2019-06-27   000001.SZA     109.169426  1496.712891  13.710001   
38 2019-06-28   000001.SZA     109.169426  1504.354736  13.780001   
39 2019-07-01   000001.SZA     109.169426  1520.730103  13.930000   

   instrument_y      dividend_yield  cash_dividend_ratio      rate  
36   000001.SZA  0.0110941086457536                 1.45  0.010845  
37   000001.SZA  0.0110941086457536                 1.45  0.010576  
38   000001.SZA  0.0110941086457536                 1.45  0.010522  
39   000001.SZA  0.0110941086457536                 1.45  0.010409