Central Moments

Calculate a Central Moment: the average deviation of the returns of an investment portfolio or asset from their mean raised to a power, the spread, asymmetry or tails in the returns’ own units.

A central moment is the average deviation from the mean return raised to a power, the order. The second central moment is the (population) variance, the third measures the asymmetry of the return distribution in squared-and-cubed return units (negative when the large deviations are losses) and the fourth the weight of the tails. Unlike the Skewness and Kurtosis, which divide by a power of the standard deviation, they keep the scale of the returns, so a volatile asset has larger moments, and they are the building blocks of the moment-based risk measures of portfolio optimization, such as the square-root kurtosis.

The formula is as follows:

\[\text{Central Moment} = \frac{\sum(\text{Return}_{t} - \text{Mean})^{\text{order}}}{n}\]

Where Mean is the average return and n the number of returns of the sample (the population moment, without a bias adjustment).

Also known as: moment about the mean, third central moment, fourth central moment, square-root kurtosis (its square root for order 4).

Example · XOM, CVX, COP · 2021 to 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_central_moment:

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["XOM", "CVX", "COP"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

toolkit.risk.get_central_moment(period="yearly", within_period=True, order=4, rounding=10)

Or, with the Finance Toolkit MCP set up, ask an AI assistant such as Claude or ChatGPT:

What was the fourth central moment of the daily returns of ExxonMobil, Chevron, ConocoPhillips and the S&P 500 in each year from 2021 to 2025?

Which returns:

Parameters

get_central_moment accepts the following parameters.

ParameterTypeDescriptionExample
periodstrThe data frequency for returns. Options are: “daily”, “weekly”, “monthly”, “quarterly”, “yearly”. Defaults to “daily”."weekly"
orderintThe order of the moment, an integer of 2 or higher. Defaults to 3.2
within_periodboolWhether to calculate the Central Moment within the specified period or for the entire period. Thus whether to look at the Central Moment within a specific year (if period = ‘yearly’) or look at the entirety of all years. Defaults to False. Note that this requires intraday data when period = ‘daily’, since a single day only nests observations when intraday data was fetched.True
rollingintThe rolling window size to use for the calculation. If set, the Central Moment is calculated over a rolling window of this many periods across the full return history instead of per period. At least 2. Defaults to None.4
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 Central Moment values over time. Defaults to False.True
lagint | list[int]The lag to use for the growth calculation. Defaults to 1.4
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

References

Share