Calculate the price earnings to growth (PEG) ratio, a valuation metric that measures the ratio of the price-to-earnings ratio to earnings growth rate.

The price-to-earnings growth (PEG) ratio provides a more comprehensive valuation measure compared to the P/E ratio alone. It takes into account a company’s earnings growth rate, allowing investors to assess whether a stock is overvalued or undervalued relative to its growth prospects.

The formula is as follows:

\[\text{Price Earnings to Growth Ratio} (\text{PEG}) = \text{Price Earnings Ratio} (P / E) / \text{Growth Rate}\]

Also known as: PEG ratio, price earnings growth.

Price to Earnings Growth Ratio (PEG) in Python

get_price_to_earnings_growth_ratio is part of the Ratios module of the open-source Finance Toolkit. Install it with:

pip install financetoolkit -U

Then call get_price_to_earnings_growth_ratio as shown below.

from financetoolkit import Toolkit

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

peg_ratio = toolkit.ratios.get_price_to_earnings_growth_ratio()

Which returns:

  2021 2022 2023 2024 2025
AAPL 0.443 2.3908 92.3141 -50.1989 1.6036
TSLA 0.322 0.2797 3.0479 -3.7616 -8.8524

Parameters

get_price_to_earnings_growth_ratio accepts the following parameters:

  • use_ebitda_growth_rate (bool, optional): Whether to use EBITDA growth rate for the calculation. Defaults to False.
  • include_dividends (bool, optional): Whether to include dividends in the calculation. Defaults to False.
  • diluted (bool, optional): Whether to use diluted shares in the calculation. Defaults to True.
  • rounding (int, optional): The number of decimals to round the results to. Defaults to 4.
  • growth (bool, optional): Whether to calculate the growth of the ratios. Defaults to False.
  • lag (int | str, optional): The lag to use for the growth calculation. Defaults to 1.
  • standardize (bool, optional): Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.
Share