File Exchange

image thumbnail

CVaR Portfolio Optimization

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


Updated 18 Sep 2018

View License

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

Kawee Numpacharoen (2020). CVaR Portfolio Optimization (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (12)

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?

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.



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},...


Mosif Khan

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



Major update for the example using newer capabilities of MATLAB and Toolboxes

Updated license

Minor code cleanup, fixed some typos in comments.

MATLAB Release Compatibility
Created with R2018a
Compatible with R2018a to any release
Platform Compatibility
Windows macOS Linux