Calculate the Kurtosis of an investment portfolio or asset’s returns.

Kurtosis is a statistical measure used in finance to evaluate the shape of the probability distribution of returns for an investment portfolio or asset over a defined time period. It assesses the “tailedness” of the return distribution, indicating whether returns have fatter or thinner tails compared to a normal distribution. Kurtosis plays a critical role in risk assessment by revealing the potential presence of extreme outliers or the likelihood of heavy tails in the return data. This information aids investors and analysts in understanding the degree of risk associated with an investment and assists in making more informed decisions regarding risk tolerance. In essence, kurtosis serves as a valuable tool for comprehending the distribution characteristics of returns, offering insights into the potential for rare but significant events in the financial markets.

Also known as: tail heaviness, fat tails, leptokurtosis.

No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Kurtosis for you. Just ask in plain English.

Calculate the Kurtosis in Python

The Kurtosis is available in the Risk module of the open-source Finance Toolkit. Install it with:

pip install financetoolkit -U

Then call get_kurtosis as shown below.

from financetoolkit import Toolkit

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

toolkit.risk.get_kurtosis()

Which returns:

  MSFT AAPL TSLA
2019 4.0972 10.0741 9.128
2020 9.2914 6.6307 5.2189
2021 3.3152 3.3352 7.3197
2022 3.852 4.0085 3.3553
2023 4.2908 4.4568 4.07

Parameters

get_kurtosis accepts the following parameters:

  • period (str, optional): The data frequency for returns (daily, weekly, monthly, quarterly, or yearly). Defaults to “quarterly” if the Toolkit is initialised with quarterly=True, otherwise “yearly”.
  • within_period (bool, optional): Whether to calculate the Kurtosis within the specified period or for the entire period. Thus whether to look at the Kurtosis within a specific year (if period = ‘yearly’) or look at the entirety of all years. Defaults to True.
  • fisher (bool, optional): Whether to use Fisher’s definition of kurtosis (kurtosis = 0.0 for a normal distribution). Defaults to False.
  • rolling (int, optional): The rolling window size to use for the calculation. If set, Kurtosis is calculated over a rolling window of this many periods across the full return history instead of per period. Defaults to None.
  • rounding (int | None, optional): The number of decimals to round the results to. Defaults to 4.
  • growth (bool, optional): Whether to calculate the growth of the Kurtosis values over time. Defaults to False.
  • lag (int | list[int], 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.

The Risk module page introduces the module, and the sidebar lists all of its functions.

Share