Vous êtes sur la page 1sur 35

Introduction A simple two-asset model Efficient Frontier Optimal portfolios

Portfolio Optimization

Gauthier Vermandel

2019
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

C ONTENTS

Introduction

A simple two-asset model

Efficient Frontier

Optimal portfolios
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

I NTRODUCTION

I The efficient frontier is a concept in modern portfolio


theory introduced by Markowitz (1952).
I A portfolio is "efficient" if it has the best possible expected
level of return for its level of risk.
I It is possible to compute large efficient portfolios using
MATLAB:
I as long as the optimization problem employs matrix
products;
I using newest time series (taking data here from yahoo, but
possible to use bloomberg, datastream, etc).
I These two arguments makes MATLAB > VBA.
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

C ONTENTS

Introduction

A simple two-asset model

Efficient Frontier

Optimal portfolios
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

A SIMPLE TWO - ASSET PORFOLIO

I Soit deux actifs financiers: i = A,B.


I Chaque actif donne une rentabilité rA et rB
I Et possède un écart type respectif de σA et σB .
I Quel est le "meilleur" portefeuille à choisir entre A et B?
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

A SIMPLE TWO - ASSET PORFOLIO


I Quel est le "meilleur" portefeuille à choisir entre A et B?
I Cela revient à choisir les parts xA et xB de chaque actif
financier dans mon portefeuille tel que:

xA + xB = 1
I On évite également la vente à découvert:

xi ≥ 0
I La rentabilité du portefeuille est:

r = xA rA + xB rB
I La variance du portefeuille:

σ2 = x2A r2A + x2B r2B + 2xA xB ρAB

run two_assets.m to randomly pick up available portfolios.


Introduction A simple two-asset model Efficient Frontier Optimal portfolios

A SIMPLE TWO - ASSET PORFOLIO

0.02

0.019

0.018

0.017
mean return

0.016

0.015

0.014

0.013

0.012

0.011

0.01
0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
risk (std)

Figure: Two-asset random portfolios


Introduction A simple two-asset model Efficient Frontier Optimal portfolios

A SIMPLE TWO - ASSET PORFOLIO

We distinguish:
I A portfolio minimizing the variance;
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

A SIMPLE TWO - ASSET PORFOLIO

We distinguish:
I A portfolio minimizing the variance;
I Inefficient portfolios below the minimun variance one;
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

A SIMPLE TWO - ASSET PORFOLIO

We distinguish:
I A portfolio minimizing the variance;
I Inefficient portfolios below the minimun variance one;
I Feasible portfolios above the minimum variance one,
which can be selected by investors according to their risk
preferences:
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

A SIMPLE TWO - ASSET PORFOLIO

We distinguish:
I A portfolio minimizing the variance;
I Inefficient portfolios below the minimun variance one;
I Feasible portfolios above the minimum variance one,
which can be selected by investors according to their risk
preferences:
I A perfectly risk averse investor selects the minimum
variance portfolio;
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

A SIMPLE TWO - ASSET PORFOLIO

We distinguish:
I A portfolio minimizing the variance;
I Inefficient portfolios below the minimun variance one;
I Feasible portfolios above the minimum variance one,
which can be selected by investors according to their risk
preferences:
I A perfectly risk averse investor selects the minimum
variance portfolio;
I A perfectly risk loving investor selects the highest variance
portfolio;
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

A SIMPLE TWO - ASSET PORFOLIO

We distinguish:
I A portfolio minimizing the variance;
I Inefficient portfolios below the minimun variance one;
I Feasible portfolios above the minimum variance one,
which can be selected by investors according to their risk
preferences:
I A perfectly risk averse investor selects the minimum
variance portfolio;
I A perfectly risk loving investor selects the highest variance
portfolio;
I In a two asset portfolio, there is no clear tradeoff between
assets → requires an higher number of available assets in
the portfolio.
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

A THREE - ASSET PORFOLIO

Let’s introduce an asset C:


I Cela revient à choisir les parts xA et xB de chaque actif
financier dans mon portefeuille tel que:

σ2 = x2A r2A + x2B r2B + x2C r2C + cov


r = xA rA + xB rB + xC rC
xA + xB + xC = 1
xi ≥ 0

run three_assets_efficient.m to randomly pick up available portfolios.


Introduction A simple two-asset model Efficient Frontier Optimal portfolios

A THREE - ASSET PORFOLIO

0.04

0.035

0.03
mean return

0.025

0.02

0.015

0.01
0 1 2 3 4 5 6 7
risk (std) ×10 -3

Figure: Three-asset random portfolios


Introduction A simple two-asset model Efficient Frontier Optimal portfolios

A THREE - ASSET PORFOLIO

I Here, a lot of inefficient portfolios


I Solution? Determine only efficient ones:

min σ2
xA ,xB ,xC

s.t. ∑N
i=1 xi Ri = r̄
s.t. xA + xB + xC = 1

Here, we determine for different values of


r̄ ∈ [min(rA , rB , rC ); max(rA , rB , rC )] the minimum variance
portfolio (this eliminates inefficient portfolios).
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

A THREE - ASSET PORFOLIO

0.04
Random Pf
Efficient Pf
0.035 Extreme Pf

0.03
mean return

0.025

0.02

0.015

0.01
0 1 2 3 4 5 6 7 8 9
risk (std) ×10 -3

Figure: Three-asset random portfolios


Introduction A simple two-asset model Efficient Frontier Optimal portfolios

C ONTENTS

Introduction

A simple two-asset model

Efficient Frontier

Optimal portfolios
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

E FFICIENT F RONTIER

I Suppose I want to build a ’junk food’ portfolio composed


of:
I Coca Cola [ko],
I Pepsi [pep],
I McDonald’s [mcd],
I Wendy’s [wen],
I Coca-Cola Bottling [coke],
I Monster [mnst],
I Yum (KFC, Pizza Hut, etc..) [yum],
I and SodaStream [soda].
I What would be the efficient portfolios ?
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

E FFICIENT F RONTIER

I First, define the matrix of stocks:


 
P11 P21 ... PN1
 P12 P22 ... PN2 
P=  ...
 (1)
... ... ... 
P1T P2T ... PNT

with time from 1 to T and the number of assets from 1 to N.


Introduction A simple two-asset model Efficient Frontier Optimal portfolios

E FFICIENT F RONTIER

I Computing the return of each stock:

rit = log(Pit /Pit−1 ).

I Stored in matrix R:
 
R11 R21 ... RN1
 R12 R22 ... RN2 
RR = 
 ...

... ... ... 
R1T R2T ... RNT
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

E FFICIENT F RONTIER

Asset price of ko
120

100

80

60

40
2012 2013 2014 2015 2016 2017

Asset return of ko
0.1

0.05

-0.05

-0.1
2012 2013 2014 2015 2016 2017

Figure: An example with Cocacola stock


Introduction A simple two-asset model Efficient Frontier Optimal portfolios

E FFICIENT F RONTIER
I We compute both the mean return and standard deviation
for each stock:
   
E [RR1 ] σ1
 E [RR2 ] 
 , σR =  σ2  .
 
R=  ...   ... 
E [RRN ] σN
I We can contrast different shares using the mean-variance
(σR ,ER) representation
×10 -3 risk-expected return
20
coke
wen
15 mnst
Return E[R i ]

10 pep

ko yum
5 mcd

0
soda
-5
0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018
Variance σi
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

E FFICIENT F RONTIER

I The proportions of various assets to be held in a portfolio


are given by the following weighting matrix:
 
x1
 x2 
X=  ... 

xN

where x1 is the proportion of the 1st asset in the portfolio.


Via Sums: Via Matrices:
N
∑ i = 1 xi = 1 U0 X = 1
where U0
= (1, 1, .., 1) is a N × 1 auxiliary matrix of all ones to
perform matrix sum.
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

E FFICIENT F RONTIER

For portfolio X, both its return rX and variance σX are


determined by an average weighted by X:
Via Sums: Via Matrices:
N
rX =∑ xR
i=1 i i rX = X0 R
N N
σX = ∑ i=1∑ xx σσρ
j=1 i j i j ij
σX = X0 VX
where ρij is the correlation between assets i and j, V is the
variance covariance matrix.
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

E FFICIENT F RONTIER
I Portfolio optimization is the process of choosing X to make
the portfolio better than any other according to some
criterion.
I Criterion? Highest return RX with lowest volatility σX .
I Idea of efficient frontier: for each return r̄ (between the
lowest return and highest return), we can compute an
optimal portfolio minimizing its variance.
Via Sums: Via Matrices:

min σ2 min X0 VX
x1 ,x2 ,...xn X X
s.t. ∑N
i=1 xi Ri = r̄ s.t. R0 X = r̄
s.t. ∑N
i=1 xi = 1
s.t. U0 X = 1
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

E FFICIENT F RONTIER
×10 -3 risk-expected return
20
coke
wen
15 mnst

Return E[R i ]
10 pep

yum
ko
5 mcd

0
soda

-5
0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018
Variance σ2i

Figure: Efficient frontier of the junk food portfolio

I We explore from the minimum return (offered by ’soda’) to


highest return (offered by coke), for each value on this
interval, we compute the minimum variance portfolio.
I Blue line: efficient frontier;
I Red circle: minimum variance portfolio.
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

E FFICIENT F RONTIER

I minimum variance portfolio (the red circle)?


I This is the global minimum on the efficiency curve which
can be computed though:
0
min Xmin VXmin
Xmin
s.t. U0 Xmin = 1

I Or directly by:
V −1 U
Xmin =
U 0 V −1 U
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

E FFICIENT F RONTIER
×10 -3 risk-expected return
20
coke
wen
15 mnst

Return E[R i ]
10 pep

yum
ko
5 mcd

0
soda

-5
0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018
Variance σ2i

I Portfolios below the red circle are not suitable (low return,
high volatility).
I Portfolios above the red circle are suitable, however there
is no uniqueness and requires another criterion to select
best portfolios using:
I utility function;
I riskless asset.
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

E FFICIENT F RONTIER
I With MATLAB, it is possible to compute efficient
portfolios with many assets.
I Assuming that I want to invest in France, taking all
available data from yahoo for France (164 firms).
risk-expected return
0.14 BOL.PA

0.12

0.1

0.08

KAZI.PA
Return E[R i ]

0.06

0.04 ALOCT.PA
MLWTT.PA
IPH.PA
ERF.PA
ITL.PA
FR.PA
LTE.PA
DPAM.PA
BELI.PA
POM.PA
RCF.PA
OPN.PA
ALVDM.PA
DVT.PA
0.02 SDG.PA
TFF.PA
IGE.PA
ALT.PA
STAL.PA
FII.PA
PERR.PA
FBEL.PA
SAF.PA
CAP.PA
SWP.PA
MLVIS.PA
ALVDI.PA
NXI.PA
KOF.PA
ALKEY.PA
ITE.PA
ATO.PA
ALU.PA
ACA.PA
VIE.PA
KN.PA
SESL.PA
ALTA.PA
CS.PA
XIL.PA
JCQ.PA
SOP.PA
DSY.PA
MLCVG.PA
AIR.PA
TCH.PA
HXL.PA
TES.PA
HAV.PA
LR.PA
STM.PA
GLE.PA
GFC.PA
BIM.PA
ML.PA
OR.PA
CNP.PA
PAT.PA
DG.PA
MF.PA
KEY.PA
TAM.PA
BNP.PA
IDIP.PA
MLOLM.PA
SCR.PA
EIFF.PA
PGP.PA SO.PA
SW.PA
LI.PA
VETO.PA
EI.PA
ZC.PA
KER.PA
VIV.PA
EN.PA
NK.PA
CDI.PA
MLHIN.PA
RF.PA
ORIA.PA
PUB.PA
ABCA.PA
AC.PA
GTO.PA
SU.PA
SAN.PA
BVI.PA
CA.PAMLZAM.PA
NRG.PA
TFI.PA
AM.PA
RI.PA
DEC.PA
MC.PA
SGO.PA
SX.PA
SDT.PA
BN.PA
VCT.PA
UG.PA
FP.PA
AI.PA
MMB.PA
VIRP.PA
SABE.PA
ICAD.PA
MLTDS.PA
0 NEX.PA
MTU.PA
RCO.PA
RXL.PA
AF.PA
QUA.PA
VRAP.PA
GRVO.PA
MLDIG.PA
CGM.PA
TEC.PA
ULDV.PA
MLPVG.PA MLGRD.PA
COX.PA
ALO.PA
FCMC.PA
QTE.PA
CRBT.PA
EDF.PA
ORAP.PA
SIPH.PA
STAGR.PA
ALWED.PA
NEO.PA
OLG.PA
VLTSA.PA
ALWEB.PA
EDL.PA
DNX.PA
ES.PA MLVOP.PA
VALE3.PA
ALVER.PA
MLKRI.PA
MLMGL.PA
MLJSA.PA
-0.02 ALVMG.PA
DPT.PA
CV.PA
SOI.PA ALQGC.PA MLVES.PA
VK.PA ALOSP.PA
-0.04
MLFER.PA
CGG.PA
-0.06 VRNL.PA
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7
Variance σ2i

Figure:
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

C ONTENTS

Introduction

A simple two-asset model

Efficient Frontier

Optimal portfolios
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

O PTIMAL PORTFOLIOS
I As I mentioned, it is possible to obtain an unique portfolio
among all possible available portfolio combinaisons.
I Here, we look for an ’optimal’ portfolio maximizing the
utility function of the investor:
φ 2
U (σX , E [RX ]) = E [RX ] − σ
2 X
φ
= R0 X − X0 VX
2
where φ is the risk aversion coefficient (remember the
Arrow-Pratt risk aversion coefficient).
Via Sums: Via Matrices:
φ 0
max U (σX , E [RX ])
x1 ,x2 ,...xn
max R0 X − X VX
X 2
s.t. ∑N
i=1 xi = 1 s.t. U0 X = 1
Introduction A simple two-asset model Efficient Frontier Optimal portfolios

O PTIMAL PORTFOLIOS
I It is then possible to obtain the indifference curve, its
unique intersection with the efficiency curve gives the
optimal portfolio.
risk-expected return
0.035

0.03

0.025

0.02
Return E[R i ]

wen coke

0.015 mnst

0.01 pep

yum
ko
mcd
0.005

0
soda
-0.005
0.02 0.04 0.06 0.08 0.1 0.12 0.14
Standard Deviation σi

Figure: Efficiency curve (blue) and indifference curve (red)


Introduction A simple two-asset model Efficient Frontier Optimal portfolios

O PTIMAL PORTFOLIOS
I It also works with my 160-asset portfolio of french firms.

risk-expected return
0.8

0.7

0.6

0.5
Return E[R i ]

0.4

0.3

0.2
BOL.PA
0.1
KAZI.PA
ERF.PAALOCT.PA
FR.PAITL.PA
LTE.PA
DPAM.PA
BELI.PA
POM.PA
RCF.PA
OPN.PA
ALVDM.PA
DVT.PA
SDG.PA
TFF.PA MLWTT.PA
IPH.PA
IGE.PA
ALT.PA
STAL.PA
PERR.PA
FII.PA
FBEL.PA
SAF.PA
CAP.PA
SWP.PA
SCR.PA
PGP.PA
SW.PA
EIFF.PA
EI.PAZC.PA
VETO.PA
LI.PA
KER.PA
VIV.PA
NK.PA
EN.PA
CDI.PA
ABCA.PA
CA.PA MLVIS.PA
ALVDI.PA
XIL.PA
ITE.PA
NXI.PA
ALKEY.PA
KOF.PA
ACA.PA
ATO.PA
CS.PAALU.PA
KN.PA
ALTA.PA
JCQ.PA
SESL.PA
SOP.PA
VIE.PA
AIR.PA
MLCVG.PA
DSY.PATCH.PA
TES.PAHXL.PA
STM.PA
GLE.PA
HAV.PA
LR.PA
CNP.PA
ML.PA
BIM.PA
OR.PA
PAT.PA
GFC.PATAM.PA
BNP.PA
DG.PA
IDIP.PAKEY.PA
MF.PA
MLOLM.PA
MLHIN.PA
RF.PASX.PA
ORIA.PA
PUB.PA
AC.PA
SU.PA
GTO.PA
SAN.PA
AM.PA
BVI.PA
TFI.PA
RI.PA
NRG.PA
MC.PA
SGO.PA
DEC.PA
BN.PA
VCT.PA
AI.PASDT.PA
UG.PA
MMB.PA
FP.PAVIRP.PA
SABE.PA
MLTDS.PA
ICAD.PA
NEX.PA
MTU.PA
RXL.PA
RCO.PA
AF.PA
GRVO.PA
VRAP.PA
CGM.PA SO.PA
MLZAM.PA
TEC.PA
0 MLPVG.PA ULDV.PA
ALO.PA
FCMC.PA
CRBT.PAQUA.PA
EDF.PA
ORAP.PA
SIPH.PA
STAGR.PA
ALWED.PA
NEO.PA
ES.PA MLDIG.PA
QTE.PA
OLG.PA
VLTSA.PA
ALWEB.PA
DNX.PA
EDL.PAMLKRI.PA
VALE3.PA COX.PA
MLGRD.PA
ALVER.PA
MLMGL.PA
MLJSA.PA
ALVMG.PA MLVOP.PA
DPT.PA
CV.PA SOI.PA
VK.PA ALQGC.PA
ALOSP.PA MLVES.PA
MLFER.PA
VRNL.PA CGG.PA
-0.1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
Standard Deviation σi

Figure: Efficiency curve (blue) and indifference curve (red)


Introduction A simple two-asset model Efficient Frontier Optimal portfolios

O PTIMAL PORTFOLIOS

I Challenge:
Use Run_PortfolioOptimal.m and select a 10 asset portfolio
providing the highest level of utility.

Vous aimerez peut-être aussi