• No results found

Portfolio Optimization

N/A
N/A
Protected

Academic year: 2021

Share "Portfolio Optimization"

Copied!
41
0
0

Loading.... (view fulltext now)

Full text

(1)

Portfolio Optimization

Jaehyun Park Ahmed Bou-Rabee Stephen Boyd EE103

Stanford University

(2)

Outline

Single asset investment

Portfolio investment

Portfolio optimization

(3)

Return of an asset over one period

assetcan be stock, bond, real estate, commodity, . . . ◮ invest in a single asset over period (quarter, week, day, . . . ) ◮ buy qshares at pricep(at beginning of investment period) ◮ h=pq is dollar value of holdings

◮ sell qshares at new pricep+ (at end of period) ◮ profit isqp+−qp=q(p+−p) =p + −p p h ◮ definereturnr= (p+−p)/p ◮ return= profit investment ◮ profit=rh

◮ example: invest h= $1000 over period,r= +0.03: profit= $30

(4)

Short positions

◮ basic idea: holdingshand share quantitiesqarenegative ◮ called shortingor taking a short position onthe asset

(horqpositive is called along position)

◮ how it works:

– you borrowqshares at the beginning of the period and sell them at pricep

– at the end of the period, you have to buyqshares at pricep+to

return them to the lender

◮ all formulas still hold,e.g., profit=rh

◮ example: invest h=−$1000,r=−0.05: profit= +$50 ◮ no limit to how much you can lose when you short assets ◮ normal people (and mutual funds) don’t do this; hedge funds do

(5)

Return of an asset over multiple periods

◮ invest over periodst= 1,2, . . . , T

(quarters, trading days, minutes, seconds . . . )

◮ ptis price at the beginning of periodt ◮ return over periodt isrt= pt+1−pt

pt

◮ invest dollar amount ht in periodt, or share number qt=ht/pt ◮ profit over period tisrtht

◮ total profit isPT t=1rtht

◮ per period profit is 1 T

PT t=1rtht

(6)

Examples

stock prices of BP (BP) and Coca-Cola (KO) for last 10 years

0 500 1000 1500 2000 2500 0 10 20 30 40 50 60 70 Days Prices KO BP

(7)

Examples

price changes over a few weeks

16000 1605 1610 1615 1620 1625 1630 1635 1640 1645 1650 10 20 30 40 50 60 70 Days Prices KO BP

(8)

Examples

returns of the assets over the same period

1600 1605 1610 1615 1620 1625 1630 1635 1640 1645 1650 −0.2 −0.15 −0.1 −0.05 0 0.05 0.1 0.15 0.2 Days Returns KO BP

(9)

Buy and hold

◮ a very simple choice of ht ◮ qt=qfor allt= 1,2, . . . , T

– buyqshares at the beginning of period 1 – sellqshares at the end of periodT ◮ hence ht=ptq ◮ profit is T X t=1 rtht= T X t=1 pt +1−pt pt (ptq) =q(pT+1−p1)

◮ same as combining periods1, . . . , T into a single period

(10)

Cumulative value plot

plot ofht=ptqversust (h1= $10,000 by tradition)

0 500 1000 1500 2000 2500 0.5 1 1.5 2 2.5x 10 4 Days Value KO MSFT

(11)

Constant value

◮ another simple choice ofht: ht=h, t= 1, . . . , T ◮ number of sharesqt=h/pt(which varies witht)

◮ requires buying or selling shares every period to keep value constant ◮ profit isPT

t=1rth

◮ per period profit is(1/T)PT

t=1rth=avg(rt)h(in $)

◮ mean returnis avg(rt)(fractional; often expressed in %) ◮ profit standard deviation isstd(rth) =std(rt)h(in $) ◮ riskisstd(rt)(fractional)

◮ want per period profit high, risk low

(12)

Annualizing return and risk

◮ mean return and risk are often expressed in annualized form

(i.e., per year)

◮ if there are P trading periods per year – annualized return=Pavg(rt)

– annualized risk=√

Pstd(rt)

(the squareroot in risk annualization comes from the assumption that the fluctuations in return around the mean are independent)

◮ if tdenotes trading days, with 250 trading days in a year – annualized return= 250avg(rt)

– annualized risk=√

250std(rt)

(13)

Risk-return plot

annualized risk versus annualized return of various assets up (high return) and left (low risk) is good

0 10 20 30 40 50 60 0 5 10 15 20 25 BRCM GS MMM SBUX USDOLLAR Annualized Risk Annualized Return

(14)

Outline

Single asset investment

Portfolio investment

Portfolio optimization

(15)

Portfolio of assets

◮ nassets

◮ n-vectorptis prices of assets in periodt,t= 1,2, . . . , T ◮ n-vectorhtis dollar value holdings of the assets ◮ total portfolio value: Vt=1Tht

◮ n-vectorqtis the number of shares: (qt)i= (ht)i/(pt)i ◮ wt= (1/1Tht)ht givesportfolio weightsorallocation

(fraction of portfolio, defined only for1Tht>0)

(16)

Examples

◮ (h3)5=−1000means you short asset 5 in investment period 3 by

$1,000

◮ (w2)4= 0.20means 20% of total portfolio value in period 2 is

invested in asset 4

◮ wt= (1/n, . . . ,1/n),t= 1, . . . , T means total portfolio value is

equally allocated across assets in all investment periods

◮ 1Tht= 0 means total short positions=total long positions

(17)

Buy and hold portfolio

◮ same idea as single asset case ◮ (n-vector)qt=qfor all t= 1, . . . , T

◮ holdings given by (ht)i= (pt)iqi,i= 1, . . . , n ◮ profit is T X t=1 rT tht= T X t=1 n X i=1 (rt)i (pt+1)i−(pt)i (pt)i ((pt)iqi) =qT(pT +1−p1) Portfolio investment 17

(18)

Constant value portfolio

◮ simple choice ofht: ht=h,t= 1, . . . , T

◮ requires rebalancing(buying and selling) shares to maintain

(ht)i=hi every period ◮ profit isPT

t=1r

T th

◮ per period profit is(1/T)PT t=1r

T

th(in $) ◮ mean returnis avg(rT

th)/1

Th(fractional; often expressed in %) ◮ profit standard deviation isstd(rT

th)(in $) ◮ riskisstd(rT

th)/1Th(fractional)

(19)

Risk-return plot for constant value portfolio

0 10 20 30 40 50 60 0 5 10 15 20 25 uniform good bad Annualized Risk Annualized Return Portfolio investment 19

(20)

Constant weight portfolio with re-investment

◮ fix weight vector w

◮ given initial total investment V1, seth1=V1w ◮ V2=V1+rT

1h1

◮ seth2=V2w,i.e., re-invest total portfolio value using allocationw ◮ and so on . . . ◮ VT =V1(1 +rT 1w)(1 +r T 2w)· · ·(1 +r T Tw) ◮ Vt≤0 (or some small value like0.1V

1) called going bustorruin

(21)

Cumulative value plot

uniform portfolio between two assets, withh1= $10,000 (by tradition)

0 500 1000 1500 2000 2500 0 0.5 1 1.5 2 2.5 3x 10 4 Days Value uniform portfolio individual assets Portfolio investment 21

(22)

Cumulative value plot

portfolio with large short positions (heavily leveraged) goingbust

(dropping to 10% of starting value)

0 500 1000 1500 2000 2500 0 0.5 1 1.5 2 2.5 3x 10 4 Days Value leveraged portfolio individual assets Portfolio investment 22

(23)

Comparison: Re-investment or not

◮ constant value portfolio (without re-investment) gives total profit PT

t=1r

T th

◮ constant weight portfolio (with re-investment) gives total profit

VT −V1= ((1 +rTTw)· · ·(1 +r

T

1w)−1)V1

◮ for|rT

tw|all small (say,≤0.01)

(1 +rTTw)· · ·(1 +r T 1w)≈1 + T X t=1 rTtw so VT −V1≈P T t=1r T twV1

◮ profit with constant value h≈profit with constant weight w= (1/1Th)hand initial investmenth

(24)

Comparison: Re-investment or not

0 500 1000 1500 2000 2500 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5x 10 4 Days Value no reinvestment reinvestment Portfolio investment 24

(25)

Outline

Single asset investment

Portfolio investment

Portfolio optimization

(26)

Portfolio optimization

◮ how should we choose a portfolio value vectorh, or a portfolio

weight vector w, over some investment period?

◮ more generally, these vectors could change with time, as our

information or goals changes

◮ when we choosehorw, we know past returns (‘realized returns’)

but (of course) not future ones

◮ in all cases, we want high (mean) return, low risk

(27)

Returns matrix

◮ definereturns matrix

R=    rT 1 .. . rT T   

◮ jth column is assetj return time series ◮ Rhis profit time series

1TRhis total profit

◮ avg(Rh) = (1/T)1TRhis per period profit

◮ std(Rh)is per period risk

◮ goal: choosehthat makesavg(Rh)high,std(Rh)low

(28)

Portfolio optimization via least squares on past returns

minimize std(Rh)2

= (1/T)kRh−ρB1k2

subject to 1Th=B, avg(Rh) =ρB ◮ his holdings vector to be found

◮ R is the returns matrix forpast returns ◮ Rhis the (past) profit time series ◮ require mean (past) profitρB

◮ minimize the standard deviation of (past) profit

◮ we are really asking what would have beenthe best constant

allocation, had we known future returns

(29)

Constant weight portfolio optimization

minimize std(Rw)2= (1/T)kRwρ1k2

subject to 1Tw= 1, avg(Rw) =ρ ◮ very similar to constant weight optimization

(in fact the two solutions are the same, except for scaling)

◮ wis weight allocation vector to be found ◮ Rw is the (past) return time series ◮ require mean (past) return ρ

◮ minimize the standard deviation of (past) return

(30)

Examples

◮ optimalwfor annual return 1%(last asset is risk-less with1%

return)

w= (0.0000,0.0000,0.0000, . . . ,0.0000,0.0000,1.0000)

◮ optimalwfor annual return 13%

w= (0.0250,−0.0715,−0.0454, . . . ,−0.0351,0.0633,0.5595)

◮ optimalwfor annual return 25%

w= (0.0500,−0.1430,−0.0907, . . . ,−0.0703,0.1265,0.1191)

◮ asking for higher annual return yields

– more invested in risky, but high return assets – larger short positions (‘leveraging’)

(31)

Cumulative value plots for optimal portfolios

cumulative value plot for optimal portfolios and some individual assets

0 500 1000 1500 2000 2500

104

105

Days

Value

optimal portfolio, rho=0.20/250 optimal portfolio, rho=0.25/250 individual assets

(32)

Optimal risk-return curve

red curve obtained by solving problem for various values ofρ

0 10 20 30 40 50 60 0 5 10 15 20 25 Annualized Risk Annualized Return Portfolio optimization 32

(33)

Optimal portfolios

◮ perform significantly better than individual assets ◮ risk-return curve forms a straight line

– one end of the line is the risk-free asset

two-fund theorem: optimal portfoliowis an affine function inρ   w ν1 ν2  =   RTR 1 RT1 1T 0 0 1TR 0 0   −1  RT1 1 ρT   Portfolio optimization 33

(34)

The big assumption

◮ now we make the big assumption (BA):

future returns will look something like past ones – you are warned this is false, every time you invest – it is often reasonably true

– in periods of ‘market shift’ it’s much less true

◮ if BA holds (even approximately), then a good weight vector for past

(realized) returns should be good for future (unknown) returns

◮ for example:

– choosewbased on last 2 years of returns – then usewfor next 6 months

(35)

Optimal risk-return curve

◮ trained on 900 days (red), tested on the next 200 days (blue) ◮ here BA held reasonably well

0 2 4 6 8 10 12 14 16 0 5 10 15 20 25 Annualized Risk Annualized Return Train Test Portfolio optimization 35

(36)

Optimal risk-return curve

◮ corresponding train and test periods

0 500 1000 1500 2000 2500 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5x 10 4 Train Test Portfolio optimization 36

(37)

Optimal risk-return curve

◮ and here BA didn’t hold so well ◮ (can you guess when this was?)

0 2 4 6 8 10 12 14 16 −20 −15 −10 −5 0 5 10 15 20 25 Annualized Risk Annualized Return Train Test Portfolio optimization 37

(38)

Optimal risk-return curve

◮ corresponding train and test periods

0 500 1000 1500 2000 2500 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5x 10 4 Train Test Portfolio optimization 38

(39)

Rolling portfolio optimization

for each periodt, find weightwtusingLpast returns

rt1, . . . , rtL

variations:

◮ updateweveryK periods (say, monthly or quarterly) ◮ add cost termκkwt−wt

−1k 2

to objective to discourage turnover, reduce transaction cost

◮ add logic to detect when the future is likely to not look like the past ◮ add ‘signals’ that predict future returns of assets

(. . . and pretty soon you have a quantitative hedge fund)

(40)

Rolling portfolio optimization example

◮ cumulative value plot for different target returns ◮ updatewdaily, usingL= 400past returns

1600 1700 1800 1900 2000 2100 2200 2300 2400 2500 0.95 1 1.05 1.1 1.15 1.2 1.25 1.3x 10 4 Days Value rho=0.05/250 rho=0.1/250 rho=0.15/250 Portfolio optimization 40

(41)

Rolling portfolio optimization example

◮ same as previous example, but updatewevery quarter (60periods)

1600 1700 1800 1900 2000 2100 2200 2300 2400 2500 0.95 1 1.05 1.1 1.15 1.2 1.25 1.3x 10 4 Days Value rho=0.05/250 rho=0.1/250 rho=0.15/250 Portfolio optimization 41

References

Related documents