#### By Anna Yasenova

Traditional diversification focuses on dollar allocation; but because equities have a disproportionate risk, a traditional portfolio’s overall risk is often dominated by its equity portion. Risk Parity diversification focuses on risk allocation, seeking to generate both higher and more consistent returns.

## What is Risk Budgeting? Why did we choose the risk parity?

We are trying to split our assets in order to match risk budgets. Risk budgeting is a quantitative endeavor that brings logic and scientific rigor to the portfolio management process that helps one understand the risks they are taking as they attempt to maximize returns. Risk parity is a special case of risk budgeting.

So, what is risk parity? Why do we need it?

Risk parity builds on an assumption that we have selected the best funds and we do not want to prefer one asset to the other just to equally split the risk between assets.

For many years, a large percentage of financial planners and stockbrokers crafted portfolios for their clients that were composed of 60% equities and 40% bonds or other fixed-income offerings. And these portfolios did rather well throughout the 80s and 90s.

First of all, we’re not in the 90’s.

Secondly, it is easy to understand that if we invest the same amount of money in assets with different risks, we don’t maximize profits. But maximization of profit is the goal of each trader after all.

The point of risk parity is that it makes no attempt to try and predict where markets are going to go. Regardless of the global macro events that shape markets risk parity is useful to build a well-diversified portfolio.

Okay, cool. It’s necessary to equalize somehow the risks of assets in the portfolio. In the previous sentences, I often repeat the word “risk”. The semantic meaning of the term is clear, but calculating risk is a lot more complicated.

Let’s figure out step by step.

## Theory.

Risk budgets are frequently used to allocate the risk of a portfolio by decomposing the total portfolio risk into the risk contribution of each component position.

There is not one meaning to the word “risk”. There is a classical one – volatility and more recent ones – value-at-risk (VaR) and conditional value-at-risk (CVaR or expected shortfall). For the reasons too complicated for this paper CVaR is better than the 1st two. It is a risk measure used to evaluate the market risk or credit risk of a portfolio. The “expected shortfall at *q% *level” is the expected return on the portfolio in the worst *q% *of cases.

The first step in the construction of a risk budget is to define how the portfolio’s risk and its risk contributions should be calculated.

The actual risk contributions we estimated in following way: if the returns at time *t *are conditionally normally distributed with mean ?_{t}, and covariance matrix ?_{t}, then CVaR at time *t *is given by

with z_{?}is the ? quantile of the standard normal distribution and *?*the standard normal density function. The contribution to CVaR is then

Perfect! We have a formula! We need to understand the meaning of CVaR and what we need to optimize to get the proper result.

So, we have a portfolio consisting of N assets. Every CVaR_{i }is a measure of the risk of each asset (risk contribution). And CVaR of the entire portfolio is a measure of the risk of the entire portfolio.

Our optimization problem can be interpreted as the problem of finding the optimal value of some objective function. As a result, we need to get the weights for portfolio assets which equalize their risk contributions.

## Objective function. Optimizer.

What should this function look like Which optimizer to choose? We explored many options. The first ones were:

- Obj_func = ?(b
_{i}– CVaR_{i }/ CVaR)^{2}, where each biis equal to 1 / N. The essence of this is that each asset corresponds to a value from array b, which is the expected value of the risk contribution for this asset. - Obj_func = ??(CVaR
_{i}– CVaR_{i})^{2}, where CVaR_{i}and CVaR_{j}are the risk contributions of ?-th and j-th assets. That means we minimize the difference between the risk for all assets in pairs.

Weights are certain coefficients for assets in a portfolio. Therefore, it is necessary to impose a condition: ?w_{i }= 1, also set limits for values of weights (from 0 to 1).

To minimize these functions, we used the *minimize *method from the scipy.optimize module. The method for optimization is SQSLP. However, we didn’t get our desired results. One of the reasons is that on a plane given by the restriction ?w_{i }= 1, there may not be one solution. Another attempt is the least squares method. It is also implemented in the scipy.optimize module. Our function is the sum of squares of differences. Minimization of such a function is the task of this method. However, the weights obtained in this case were close to 0, this is a bad result, but it is easy to explain by the example of the second objective function: when weights equal to zero, it reaches its minimum.

We explored even some more versions of the objective function – essentially these are different nonconvex problems which aren’t easy to solve.

Okay, everything is clear, but there is no relief for us. The expected result is not obtained. Silence. Hopelessness.

But not everything is lost. One beautiful sunny day we found an article (http://www.thierry-roncalli.com/download/active-risk-parity.pdf), which presents another approach to this problem.

The coefficient is determined for each type of risk parity. The expression for the objective function will be

Note: Be careful with the alpha parameter. In general, for VaR is a confidence interval, for CVaR is quantile.

We have a standard optimization problem (minimization of a convex function subject to convex bounds). ( Proof in definition 4 https://iris.uniroma1.it/retrieve/handle/11573/924304/331796/Tesi%20dottorato%20Veliu)

We understood we can use convex solver but our problem while being convex did not comply with the DCP rules (see http://cvxr.com/cvx/doc/dcp.html ). So we had to transform our problem to the one which does comply. For this we used a special transofrmation of the problem: sqrt(x’?x)= norm(L’, x), where L is a Cholesky decomposition of a matrix ?.

To minimize the convex function, we used the cvxpy module. The solution of our problem can be obtained with the following scaling

where *y**is weights, obtained from minimizer.

Our implementation of the CVaR Risk Parity is below:

```
def risk_parity(E, b, mu, gamma_val, c_inf, max_iters=5000):
tmp = E
N = E.shape[0]
idx = E.index
E = np.matrix(E.values)
w = cp.Variable((N,1))
gamma = cp.Constant(gamma_val)
L = np.linalg.cholesky(E)
n = cp.norm(L.T * w, 2)
ret = mu.T * w
k = -2.8
minimizer = cp.Minimize(n) if c_inf else cp.Minimize(-ret + n * gamma)
constraints = [w >= 0,
b.T * cp.log(w) >= k]
prob = cp.Problem(minimizer, constraints)
prob.solve(max_iters=max_iters)
status = prob.status.lower()
if status == 'optimal':
with np.errstate(divide='ignore'):
w_arr = w.value.ravel()
res = pd.Series(w_arr/w_arr.sum(), index=idx)
return res
elif status == 'unbounded':
E = pd.DataFrame(E*1000000, index=idx, columns=idx)
return risk_parity(E, b, mu, gamma_val, c_inf)
elif status == 'optimal_inaccurate':
max_iters = max_iters * 1.1
E = pd.DataFrame(E, index=idx, columns=idx)
return risk_parity(E, b, mu, gamma_val, c_inf, int(max_iters))
else:
print('Unknown problem status!')
return
``` |

## So what?

Remember, CVaR Risk Parity calculates the weights in such a way that risk contributions for each asset are equal, but over time (we counted in a month) they become different and should be recalculated regularly. But after recalculation, the overall composition of the portfolio doesn’t require significant changes, because the weight change isn’t large.

We believe that this is a significant advantage of CVaR risk parity algorithm over, for example, the mean variance optimization (MVO, see http://www.efficientfrontier.com/ef/497/mvo.htm).

And in order for you, to understand the greatness and beauty of the CVaR risk parity algorithm, take a look at the risk contributions for an equal-weights portfolio (blue color) in comparison with the risk contributions obtained in the case of using our risk parity (yellow color).

In the case of using risk parity they’re equal, which is a very good result.

But in the case with equal-weights portfolio, they’re completely different. It looks like Russian roulette!

## Verifying results.

How does it work in life?

Note: for a visual comparison, we chose the equal-weights and risk parity portfolios to show the obvious advantages of equalizing the risk of assets over dividing the available amount of money equally between assets, in our case retail FX traders.

We investigated returns of the top 10 PsyQuation’s traders, calculated the weights for portfolio components using risk parity and compared profits of both risk parity portfolio and equal-weights portfolio for a predetermined amount (we have $1,000,000).

You can see that the equal-weight portfolio is more volatile. We determined that risk parity portfolio is “calmer” and more diversified than an equal-weights portfolio. It may cause lower profits, but significantly reduce losses, if any.

In order to prove this, we calculated a *Sharpe ratio *for both cases. Sharpe ratio is a way to examine the performance of an investment by adjusting for its risk. Generally, the greater the value of the Sharpe ratio, the more attractive the risk-adjusted return. (https://www.investopedia.com/terms/s/sharperatio.asp)

If the risk parity is used, the value is greater, and therefore this algorithm is better than an equal-weights portfolio.

## Conclusions.

The practice behind Risk Parity strategy is very useful and interesting for us because it provides us with more meaningful diversification than traditional approaches, a portfolio that is more robust in different economic environments, and an opportunity to improve the risk/return characteristics of an overall portfolio, by either enhancing return, reducing risk, or a combination of both.