portfolio optimisation with VaR (or CVaR) constraints - Quantitative Finance Stack Exchange most recent 30 from quant.stackexchange.com 2019-05-22T07:33:44Z https://quant.stackexchange.com/feeds/question/3934 http://www.creativecommons.org/licenses/by-sa/3.0/rdf https://quant.stackexchange.com/q/3934 20 portfolio optimisation with VaR (or CVaR) constraints RockScience https://quant.stackexchange.com/users/134 2012-08-10T04:56:14Z 2017-04-27T19:42:30Z <p>I would like to optimize a portfolio allocation (maximizing the exposure or the expected return), but with VaR or CVaR contraints. (some parts of my portfolio cannot exceed a certain VaR)</p> <p>How can I achieve that? Is there a way to turn the problem into a linear programming problem? or to approximate the results?</p> <p>Any links or ideas are welcome.</p> https://quant.stackexchange.com/questions/3934/-/3935#3935 4 Answer by Marc Shivers for portfolio optimisation with VaR (or CVaR) constraints Marc Shivers https://quant.stackexchange.com/users/2027 2012-08-10T12:15:25Z 2013-01-13T13:29:54Z <p>I think what you're looking for is a type of solver called a second-order cone program (<a href="http://en.wikipedia.org/wiki/Second-order_cone_programming" rel="nofollow">SOCP</a>) solver. This is just like a quadratic program (QP) solver, except the constraints can be quadratic as well as the objective function. There is an open-source implementation in python via the <a href="http://abel.ee.ucla.edu/cvxopt/userguide/coneprog.html#second-order-cone-programming" rel="nofollow">CVXOPT</a> module.</p> https://quant.stackexchange.com/questions/3934/-/3936#3936 3 Answer by André Christoffer Andersen for portfolio optimisation with VaR (or CVaR) constraints André Christoffer Andersen https://quant.stackexchange.com/users/2792 2012-08-10T12:39:43Z 2012-08-10T12:39:43Z <p>You could define your optimization problem as a typical linear risk/return optimization problem(1), then use some predicted return as the return component and VaR or cVaR as the risk component. This will not be linear, however you can use an evolutionary algorithm, or some other exotic search algorithm, to maximize for return given a limit on VaR or cVar. The tricky part is to make a good utility/fitness function, i.e., a smooth one. </p> <p>In essence what you will be doing is to generate a bunch of random feasible portfolios, making sure to throwing out any that have too large of a VaR. The remaining feasible portfolios are ranked based on the utility/fitness function. Keep some of the best once (survival of the fittest) and based on these make small random alterations to the portfolios (mutations). Then re-rank the portfolios. Redo this for several generations. Eventually you should be optimizing based on VaR. There are many tools and frameworks that can do this for you. I used Encog last time I did something like it.</p> <pre><code>(1) Utility(portfolio) = PredictedReturn(portoflio) - VaR(portoflio) </code></pre> https://quant.stackexchange.com/questions/3934/-/3937#3937 4 Answer by Alexey Kalmykov for portfolio optimisation with VaR (or CVaR) constraints Alexey Kalmykov https://quant.stackexchange.com/users/370 2012-08-10T13:20:53Z 2012-08-15T00:42:10Z <p>You can find a good example on CVaR optimization in the book "<a href="https://www.rmetrics.org/ebooks-portfolio" rel="nofollow">Portfolio Optimization with R/Rmetrics</a>" By Diethelm Wuertz, Yohan Chalabi, William Chen, Andrew Ellis.</p> <pre><code>#load library fPortfolio library(fPortfolio) #use indicies LPP2005, see http://www.pictet.com/en/home/lpp_indices.html lppData &lt;- 100*LPP2005.RET[,1:6] #create portfolio specification frontierSpec &lt;- portfolioSpec(); #optimization criteria - CVaR setType(frontierSpec) &lt;- "CVAR" #set optimization algorithm setSolver(frontierSpec) &lt;- "solveRglpk" #set confidence level CVaR setAlpha(frontierSpec) &lt;- 0.05 #number of portfolios in efficient frontier setNFrontierPoints(frontierSpec) &lt;- 25 #optimize, without shortselling frontier &lt;- portfolioFrontier(data = lppData, spec = frontierSpec, constraints="LongOnly"); #build efficient frontier graph tailoredFrontierPlot(object=frontier,mText="Mean-CVaR Frontier (Long only)",risk="CVaR"); weightedReturnsPlot(frontier) </code></pre> <p>I don't recommend you to use VaR optimization for two reasons:</p> <ol> <li>VaR is not a subbaditive risk measure, therefore your portfolio could be highly undiversified. </li> <li>It's more challenging computationally than CVaR optimization </li> </ol> https://quant.stackexchange.com/questions/3934/-/3938#3938 11 Answer by John for portfolio optimisation with VaR (or CVaR) constraints John https://quant.stackexchange.com/users/2379 2012-08-10T14:53:36Z 2012-08-10T14:53:36Z <p>In my experience, a VaR or CVaR portfolio optimization problem is usually best specified as minimizing the VaR or CVaR and then using a constraint for the expected return. As noted by Alexey, it is much better to use CVaR than VaR. The main benefit of a CVaR optimization is that it can be implemented as a linear programming problem. Another option I have tried is the technique in this paper: </p> <p><a href="http://www.math.uwaterloo.ca/~tfcolema/articles/bank_article.pdf">http://www.math.uwaterloo.ca/~tfcolema/articles/bank_article.pdf</a></p> <p>Another option is the two-step heuristic where one first finds the mean-variance efficient frontier and then you could calculate whatever are the relevant portfolio statistics on only the mean-variance efficient portfolios. In this way you could exclude portfolios that have too high a VaR or CVaR (or mixed CVaR deviation) for your consideration. </p> <p>However, as you say you are particularly concerned about the VaR or CVaR of certain parts of your portfolio. As noted above, VaR constraints for different different groups of assets would require non-linear constraints. However, CVaR constraints for different assets could be calculated using linear constraints (though it would also be possible to implement a relatively slower methodology using non-linear constraints). For guidance on how to implement this as a linear constraint, it might help to follow</p> <p><a href="http://www.soa.org/library/proceedings/arch/2008/arch-2008-iss1-cox-lin.aspx">http://www.soa.org/library/proceedings/arch/2008/arch-2008-iss1-cox-lin.aspx</a></p> <p>with the only difference that you would want to calculate the CVaR over the relevant groups of securities.</p> https://quant.stackexchange.com/questions/3934/-/3939#3939 8 Answer by David Nehme for portfolio optimisation with VaR (or CVaR) constraints David Nehme https://quant.stackexchange.com/users/1418 2012-08-10T14:54:15Z 2012-08-15T18:01:48Z <p>The VaR constraint is convex and quadratic and can be handled with any solver supports quadratic constraints, like <a href="http://www.gurobi.com">Guribi</a>, <a href="http://www-01.ibm.com/software/integration/optimization/cplex-optimizer/">cplex</a> (from IBM) or <a href="http://www.fico.com/en/Products/DMTools/xpress-overview/Pages/Xpress-Optimizer.aspx">xpress</a> (from FICO). </p> <p>The CVaR can be formulated as a <a href="http://www.ise.ufl.edu/uryasev/files/2011/11/VaR_vs_CVaR_INFORMS.pdf">linear program</a> if you are able to perform monte-carlo simulations on the returns. Briefly, the LP model is</p> <p>\begin{eqnarray*} c &amp;\ge&amp; \alpha + {1 \over (1-\beta)|J|} \sum_{j\in J} z_j \\ z_j &amp;\ge&amp; \sum_{i \in I} r_{ij} x_i - \alpha \hspace{0.2in} \forall j \in J \end{eqnarray*} Where c is the cvar at $\beta$ confidence, $I$ is the set of investments, $x_i$ is the level of investment in $i$, $J$ is the set of monte-carlo scenarios, $r_{ij}$ is the unexpected loss of investment $i$ in simulation $j$. $\alpha$ is the loss of the $100 \cdot \beta$ percentile scenario, and ${1 \over (1-\beta)|J|} \sum_j z_j$ is the average unexpected loss (in excess of alpha) of the worst $(1-\beta)|J|$ scenarios.</p> <p>The resulting LP instances are very dense and large, so it requires delayed column and constraint generation for non-trivial problems.</p>