Semideviation Risk Parity
The Semideviation Risk Parity gives every asset the same share, or its budgeted share, of the downside deviation of the portfolio below a return of zero (Sortino and Price, 1994), so only the periods in which the portfolio loses count.
The formula for the Semideviation Risk Parity starts from the return \(X_{t}\) of the portfolio in each of the T periods, with \(w_{i}\) the weight and \(r_{i , t}\) the return of asset i of the N assets, and sets the risk contribution \(\text{RC}_{i}\) of every asset, its weight times the derivative of SD by that weight, to its budget \(b_{i}\) times SD:
\[X_{t} = \sum_{i=1}^{N} w_{i} \cdot r_{i,t}\] \[\text{SD} = \sqrt{\frac{\sum_{t=1}^{T} \min\left(X_{t}, 0\right)^{2}}{T}}\] \[\text{RC}_{i} = b_{i} \cdot \text{SD}\]Assets that lose when the portfolio loses get smaller weights, while upside swings do not count against an asset.
Volatile assets get smaller weights, and correlated assets share their risk budget, so no single asset dominates the portfolio’s risk. Risk parity needs no expected returns, which are the inputs mean-variance analysis is most sensitive to, and spreads the risk where an equally weighted portfolio spreads the capital (Maillard, Roncalli and Teïletche, 2010). The risk contribution of an asset is its weight times the derivative of the risk measure by that weight; for the measures here, which double when every weight doubles, the contributions add up to the risk of the portfolio, and risk parity sets each to its budget, an equal share by default. For a risk measure other than the volatility, the weights are those of the y that minimizes the measure subject to a logarithmic barrier on the budgets, scaled to sum to one (Roncalli, 2013), which makes the problem convex.
Also known as: downside risk parity, semideviation risk budgeting.
In the Finance Toolkit this is get_risk_parity_weights with risk_measure="semideviation", the same function as Risk Parity.
Example · AAPL, MSFT, JNJ, XOM · 2021 to 2025
Install the Finance Toolkit with pip install financetoolkit -U, then call get_risk_parity_weights:
from financetoolkit import Toolkit
toolkit = Toolkit(
["AAPL", "MSFT", "JNJ", "XOM"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
toolkit.portfolio.get_risk_parity_weights(risk_measure="semideviation", sector_bounds={"Healthcare": (0, 0.3)})
| Parameter | Type | Description | Example |
|---|---|---|---|
risk_budget | dict[str, float] | None | The share of the risk per asset, e.g. {“AAPL”: 0.4, “MSFT”: 0.2, …}, positive for every asset; it is scaled to sum to one. A budget that names an asset outside the portfolio or leaves an asset out raises a ValueError that lists them. Defaults to None, an equal share for every asset. | None, an equal share for every asset |
period | str | The frequency of the returns. Options are: “daily” (daily returns), “weekly” (weekly returns), “monthly” (monthly returns), “quarterly” (quarterly returns), “yearly” (yearly returns). Defaults to “daily”. | "weekly" |
covariance | str | The estimator of the covariance matrix. The shrinkage and denoised estimators stabilize the weights when there are many assets compared to the number of periods. Options are: “sample” (the sample covariance, ddof=1), “ledoit_wolf” (shrunk towards the scaled identity, Ledoit and Wolf, 2004), “ledoit_wolf_constant_correlation” (shrunk towards the average correlation, Ledoit and Wolf, 2004), “ledoit_wolf_single_factor” (shrunk towards the covariance that the benchmark as a single factor implies, Ledoit and Wolf, 2003), “oas” (Oracle Approximating Shrinkage, Chen et al., 2010), “shrunk” (a fixed 10% towards the scaled identity), “semicovariance” (the co-movement below a zero return, Estrada, 2008), “exponential” (exponentially weighted, recent periods weigh most, RiskMetrics), “denoised” (the eigenvalues of the correlation matrix that random returns could produce averaged, Laloux et al., 2000), “denoised_spectral” (those eigenvalues set to zero), “denoised_shrink” (the noise correlations shrunk towards their diagonal, López de Prado, 2020), “gerber” (co-movements beyond half a standard deviation, Gerber et al., 2022), “factor” (the covariance of the Fama and French five factor model with OLS loadings, Fama and French, 1993), “minimum_covariance_determinant” (the reweighted covariance of the half of the periods with the smallest covariance determinant, robust to outliers, Rousseeuw and Van Driessen, 1999), “jlogo” (the sparse inverse covariance on the TMFG planar graph of the correlations, Barfuss et al., 2016), “geodesic” (10% towards the scaled identity along the geodesic of the positive definite matrices, Bhatia, 2007), “regime_adjusted_ew” (exponentially weighted with a half-life of 40 periods, rescaled by the recent realized against predicted risk, Paleologo, 2025), “nercome” (eigenvectors from one part of the periods and the variances along them from the other, averaged over random splits, Lam, 2016), “ccc_garch” (the next-period covariance of GARCH(1, 1) volatilities with constant correlations, Bollerslev, 1990), “mm” (the robust MM-estimator, Maronna et al., 2019), “rocke” (Rocke’s robust S-estimator, Maronna et al., 2019). Defaults to “sample”. | "sample" |
covariance_span | int | The span in periods of the exponentially weighted covariance; the weight of a period halves after about span / 2.9 periods. Defaults to 180. | 180 |
minimum_weight | float | dict[str, float] | The lowest weight of every asset, or per asset, e.g. {“AAPL”: 0.05} (the others keep 0); it cannot be negative. Defaults to 0. | 0 |
maximum_weight | float | dict[str, float] | The highest weight of every asset, or per asset, e.g. {“AAPL”: 0.3} (the others keep 1). Defaults to 1. | 1 |
sector_bounds | dict[str, tuple[float, float]] | None | The minimum and maximum total weight per sector, e.g. {“Technology”: (0, 0.4)}, with the sector of each asset from its company profile. Defaults to None. | None |
country_bounds | dict[str, tuple[float, float]] | None | The minimum and maximum total weight per country, named in full or by its two-letter code, e.g. {“United States”: (0, 0.6)}, with the country of each asset from its company profile. Defaults to None. | None |
risk_measure | str | The risk the assets share. Options are: “volatility” (Volatility Risk Parity, of the covariance estimator), “mad” (Mean Absolute Deviation Risk Parity, Konno and Yamazaki, 1991), “semideviation” (Semideviation Risk Parity, below a zero return), “lower_partial_moment” (Lower Partial Moment Risk Parity, below a zero return), “gini_mean_difference” (Gini Mean Difference Risk Parity, Yitzhaki, 1982), “tail_gini” (Tail Gini Risk Parity, Furman et al., 2017), “cvar_range” (Conditional Value at Risk Range Parity, of the losses and of the gains), “tail_gini_range” (Tail Gini Range Risk Parity, of the losses and of the gains), “ulcer_index” (Ulcer Index Risk Parity, of the uncompounded cumulative return), “cvar” (Conditional Value at Risk Parity, Rockafellar and Uryasev, 2002), “cdar” (Conditional Drawdown at Risk Parity, Chekhlov et al., 2005). Defaults to “volatility”. | "volatility" |
alpha | float | The tail probability of the CVaR, CDaR, CVaR range and Tail Gini measures, e.g. 0.05 for the worst 5% of periods. Defaults to 0.05. | 0.01 |
include_benchmark | bool | Whether to include the benchmark as an asset. Defaults to False. | True |
rounding | int | None | The number of decimals to round the results to. Defaults to None, which uses the Toolkit’s rounding. | 2 |
show_columns | str | list[str] | None | The 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 |
Which returns:
| Item | Weight | Expected Return | Volatility | Sharpe Ratio | Risk Contribution | Semideviation | Semideviation Contribution |
|---|---|---|---|---|---|---|---|
| AAPL | 0.1992 | 0.1932 | 0.2786 | 0.5725 | 0.2764 | 0.0118 | 0.2756 |
| MSFT | 0.2386 | 0.2017 | 0.2571 | 0.6534 | 0.2813 | 0.0110 | 0.2807 |
| JNJ | 0.3000 | 0.0977 | 0.1674 | 0.3823 | 0.1575 | 0.0072 | 0.1601 |
| XOM | 0.2621 | 0.2911 | 0.2702 | 0.9526 | 0.2847 | 0.0116 | 0.2837 |
| Portfolio | 1.0000 | 0.1923 | 0.1523 | 1.0411 | 1.0000 | 0.0065 | 1.0000 |
5 rows
References
- Paper Roncalli, T. (2013). “Introduction to Risk Parity and Budgeting.” Chapman & Hall/CRC, Boca Raton.
- Paper Sortino, F. A. and Price, L. N. (1994). “Performance Measurement in a Downside Risk Framework.” The Journal of Investing, 3(3), 59-64.