File Exchange

CVaR Portfolio Optimization

version 2.0.0 (263 KB) by
Conditional Value at Risk (CVaR) portfolio optimization with the PortfolioCVaR object

Updated 18 Sep 2018

This example shows a Conditional Value at Risk (CVaR) portfolio optimization workflow, which includes:
* How to simulate asset scenarios based on normal distribution and the empirical distribution
* How to construct a portfolio using PortfolioCVaR object
* How to evaluate the efficient frontier
* How to extract the portfolio weights
* How to calculate CVaR of the portfolio

Cite As

MathWorks Quant Team (2021). CVaR Portfolio Optimization (https://www.mathworks.com/matlabcentral/fileexchange/38288-cvar-portfolio-optimization), MATLAB Central File Exchange. Retrieved .

YI CHEN

jens pauwels

i have a question maybe someone can help me. I try to use the simulation, but I already have returns and no courses. Executing the code stumbles over the command = ret = tick2ret (T {:, symbol}) ;. However, I have to create a double for RET. Does anyone know the tool for this?

Tony Tran

I am confused at the following code.

pRet1 = estimatePortReturn(p1,w1);
pRisk1 = estimatePortRisk(p1,w1);
pRet2 = estimatePortReturn(p1,w2); % p2, w2 ???
pRisk2 = estimatePortRisk(p1,w2); % p2, w2 ???

The last two rows should be p2 instead of p1?

Thanks.

Christopher McCoy

Very good video! However, when I try it on my own data the plotAssetHist(symbol,ret) does not seem to work. It tells me "Undefined function 'plotAssetHist' for input arguments of type 'cell'." Is this because symbol is of type "cell"? If yes, why does it work in the video then?

Matthew McKechnie

Christopher Moule

GUO LIANG ZHANG

Nicholas Thomason

ding wei

Great introduction to CVaR portfolio optimization in Matlab. Since Yahoo closed there historical stock data API could you (Seth DeLand?) provide the matrices that are generated when using "fetch the data" segment of the program?. I want to get a sense of the matrix structure so I can start modifying the code. I'm new to Matlab and computational finance so any help would be greatly appreciated.

Nompumelelo Mabophe

Rodrigue Djikeuchi

Hello,

I am getting this error:Error using yahoo/fetch (line 387)
Unable to return historical data for given security.

Error in CVaRPortfolioOptimizationExample (line 47)
Price.(bondETFTickers{ii}) = fetch(C,bondETFTickers{ii},...

Barney

Mosif Khan

Annalisa Beato

It's a good example for the PortfolioCVaR object. I had to use tick2ret instead of price2ret.

MATLAB Release Compatibility
Created with R2018a
Compatible with R2018a and later releases
Platform Compatibility
Windows macOS Linux