futurepricing.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:ValueInvesting 作者: VincentTatan 项目源码 文件源码
def generate_price_df(ticker,financialreportingdf,stockpricedf,discountrate,marginrate):
    dfprice = pd.DataFrame(columns =['ticker','annualgrowthrate','lasteps','futureeps'])
    pd.options.display.float_format = '{:20,.2f}'.format

    # Find EPS Annual Compounded Growth Rate
    annualgrowthrate =  financialreportingdf.epsgrowth.mean() #growth rate

    # Estimate stock price 10 years from now (Stock Price EPS * Average PE)
    lasteps = financialreportingdf.eps.tail(1).values[0] #presentvalue
    years  = 10 #period
    futureeps = abs(np.fv(annualgrowthrate,years,0,lasteps))
    dfprice.loc[0] = [ticker,annualgrowthrate,lasteps,futureeps]

    dfprice.set_index('ticker',inplace=True)


    dfprice['lastshareprice']=stockpricedf.Close.tail(1).values[0]
    dfprice['peratio'] = dfprice['lastshareprice']/dfprice['lasteps']
    dfprice['futureshareprice'] = dfprice['futureeps']*dfprice['peratio']


    dfprice['presentshareprice'] = abs(np.pv(discountrate,years,0,fv=dfprice['futureshareprice']))
    dfprice['marginalizedprice'] = dfprice['presentshareprice']*(1-marginrate) 

    return dfprice
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号