Skip to content

Commit

Permalink
edit DPCF calc
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 6aaaaf5 commit 1776d61
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions intrinsic_value.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5867,7 +5867,7 @@
"\n",
"## Calculate terminal value after ten years:\n",
"\n",
"* DPCF = ((BYFCF*(1+g)**11) * (1+g) / r-lgr) * (1/(1+r)**11)\n",
"* DPCF = BYFCF*((1+g)**11) * (1+lgr) / (r-lgr) * (1/(1+r)**11)\n",
"\n",
"## Calculate Intrinsic value:\n",
"\n",
Expand All @@ -5879,7 +5879,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 22,
"source": [
"# Specify variables for DCF model\n",
"\n",
Expand All @@ -5888,7 +5888,7 @@
"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 after reriod ten years\n",
"lgr = 0.03 # long term growth rate to last indefinitely \n",
"lgr = 0.02 # long term growth rate to last indefinitely \n",
"\n",
"shares_outstanding = income['weightedAverageShsOutDil'].loc['2020']"
],
Expand All @@ -5897,7 +5897,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 23,
"source": [
"# Calculate discounted free cash flow for period of ten years\n",
"DFCF = FCF / (1+r)\n",
Expand All @@ -5914,17 +5914,17 @@
]
},
"metadata": {},
"execution_count": 24
"execution_count": 23
}
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 24,
"source": [
"# Calculate terminal value past ten years\n",
"DPCF = ((BYFCF*(1+g)**11) * (1+g) / r-lgr) * (1/(1+r)**11)\n",
"DPCF = BYFCF*((1+g)**11) * (1+lgr) / (r-lgr) * (1/(1+r)**11)\n",
"DPCF"
],
"outputs": [
Expand All @@ -5933,19 +5933,19 @@
"data": {
"text/plain": [
"date\n",
"2020-09-26 2158257750000.35\n",
"2020-09-26 2304724402586.77\n",
"Name: freeCashFlow, dtype: float64"
]
},
"metadata": {},
"execution_count": 25
"execution_count": 24
}
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 25,
"source": [
"# Calculate intrinsic value\n",
"intrinsic_value = DFCF + DPCF\n",
Expand All @@ -5957,12 +5957,12 @@
"data": {
"text/plain": [
"date\n",
"2020-09-26 2550939911910.17\n",
"2020-09-26 2697406564496.59\n",
"Name: freeCashFlow, dtype: float64"
]
},
"metadata": {},
"execution_count": 26
"execution_count": 25
}
],
"metadata": {}
Expand All @@ -5981,7 +5981,7 @@
"data": {
"text/plain": [
"date\n",
"2020-09-26 145.53\n",
"2020-09-26 153.89\n",
"dtype: float64"
]
},
Expand All @@ -5993,11 +5993,12 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": 32,
"source": [
"# Calculate margin of safety\n",
"market_cap = key_metrics['marketCap'].loc['2020']\n",
"market_cap_per_share = market_cap / shares_outstanding\n",
"\n",
"print(f'Current Market Value = {market_cap_per_share}')\n",
"print(f'Intrinsic Value = {intrinsic_value_per_share}')\n",
"\n",
Expand All @@ -6014,7 +6015,7 @@
"\n",
"else:\n",
"\n",
" print('Insufficient margin, keep searching!')"
" print('Insufficient margin, keep searching!')\n"
],
"outputs": [
{
Expand All @@ -6025,10 +6026,10 @@
"2020-09-26 113.89\n",
"dtype: float64\n",
"Intrinsic Value = date\n",
"2020-09-26 145.53\n",
"2020-09-26 153.89\n",
"dtype: float64\n",
"Margin = date\n",
"2020-09-26 0.78\n",
"2020-09-26 0.74\n",
"dtype: float64\n",
"Insufficient margin, keep searching!\n"
]
Expand Down

0 comments on commit 1776d61

Please sign in to comment.