<< esvarlin Financial module euler >>

Financial module >> Financial module > esvaroptim

esvaroptim

Compute the optimal portfolio minimizing the Expected Value (this is a linear programming problem). The Value at Risk of the portfolio is also computed (this implements the Rockafeller-Uryasev algorithm)

SYNOPSIS

[w,ES,VaR]=esvaroptim(price,ER,r,dt,alpha);

Description

Give the historical prices of a set of assets, compute the optimal portfolios solving four different problems. All of them minimize the Expected Shortfall subject to the constraint of having given expected return. The four problems are different for the following characteristics

1) optimal portfolio allowing short selling and investing in the riskless asset;

2) optimal portfolio allowing short selling but without investing in the riskless asset;

3) optimal portfolio not allowing short selling and investing in the riskless asset;

4) optimal portfolio not allowing short selling and without investing in the riskless asset.

Finally the Vale at Risk of the optimal portfolio is computed. The procedure uses "qld" function.

Parameters

price
matrix whose columns contains the historical prices of the assets in the portfolio
ER
expected return that the investor wants to obtain on his portfolio
r
riskless interest rate
dt
time frequency of the prices with respect to the time unit of measure of both "ER" and "r"; if the matrix of prices contains daily data and both "ER" and "r" are annual return, then dt=1/250 since there are 250 working day in one year
alpha
confidence level at which both Expected Shortfall and Value at Risk must be computed (it must be between 0 and 1, with 0 and 1 both excluded)

Output

w
matrix containing the optimal portfolios; in particular:
first raw: with short selling and with r
second raw: with short selling and without r
third raw: without short selling and with r
fourth raw: without short selling and without r
ES
Expected Shortfall of the optimal portfolio (at alpha confidence level)
VaR
Value at Risk of the optimal portfolio (at alpha confidence level)

Example

First we generate 1000x3 log-normally distributed daily asset prices with 0.1/250 mean and 0.2/sqrt(250) variance. The first prices of the three assets are 25 euros, 50 euros, and 110 euros respectively.

-->M=grand(1000,3,'nor',0.1/250,0.2/sqrt(250));

-->price=exp(cumsum(M,1))*diag([25 50 110]);

Now we can use the function on these prices.

-->[w,ES,VaR]=esvaroptim(price,0.05,0.01,1/250,0.01)

Draw frontier? (y/n) y

! with short selling without short selling !

! with r without r with r without r !

VaR = 0.0122548 0.0178937 0.0135530 0.0178937

ES = 0.0135257 0.0208130 0.0153525 0.0208130

w = 0.3180045 0.5742962 0.4706583 0.5742962

0.1079194 0.2480433 0.1313949 0.2480433

- 0.1904050 0.1776605 0. 0.1776605

We see that the third asset is sold (negative portfolio component) when it is possible. If short selling is not allowed, then its weight is either positive or zero.

The function also asks if one wants to see the optimal frontiers (this is optional since the procedure takes some time). The figure which is created shows four frontiers corresponding to the four different problems (the legend explains the meanings).

Bibliography

"Optimization of Conditional Value-at-Risk", Rockafeller, R. T. and Uryasev, S., Journal of Risk, 2, 21-41, 2000

Authors

Francesco Menoncin - Brescia University - 2010

See Also


<< esvarlin Financial module euler >>