Compound Growth Rate
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{Years} = (\text{Last Date} - \text{First Date}) / 365.25 \;\text{days}\] \[\text{CAGR} = (\text{Final Value} / \text{Initial Value}) ^{1 / \text{Years}} - 1\] \[\text{Period Rate} = (1 + \text{CAGR}) ^{1 / \text{Periods per Year}} - 1\]The CAGR is measured on calendar time: each asset from its own first to its own last close between the start and end date, with the years in between counted in calendar days. The rate thereby does not depend on how often an asset trades, so a stock (which trades on weekdays) and a cryptocurrency (which trades every day) in the same Toolkit are measured over the same years, and an asset without a close on the first or last date of the range is measured over the dates it has. The quarterly, monthly, weekly and daily rates follow from the CAGR with 4 quarters, 12 months, 52 weeks and 252 trading days to a year, so the rates are consistent with each other: (1 + CDGR) ^ 252 equals 1 + CAGR.
Also known as: CAGR, compound annual growth rate, annualized return.
Compound Growth Rate in Python or via the MCP
Install the Finance Toolkit with:
pip install financetoolkit -U
Then call get_compound_growth_rate as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(
["BTCUSD", "ETHUSD", "^GSPC"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
toolkit.performance.get_compound_growth_rate()
Or, after setting up the Finance Toolkit MCP, ask:
What were the compound annual, quarterly, monthly, weekly and daily growth rates of Bitcoin, Ether and the S&P 500 from 2021 to 2025?
Which returns:
| BTCUSD | ETHUSD | ^GSPC | Benchmark | |
|---|---|---|---|---|
| Compound Annual Growth Rate (CAGR) | 0.2438 | 0.3236 | 0.1312 | 0.1469 |
| Compound Quarterly Growth Rate (CQGR) | 0.0561 | 0.0726 | 0.0313 | 0.0348 |
| Compound Monthly Growth Rate (CMGR) | 0.0183 | 0.0236 | 0.0103 | 0.0115 |
| Compound Weekly Growth Rate (CWGR) | 0.0042 | 0.0054 | 0.0024 | 0.0026 |
| Compound Daily Growth Rate (CDGR) | 0.0009 | 0.0011 | 0.0005 | 0.0005 |
Parameters
get_compound_growth_rate accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
rounding | int | 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. | 2 |