This function calculates the Compound Growth Rate (CGR) for different periods: yearly, quarterly, monthly, weekly, and daily.

The CGR is a measure that provides the mean growth rate of an investment over a specified period of time. It is a useful measure for comparing the performance of investments over different time periods or across different asset classes. The CGR is calculated by taking the ratio of the final value to the initial value, raising it to the inverse of the number of periods, and then subtracting one.

The formula is as follows:

\[\text{CGR} = (\text{Final Value} / \text{Initial Value}) ^{1 / \text{Number of Periods}} - 1\]

Also known as: CAGR, compound annual growth rate, annualized return.

No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Compound Growth Rate for you. Just ask in plain English.

Calculate the Compound Growth Rate in Python

The Compound Growth Rate is available in the Performance module of the open-source Finance Toolkit. Install it with:

pip install financetoolkit -U

Then call get_compound_growth_rate as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(["AAPL", "TSLA"], api_key="FINANCIAL_MODELING_PREP_KEY")

toolkit.performance.get_compound_growth_rate()

Which returns:

  AAPL TSLA Benchmark
Compound Annual Growth Rate (CAGR) 0.1219 -0.0124 0.1158
Compound Quarterly Growth Rate (CQGR) 0.041 0.0124 0.0332
Compound Monthly Growth Rate (CMGR) 0.0123 0.005 0.0101
Compound Weekly Growth Rate (CWGR) 0.0029 0.0012 0.0024
Compound Daily Growth Rate (CDGR) 0.0006 0.0003 0.0005

Parameters

get_compound_growth_rate accepts the following parameters:

  • rounding (int, optional): The number of decimals to round the results to. If not provided, the function will use the default rounding value set in the class instance.

The Performance module page introduces the module, and the sidebar lists all of its functions.

Share