Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #@title Calculate the Implied Cash Flow Growth Rate
- from scipy.optimize import minimize_scalar
- import math
- # set parameters
- current_price_per_share = df['share_price']
- shares_outstanding_in_millions = df['shares_(diluted)'] / 1000000
- owners_income = df['owners_income'] / 1000000
- def growth_needed(x, current_price_per_share, shares_outstanding_in_millions, owners_income):
- # set growth rates and cost of capital
- fcf_growth_1_to_5 = x / 100
- fcf_growth_6_to_10 = fcf_growth_1_to_5 / 2 # half the rate of year 1-5
- terminal_growth_rate = .03 # constant
- cost_of_capital = .1 #constant
- # calculate ten years of Free Cash Flow and the Terminal Value
- FCF_01 = owners_income * (1 + fcf_growth_1_to_5)
- FCF_02 = FCF_01 * (1 + fcf_growth_1_to_5)
- FCF_03 = FCF_02 * (1 + fcf_growth_1_to_5)
- FCF_04 = FCF_03 * (1 + fcf_growth_1_to_5)
- FCF_05 = FCF_04 * (1 + fcf_growth_1_to_5)
- FCF_06 = FCF_05 * (1 + fcf_growth_6_to_10)
- FCF_07 = FCF_06 * (1 + fcf_growth_6_to_10)
- FCF_08 = FCF_07 * (1 + fcf_growth_6_to_10)
- FCF_09 = FCF_08 * (1 + fcf_growth_6_to_10)
- FCF_10 = FCF_09 * (1 + fcf_growth_6_to_10)
- term_value = (FCF_10 * (1 + terminal_growth_rate)) / (cost_of_capital - terminal_growth_rate)
- # calcuate the Present Value for each period
- PV_01 = FCF_01 * (1 /(( 1 + cost_of_capital) ** 1))
- PV_02 = FCF_02 * (1 /(( 1 + cost_of_capital) ** 2))
- PV_03 = FCF_03 * (1 /(( 1 + cost_of_capital) ** 3))
- PV_04 = FCF_04 * (1 /(( 1 + cost_of_capital) ** 4))
- PV_05 = FCF_05 * (1 /(( 1 + cost_of_capital) ** 5))
- PV_06 = FCF_06 * (1 /(( 1 + cost_of_capital) ** 6))
- PV_07 = FCF_07 * (1 /(( 1 + cost_of_capital) ** 7))
- PV_08 = FCF_08 * (1 /(( 1 + cost_of_capital) ** 8))
- PV_09 = FCF_09 * (1 /(( 1 + cost_of_capital) ** 9))
- PV_10 = FCF_10 * (1 /(( 1 + cost_of_capital) ** 10))
- PV_TV = term_value * (1 /(( 1 + cost_of_capital) ** 11))
- #sum the Present Values and calculate the value per share
- intrinsic_value = PV_01 + PV_02 + PV_03 + PV_04 + PV_05 + PV_06 + PV_07 + PV_08 + PV_09 + PV_10 + PV_TV
- intrinsic_value_per_share = intrinsic_value / shares_outstanding_in_millions
- # calculate the growth rate in year 1-5 needed to match the current share price
- # the square and square root are to force to zero before adding back the growth rate
- return ((math.sqrt((intrinsic_value_per_share - current_price_per_share) ** 2)) + x )
- res = minimize_scalar(growth_needed, method='bounded', bounds=(-50, 100), args=(current_price_per_share, shares_outstanding_in_millions, owners_income,))
- # notice the trailing comma in the Args function to make it a tuple
- df['implied_growth'] = res.x / 100
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement