Skip to content

Commit

Permalink
reorder code lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Dragan Bogatic authored and Dragan Bogatic committed Sep 22, 2021
1 parent 7866c34 commit 5e19ea5
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions intrinsic_value.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5734,7 +5734,7 @@
{
"cell_type": "markdown",
"source": [
"# FMP Intrinsic Value - [FMP API Calculation](https://financialmodelingprep.com/developer/docs/dcf-formula) - Value as of 09-21-2021"
"# FMP Intrinsic Value - [FMP API Calculation](https://financialmodelingprep.com/developer/docs/dcf-formula) - Value as of 09-22-2021"
],
"metadata": {}
},
Expand Down Expand Up @@ -5846,11 +5846,11 @@
"\n",
" * Free Cash Flow (FCF) = Operating cash flow - Total CapEx (more conservative because it includes both growth and maintenance CapEx)\n",
"\n",
" * FCF Growth Rate 10 years (g) - 10-year averageg or make a judgement call what is realistic growth rate to continue into the future\n",
" * FCF Growth Rate 10 years (g) - 10-year average or make a judgement call what is a realistic growth rate to continue into the future\n",
" \n",
" * Personal Required Rate of Return (r) - use S&P historical avg return or specify your own requred rate\n",
"\n",
" * Long Term Growth Rate (lgr) - discretionary rate for earnings to grow indefinitely (recommended 2%-3% to avoid overly optimistic valuation)\n",
" * Long Term Growth Rate (lgr) - discretionary rate for earnings to grow indefinitely (recommended 2%-3% to avoid overly optimistic valuation) past ten years\n",
"\n",
"\n",
"* DFCFn = Discounted Free Cash Flow for year n\n",
Expand Down Expand Up @@ -5879,26 +5879,27 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 29,
"source": [
"# Specify variables for DCF model\n",
"\n",
"n = 10 # period ten years\n",
"r = 0.10 # discretionary factor based on the riskiness of investment\n",
"g = growth['freeCashFlowGrowth'].mean() # growth of earnings first ten years (average FCF)\n",
"BYFCF = cash['freeCashFlow'].loc['2020'] # base year FCF\n",
"FCF = BYFCF * ((1+g)**n) # FCF future value for period ten years\n",
"lgr = 0.02 # long term growth rate to last indefinitely \n",
"\n",
"BYFCF = cash['freeCashFlow'].loc['2020'] # base year FCF\n",
"shares_outstanding = income['weightedAverageShsOutDil'].loc['2020']"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 30,
"source": [
"# FCF future value for period ten years\n",
"FCF = BYFCF * ((1+g)**n) \n",
"\n",
"# Calculate discounted free cash flow for period of ten years\n",
"DFCF = FCF / (1+r)**n\n",
"DFCF"
Expand All @@ -5914,14 +5915,14 @@
]
},
"metadata": {},
"execution_count": 23
"execution_count": 30
}
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": 31,
"source": [
"# Calculate terminal value past ten years\n",
"DPCF = (BYFCF * ((1+g)**(n+1))) * (1+lgr) / (r-lgr) * (1/((1+r)**(n+1)))\n",
Expand All @@ -5938,14 +5939,14 @@
]
},
"metadata": {},
"execution_count": 28
"execution_count": 31
}
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 32,
"source": [
"# Calculate intrinsic value\n",
"intrinsic_value = DFCF + DPCF\n",
Expand All @@ -5962,14 +5963,14 @@
]
},
"metadata": {},
"execution_count": 25
"execution_count": 32
}
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 33,
"source": [
"# Calculate intrinsic value per share\n",
"intrinsic_value_per_share = intrinsic_value / shares_outstanding\n",
Expand All @@ -5986,14 +5987,14 @@
]
},
"metadata": {},
"execution_count": 26
"execution_count": 33
}
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 34,
"source": [
"# Calculate margin of safety\n",
"market_cap = key_metrics['marketCap'].loc['2020']\n",
Expand Down

0 comments on commit 5e19ea5

Please sign in to comment.