Advertisement
Guest User

Untitled

a guest
Nov 5th, 2021
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. #@title Calculate the Implied Cash Flow Growth Rate
  2.  
  3. from scipy.optimize import minimize_scalar
  4. import math
  5.  
  6. # set parameters
  7. current_price_per_share = df['share_price']
  8. shares_outstanding_in_millions = df['shares_(diluted)'] / 1000000
  9. owners_income = df['owners_income'] / 1000000
  10.  
  11. def growth_needed(x, current_price_per_share, shares_outstanding_in_millions, owners_income):
  12. # set growth rates and cost of capital
  13. fcf_growth_1_to_5 = x / 100
  14. fcf_growth_6_to_10 = fcf_growth_1_to_5 / 2 # half the rate of year 1-5
  15. terminal_growth_rate = .03 # constant
  16. cost_of_capital = .1 #constant
  17.  
  18. # calculate ten years of Free Cash Flow and the Terminal Value
  19. FCF_01 = owners_income * (1 + fcf_growth_1_to_5)
  20. FCF_02 = FCF_01 * (1 + fcf_growth_1_to_5)
  21. FCF_03 = FCF_02 * (1 + fcf_growth_1_to_5)
  22. FCF_04 = FCF_03 * (1 + fcf_growth_1_to_5)
  23. FCF_05 = FCF_04 * (1 + fcf_growth_1_to_5)
  24. FCF_06 = FCF_05 * (1 + fcf_growth_6_to_10)
  25. FCF_07 = FCF_06 * (1 + fcf_growth_6_to_10)
  26. FCF_08 = FCF_07 * (1 + fcf_growth_6_to_10)
  27. FCF_09 = FCF_08 * (1 + fcf_growth_6_to_10)
  28. FCF_10 = FCF_09 * (1 + fcf_growth_6_to_10)
  29. term_value = (FCF_10 * (1 + terminal_growth_rate)) / (cost_of_capital - terminal_growth_rate)
  30.  
  31. # calcuate the Present Value for each period
  32. PV_01 = FCF_01 * (1 /(( 1 + cost_of_capital) ** 1))
  33. PV_02 = FCF_02 * (1 /(( 1 + cost_of_capital) ** 2))
  34. PV_03 = FCF_03 * (1 /(( 1 + cost_of_capital) ** 3))
  35. PV_04 = FCF_04 * (1 /(( 1 + cost_of_capital) ** 4))
  36. PV_05 = FCF_05 * (1 /(( 1 + cost_of_capital) ** 5))
  37. PV_06 = FCF_06 * (1 /(( 1 + cost_of_capital) ** 6))
  38. PV_07 = FCF_07 * (1 /(( 1 + cost_of_capital) ** 7))
  39. PV_08 = FCF_08 * (1 /(( 1 + cost_of_capital) ** 8))
  40. PV_09 = FCF_09 * (1 /(( 1 + cost_of_capital) ** 9))
  41. PV_10 = FCF_10 * (1 /(( 1 + cost_of_capital) ** 10))
  42. PV_TV = term_value * (1 /(( 1 + cost_of_capital) ** 11))
  43.  
  44. #sum the Present Values and calculate the value per share
  45. intrinsic_value = PV_01 + PV_02 + PV_03 + PV_04 + PV_05 + PV_06 + PV_07 + PV_08 + PV_09 + PV_10 + PV_TV
  46. intrinsic_value_per_share = intrinsic_value / shares_outstanding_in_millions
  47.  
  48. # calculate the growth rate in year 1-5 needed to match the current share price
  49. # the square and square root are to force to zero before adding back the growth rate
  50. return ((math.sqrt((intrinsic_value_per_share - current_price_per_share) ** 2)) + x )
  51.  
  52. res = minimize_scalar(growth_needed, method='bounded', bounds=(-50, 100), args=(current_price_per_share, shares_outstanding_in_millions, owners_income,))
  53. # notice the trailing comma in the Args function to make it a tuple
  54. df['implied_growth'] = res.x / 100
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement