Cyclically Adjusted P/E Ratio (CAPE)

Calculate the cyclically adjusted price earnings ratio (CAPE), the share price divided by the average inflation-adjusted earnings per share of the last ten years.

Graham and Dodd (1934) advised valuing a company on its average earnings over “not less than five years, preferably seven to ten years” rather than on a single year, which can be far above or below what the company earns over a business cycle. Campbell and Shiller (1998) applied this to the S&P 500 as the price divided by the ten-year average of real earnings, the Shiller CAPE (toolkit.economics.get_shiller_stock_market_data). This is the same ratio for a single company.

The formula is as follows:

\[\text{Real EPS} \;(s) = \frac{\text{EPS} \;(s) \cdot \text{CPI} \;(t)}{\text{CPI} \;(s)}\] \[\text{CAPE} \;(t) = \frac{\text{Share Price} \;(t)}{\text{Average of Real EPS} \;(s)} \;\text{over the years}\; s = t - \text{years} + 1 \;\text{to}\; t\]

The earnings per share are those of the price earnings ratio (get_price_to_earnings_ratio): net income (less preferred dividends with include_dividends) over the weighted average (diluted) shares of each fiscal year. With quarterly data, each quarter averages the trailing twelve month earnings per share of that quarter and of the same quarter in each earlier year, so every quarter of earnings enters once. The share price is the traded close at the end of each fiscal period (or the filing day with point_in_time), the same as for the price earnings ratio, so with years=1 and inflation_adjusted=False the ratio equals the price earnings ratio wherever the earnings are positive.

The consumer price index is the monthly all items index of country (toolkit.economics.get_consumer_price_index with period=”monthly”: the Bank for International Settlements, with the latest months of the Bureau of Labor Statistics for the United States, and Eurostat, the ONS or the Statistics Bureau of Japan for their countries), taken in the month each fiscal period ends (the latest published month for a period that ends after it). The monthly index of Japan (Statistics Bureau of Japan) starts in January 2015, so with years=10 its values start in about 2024. The United States index is used for every company unless another country is given, so choose the country of the currency the earnings are in: with convert_currency the statements are in the listing currency, so the currency the shares trade in (e.g. country=”Netherlands” for ASML.AS), and otherwise the currency of the statements.

Every year of the window must be available, as in Campbell and Shiller (1998), so the first years - 1 years after the first statement (4 x years - 1 quarters with quarterly data) are NaN: choose a start_date that many years before the first ratio of interest. The FinancialModelingPrep plan can limit the history to five years of statements; years=5 is the shortest window Graham and Dodd recommend. An average real EPS of zero or below gives NaN, as the ratio has no meaning for a company that lost money over the cycle.

A high CAPE relative to the company’s own history or its peers means the market prices the company well above its average earnings power, which in Campbell and Shiller (1998) foreshadowed lower returns over the following ten years for the market as a whole.

Also known as: Shiller P/E, P/E10, Graham and Dodd P/E, normalized P/E, CAPE ratio.

References:

  • Graham, B. and Dodd, D. (1934). Security Analysis. McGraw-Hill, New York.
  • Campbell, J. Y. and Shiller, R. J. (1998). Valuation Ratios and the Long-Run Stock Market Outlook. The Journal of Portfolio Management, 24(2), 11-26.

Cyclically Adjusted P/E Ratio (CAPE) in Python or via the MCP

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_cyclically_adjusted_price_to_earnings_ratio as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["KO", "JNJ", "AAPL"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2012-01-01",
    end_date="2025-12-31",
)

# The last five years, each with ten years of earnings behind it.
toolkit.ratios.get_cyclically_adjusted_price_to_earnings_ratio().iloc[:, -5:]

Or, after setting up the Finance Toolkit MCP, ask:

What were the cyclically adjusted P/E ratios (CAPE) of Coca-Cola, Johnson & Johnson and Apple from 2021 to 2025, each over ten years of inflation-adjusted earnings?

Which returns:

Item 2021 2022 2023 2024 2025
AAPL 51.6596 43.1482 42.3565 50.2245 50.0506
JNJ 29.766 28.1009 21.813 20.1288 26.7847
KO 31.7418 32.6074 29.2816 29.6145 31.2952

Parameters

get_cyclically_adjusted_price_to_earnings_ratio accepts the following parameters.

ParameterTypeDescriptionExample
yearsintThe number of years of earnings to average. Defaults to 10.10
inflation_adjustedboolWhether to express the earnings of every year in the prices of the period of the ratio with the consumer price index. Defaults to True.True
countrystrThe country whose consumer price index adjusts the earnings for inflation. Defaults to “United States”."US"
include_dividendsboolWhether to deduct preferred dividends from net income. Defaults to False.True
dilutedboolWhether to use diluted shares in the calculation. Defaults to True.False
roundingint | NoneThe number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise).2
growthboolWhether to calculate the growth of the ratios. Defaults to False.True
lagint | list[int]The lag to use for the growth calculation. Defaults to 1.4
compoundboolWhether the growth is the compound annual growth rate over the lag (e.g. lag=5 for the five-year CAGR) instead of the total change. Defaults to False.False
standardizeboolWhether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.True
show_columnsstr | list[str] | NoneThe columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column.None, which keeps every column
Share