# Portfolio optimization with Portfolio CVaR Constraint

I wanted to optimize a portfolio based on a portfolio-wide CVaR constraint (i.e. $CVaR_p \leq 0.08$). Unfortunately, I only find solution that minimizes the entire CVaR of the Portfolio.

Do you mind telling me if I need to add a restriction or how to change the utility function?

Here, you find the initial data and optimization Link

## Edit

I removed some stupid elements. I will give a full answer once I finished the semester at the university.

• Check out "Portfolio Optimization with Conditional Value-at-Risk Objective and Constraints" by Krokhmal, Palmquist, and Uryasev
– John
Apr 17 '14 at 14:00
• @John: I think they added a (C)VaR Constraint on the asset side. I want to minimize the variance of the portfolio and also force the portfolio not to extend a certain CVaR limit. Do you know how to implement such a optimizer/solver? Apr 17 '14 at 18:10
• That paper comes very close to solving your issue. They show how to constrain the CVaR of a portfolio to an amount while maximizing return. All you have to do is replace the objective with minimizing variance. Alternately, after setting it up that way, you could replace the linearization with Alexander et al's approach in "Minimizing CVaR and VaR for a portfolio of derivatives", though you couldn't use an LP anymore.
– John
Apr 17 '14 at 19:16
• @John: I followed the first hint and used LP to minimize variance and added a CVaR constraint. I didn't have that much success. Do you mind having a look at my "example"? Apr 18 '14 at 9:28
• I would follow the progression of first getting the minimize CVaR to work, then max return given CVaR, then min variance given CVaR. The problem here is that you're not using Rockafellar & Urysev's approach at all. The weighted average CVaR of individual assets is not the CVaR of the portfolio. This doesn't work for variance, so it wouldn't work for CVaR. Read Rockafellar and Urysev's Optimization of Conditional Value at Risk. Both of the authors have presentations on their websites that explain it better. Check those out.
– John
Apr 18 '14 at 14:08

Writing a linear solver with a CVaR-Constraint is time-consuming. "Portfolio Safeguard" of "American Optimal Decision Inc." is optimized for such kind of problems.

In order to get it work, you must add the following elements:

Data

• matrix_scenarios (a matrix of all your returns)
• matrix_returns (a vector containing the expected returns)

Function

• CVaR (cvar_risk)
• linear (linear)
• standard deviation (st_risk)

Problem

• variance as objective
• CVaR as constraint
• budget as constraint
• Box variables

Optimization

• you can run the optimization by pressing CTRL + o

Later I will illustrate the process.