Calculate the price to book ratio, a valuation ratio that compares a company’s market price to its book value per share.

The price to book ratio is a key valuation metric that helps investors assess whether a company’s stock is overvalued or undervalued relative to its underlying net asset value.

The formula is as follows:

\[\text{Price to Book Ratio} = \text{Share Price} / \text{Book Value per Share}\]

Also known as: P/B ratio.

Price to Book Ratio (PB) in Python

get_price_to_book_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_book_ratio as shown below.

from financetoolkit import Toolkit

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

price_to_book_ratio = toolkit.ratios.get_price_to_book_ratio()

Which returns:

  2021 2022 2023 2024 2025
AAPL 47.4672 41.8616 48.9873 67.7525 55.3236
TSLA 39.5096 9.5752 13.8166 19.3742 19.3166

Parameters

get_price_to_book_ratio accepts the following parameters:

  • 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.
  • trailing (int): Defines whether to select a trailing period. E.g. when selecting 4 with quarterly data, the TTM is calculated.
Share