Calculates the market capitalization of the company.

Market capitalization, often referred to as “market cap,” is the total value of a company’s outstanding shares of stock in the stock market. It is calculated by multiplying the current market price per share by the total number of outstanding shares.

The formula is as follows:

\[\text{Market Capitalization} = \text{Share Price} \cdot \text{Weighted Average} (\text{Diluted}) \text{Shares}\]

Also known as: market capitalization.

Market Capitalization in Python

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

pip install financetoolkit -U

Then call get_market_cap as shown below.

from financetoolkit import Toolkit

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

market_cap = toolkit.ratios.get_market_cap()

Which returns:

  2021 2022 2023 2024 2025
AAPL 2.9947e+12 2.12121e+12 3.04439e+12 3.8585e+12 4.07918e+12
TSLA 1.19275e+12 4.2805e+11 8.65394e+11 1.41263e+12 1.58661e+12

Parameters

get_market_cap accepts the following parameters:

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