Skewness
Calculate the Skewness of an investment portfolio or asset’s returns.
Skewness is a statistical measure used in finance to assess the asymmetry in the distribution of returns for an investment portfolio or asset over a defined period. It offers valuable insights into the shape of the return distribution, indicating whether returns are skewed towards the positive or negative side of the mean. Skewness is a crucial tool for investors and analysts seeking to understand the potential risk and return characteristics of an investment, aiding in the assessment of the distribution’s tails and potential outliers. It provides a means to gauge the level of skew in returns, enabling more informed investment decisions and risk management strategies.
The formula is as follows:
\[\text{Skewness} = n / ((n - 1) \cdot (n - 2)) \cdot \text{Σ} ((\text{Return} - \text{Mean}) / \text{Std}) ^{3}\]Where n is the number of returns and Std the sample standard deviation (ddof=1), which is the bias-adjusted sample skewness (G1) of pandas and Excel’s SKEW.
Also known as: return distribution asymmetry, tail skew.
Skewness in Python or via the MCP
Install the Finance Toolkit with:
pip install financetoolkit -U
Then call get_skewness as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(
["NFLX", "DIS", "WBD"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
toolkit.risk.get_skewness(period="yearly", within_period=True)
Or, after setting up the Finance Toolkit MCP, ask:
How skewed were the daily returns of Netflix, Disney, Warner Bros. Discovery and the S&P 500 in each year from 2021 to 2025?
Which returns:
| NFLX | DIS | WBD | Benchmark | |
|---|---|---|---|---|
| 2021 | 1.8966 | 0.2848 | -2.1536 | -0.3334 |
| 2022 | -2.1029 | -0.5086 | -0.0126 | 0.0454 |
| 2023 | 1.5636 | -0.2155 | -0.42 | -0.0206 |
| 2024 | 0.872 | 0.7012 | 0.6324 | -0.5242 |
| 2025 | -0.2855 | 0.6672 | 1.9711 | 1.5069 |
Parameters
get_skewness accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
period | str | The data frequency for returns (daily, weekly, monthly, quarterly, or yearly). Defaults to “daily”. | "weekly" |
within_period | bool | Whether to calculate the Skewness within the specified period or for the entire period. Thus whether to look at the Skewness 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 |
rolling | int | The rolling window size to use for the calculation. If set, Skewness is calculated over a rolling window of this many periods across the full return history instead of per period. Defaults to None. | 20 |
rounding | int | None | The number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise). | 2 |
growth | bool | Whether to calculate the growth of the Skewness values over time. Defaults to False. | True |
lag | int | list[int] | The lag to use for the growth calculation. Defaults to 1. | 4 |
standardize | bool | Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False. | True |