We know that the compound annual growth rate (CAGR) is the mean annual growth rate of an investment over a specified period of time longer than one year.

Let us consider Disney’s (NYSE: DIS) 10 year book value per share from 2002 – 2011 and compute its CAGR over that period:

Year | Book Value |
---|---|

2002 | $11.61 |

2003 | $11.82 |

2004 | $13.05 |

2005 | $13.06 |

2006 | $15.42 |

2007 | $15.67 |

2008 | $17.73 |

2009 | $18.55 |

2010 | $19.78 |

2011 | $21.21 |

our present value starting 2002 is . Our future value (measure in 2011) is . We know that:

where is the annual rate of return and is the number of periods over which we are compounding our value.

So in order for us to calculate the compound annual growth rate, , we need to divide the value of an investment at the end of the period, , by its value at the beginning of that period, , and raise the result to the power of one divided by the period length (or n-th root), and subtract one from the subsequent result:

For our Disney example this would be:

or

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import argparse import math import locale from termcolor import colored import sys def main(): """ python3 compound_annual_growth_rate.py -p 1000 -f 2000 -n 10 """ parser = argparse.ArgumentParser() parser.add_argument('-p', type=float, default=11.61, help='Present value at the beginning of period e.g.: 11.61') parser.add_argument('-f', type=float, default=21.21, help='Future value at the end of period e.g.: 21.21') parser.add_argument('-n', type=int, default=9, help='The number of years it took the value to grow') args = parser.parse_args() print("-----------------------------------------------------------------------") print("Compute the Compound Annual Growth Rate Calculator") print("-----------------------------------------------------------------------") r = (args.f / args.p)**(1/float(args.n)) - 1 r = r * 100 print("Compound Annual Growth Rate: %s%%\n" % (colored("%.2f" % r, 'green'))) if __name__ == '__main__': main() |