Skip to content

Instantly share code, notes, and snippets.

@zachlim98
Created January 7, 2021 04:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zachlim98/64bcbc6fa2a889093905382df1c518e4 to your computer and use it in GitHub Desktop.
Save zachlim98/64bcbc6fa2a889093905382df1c518e4 to your computer and use it in GitHub Desktop.
dcf_proj = pd.DataFrame({
"revenue" : ins.loc["revenue"],
"netincome" : cf.loc["netIncome"],
"freecash" : cf.loc["freeCashFlow"]
}).transpose()
dcf_proj.loc["incomeMargin"] = dcf_proj.loc["revenue"]/dcf_proj.loc["netincome"]
dcf_proj.loc["FCFr"] = dcf_proj.loc["revenue"]/dcf_proj.loc["freecash"]
rev_change_mean = ins.loc["revenue"].pct_change().mean()
rev_change_stdd = ins.loc["revenue"].pct_change().std()
margin_change = dcf_proj.loc["incomeMargin", dcf_proj.loc["incomeMargin"] > 0].min()
fcf_change = dcf_proj.loc["FCFr", dcf_proj.loc["FCFr"] > 0].min()
tnx = yf.Ticker("^TNX") #use yfinance to get the 10yr treasury bond return
rfr = tnx.info["previousClose"] #use previousclose to estimate rfr
dcf_proj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment