Professional Documents
Culture Documents
Rapport
Rapport
Rapport
Portfolio Rebalancing
Algorithms
I would also like to thank my supervisor Mattias Jonsson of the Royal Institute
of Technology for help on understanding some of the content of the sources used
as well as helping me to choose material to present in my thesis.
1
Abstract
This thesis aims at implementing and evaluating four distinct algorithms (Uni-
versal Portfolio, Exponentiated Gradient, Anticor and Constant Proportion
Portfolio Insurance) for automated rebalancing of fixed-asset portfolios based
on the past performance of the individual assets included in the portfolio. The
algorithms are implemented according to the articles presenting them, and I
devise improvements to the algorithms.
I have shown that these algorithms are all able to yield higher returns than
more naïve investment strategies such as allocating equal amounts to all assets
included in the portfolio. While all algorithms but CPPI can handle portfolios
of any number of assets, I have shown that in reality, portfolios of two assets are
preferable to maximize return. Finally, especially EG and Anticor are able to
provide quite impressive returns under certain conditions, even after subtracting
trading costs.
Contents
1 Introduction 2
5 Tuning of parameters 32
6 Conclusions 34
1
Chapter 1
Introduction
Black and Jones [2] and Perold and Sharpe [13] introduced the Constant Propor-
tion Portfolio Insurance, or CPPI for short, as a means of providing a guaranteed
riskless minimum return while allowing investment in a risky asset capable of
providing excess returns. This algorithm is conceptually limited compared to
the other algorithms examined, since CPPI allows only two-asset portfolios. It
was extended by Bertrand and Prigent [1] and Boulier and Kanniganti [5].
Thomas Cover [6] introduced the Universal Portfolio algorithm, a rather com-
plicated algorithm to implement, but which guarantees an asymptotic return
better than any individual asset in the portfolio. This algorithm was elaborated
further in several articles co-written by Thomas Cover [7], [8], [12], [10], and
also by Kalai and Vempala [11] aiming to reduce implementation complexity.
Blum and Kalai [3] provided some further extensions of the Universal Portfolio.
The main idea of the Universal Portfolio algorithm is that the algorithm tries
to learn patterns for the compositions of the best portfolios in the past and to
use this information to decide the composition of future portfolios.
2
it does not increase the positions in the most recent winners, but rather in-
creases the positions in the most recent losers if they are found to be negatively
correlated with the recent winners.
The purpose of this Master’s Thesis is to evaluate the above mentioned methods
for automatically rebalancing portfolios for which the asset selection decision has
already been made, using purely mathematical models on the time series of past
performance of the financial assets included in the portfolio. This thesis will ex-
amine the theoretical background and then evaluate certain algorithms created
for the purpose of automatically generating portfolio updates. The evaluation
will include identification of desired characteristics of the asset price time series
for the different algorithms, as well as attempts to fine-tune the values of the
algorithm parameters for maximum performance.
The concept of transaction costs will also be included, and the algorithms will
be judged based on their ability to yield higher returns than simple, naïve in-
vestment strategies after correcting for transaction costs.
3
Chapter 2
and si,j is the price of asset j at time i. Thus, xij is the factor by which the price
of asset j increases at time from time i − 1 to i. Let bi P = (bi1 , bi2 , . . . , bim )T be
the weight vector for which it by definition holds that j bij = 1. Within this
thesis the additional restriction bij ≥ 0 will be enforced to ensure fair comparison
between the algorithms that by formulation cannot have negative weights and
the algorithms that theoretically allows this. Here, bij denotes the proportion
of total wealth invested in asset j at time i. Then, after one time period has
passed, the wealth obtained is S1 = b1 x11 + b2 x12 = bT 1 x1 , and at the end of the
investment horizon the wealth is given by the following expression, also known
as the total return factor :
Yn
Sn = bT
i xi (2.1)
i=1
The best constant rebalanced portfolio (BCRP) is the best possible portfolio
within the CRP class. At the end of the investment period, it provides a wealth
4
of
n
Y
Sn∗ = max b T xi .
b
i=1
The construction of this portfolio requires knowledge of actual stock price out-
comes and can thus only be determined in hindsight. This portfolio will asymp-
totically exceed the best individual stock as well as common indices, usually by
an exponential factor.
The common goal for all algorithms examined in this thesis is to maximize
Sn , the total wealth obtained over the entire investment period, using different
means of learning from the past performance of individual assets, while impos-
ing certain restrictions on the possible reallocations, such as allowing only a
part of the available wealth to be invested in a risky asset as is the case for the
CPPI algorithm.
5
Here, b1 + b2 = 1 and 0 ≤ b1 , b2 ≤ 1, meaning that the domain is the one-
dimensional simplex ∆1 .
Using α1 = α2 = 1 gives
Γ (1 + 1) Γ (2)
f (b) = 2 b11−1 b21−1 = 0 0
2 b1 b2 = 1,
Γ (1) Γ (1)
i.e. the bivariate uniform distribution over a unit sized domain (since Γ(2) =
1 · Γ(1) = 1 · 1 = 1). Using α1 = α2 = 1/2 gives
Next, a derivation of a closed form solution of the obtained total return factor,
Ŝn , will be performed, since it is contained in the expression for the Universal
Portfolio weights (2.2).
In order to explicitly calculate these weights and the total return in the two
asset portfolio case, it is necessary to find a closed form solution to the integrals
contained in the expression for the weights (2.2). Firstly, as a step to determine
Ŝn , note that the total return factor for a CRP after n rebalancings is
n
Y n
Y X n
Y
Sn (xn , b) = b T xi = (b1 xi1 + b2 xi2 ) = bji xiji =
i=1 i=1 J∈{1,2}n i=1
n
X n
X Y
bl1 b2n−l xiji ,
l=0 J∈Tn (l) i=1
where Tn (l) is the set of all sequences J ∈ {1, 2}n with l 1’s and (n − l) 2’s.
Now, let
X Y n
Xn (l) = xiji , (2.3)
J∈Tn (l) i=1
giving
n
X
Sn (xn , b) = bl1 b2n−l Xn (l).
l=0
In order to calculate the integrals in the expression for the portfolio weights (2.2)
and the realized total return factor of the universal portfolio, this is integrated
over the probability measure assumed for the weights.
n
Z X n
X Z
n
Ŝn (x ) = bl1 b2n−l Xn (l) dµ (b) = Xn (l) bl1 b2n−l dµ (b) .
l=0 l=0
6
the above can be written
n
X
Ŝn (xn ) = Xn (l)Cn (l).
l=0
Using the above, it is possible to derive a closed form expression for the Universal
Portfolio weights and realized total return factor at time n. Since
R Qn−1 T R Qn−1 T
i=1 b xi b dµ (b) 1 b1 i=1 b xi dµ (b)
b̂n = = R Qn−1 T ,
Ŝn−1 (xn−1 ) Ŝn−1 (xn−1 ) b2 i=1 b xi dµ (b)
the weights are calculated through a procedure very similar to the Universal
Portfolio return. It is readily seen that
Pn−1
Xn−1 (l) bl+1 bn−1−l
R
1 l=0 1 2 dµ (b)
b̂n = P n−1 R l n−l =
Ŝn−1 (xn−1 ) l=0 Xn−1 (l) b1 b2 dµ (b)
Pn−1
1 l=0 Xn−1 (l)Cn (l + 1)
= Pn−1 . (2.5)
Ŝn−1 (xn−1 ) l=0 Xn−1 (l)Cn (l)
the type of integrals arising above (2.4) have a closed form solution that can
easily be found. Note that
Z 1
1
Z
l n−l
Cn (l) = b1 b2 dµ (b) = bl1 b2n−l bα
1
1 −1 α2 −1
b2 db1 ,
0 B(α 1 , α 2 )
where b2 = 1 − b1 .
Now, taking the constant outside the integral, this can be written as
Z 1
1
Cn (l) = bl+α1 −1 bn−l+α 2 −1
db1 .
B(α1 , α2 ) 0 1 2
Noting that the integrand is basically a Dirichlet density function, missing only a
constant factor consisting of suitable gamma functions, identify its parameters.
Call the identified parameters γ1 and γ2 . These are related to α1 and α2 as
follows:
γ1 = l + α 1 ,
γ2 = n − l + α 2 .
Now, since by the general definition of a probability measure
Z
dµ (b) = 1,
B(γ1 , γ2 ) 1 1
Z
Cn (l) = bγ1 −1 bγ22 −1 db1 =
B(α1 , α2 ) 0 B(γ1 , γ2 ) 1
7
1
B(γ1 , γ2 ) B(γ1 , γ2 )
Z
= dµ (b) = .
B(α1 , α2 ) 0 B(α1 , α2 )
Now, substitute back the expressions for γ1 and γ2 to obtain
B(l + α1 , n − l + α2 ) 1 Γ (l + α1 ) Γ (n − l + α2 )
Cn (l) = = .
B(α1 , α2 ) B(α1 , α2 ) Γ (n + α1 + α2 )
R
Note (using e.g. (2.4)) that C0 (0) = dµ (b) = 1 regardless of the choices of α1
and α2 . Since Γ(N + 1) = N Γ(N ), it is now possible to give two recursions for
Cn (l) depending on the values of α1 and α2 .
l + α1 − 1
Cn (l) = Cn−1 (l − 1)
n + α1 + α2 − 1
n − l + α2 − 1
Cn (l) = Cn−1 (l)
n + α1 + α2 − 1
For Xn (l) (2.3), the following recursion applies when 1 ≤ l ≤ n − 1:
giving the following expression for the Universal Portfolio realized total return
factor after n rebalancings:
n
X
Ŝn (xn ) = Qn (l).
l=0
Furthermore, even the quantities Cn (l + 1)Xn−1 (l) and Cn (l)Xn−1 (l), occuring
in the expression (2.5) for the Universal Portfolio weights, can be expressed
using the Qn (l) quantities, after first using the separate Cn (l) recursions:
l + 1 + α1 − 1
Cn (l + 1)Xn−1 (l) = Cn−1 (l + 1 − 1)Xn−1 (l) =
n + α1 + α2 − 1
l + α1
= Qn−1 (l),
n + α1 + α2 − 1
n − l + α2 − 1
Cn (l)Xn−1 (l) = Cn−1 (l)Xn−1 (l) =
n + α1 + α2 − 1
n − l + α2 − 1
= Qn−1 (l).
n + α1 + α2 − 1
Inserting into (2.5), this gives the simplified Universal Portfolio weight expres-
sion " P #
n−1 l+α1
1 l=0 n+α +α −1 Qn−1 (l)
b̂n = Pn−1 1
Pn−1 n−l+α2 −1 2
.
l=0 Qn−1 (l) l=0 n+α1 +α2 −1 Qn−1 (l)
8
Using the fact that C0 (0) = X0 (0) = 1 gives Q0 (0) = 1, and the recursion
for Qn (l) is given by combining the Cn (l) and Xn (l) recursions. This gives for
Qn (l)
l + α1 − 1 n − l + α2 − 1
Qn (l) = xn1 Qn−1 (l − 1) + xn2 Qn−1 (l)
n + α1 + α2 − 1 n + α1 + α2 − 1
for 1 ≤ l ≤ n − 1, and the corresponding endpoint recursions are
n + α2 − 1
Qn (0) = xn2 Qn−1 (0),
n + α1 + α2 − 1
n + α1 − 1
Qn (n) = xn1 Qn−1 (n − 1),
n + α1 + α2 − 1
completely specifying the Universal Portfolio algorithm for general values of α 1
and α2 .
From this point, the total return factor is easily calculated according to (2.1).
The theoretical bounds on the Universal Portfolio guarantees that if Sn∗ denotes
BCRP performance and Ŝn denotes Universal Portfolio performance, then
∗
1 Sn
lim ln =0
n→∞ n Ŝn
which means that asymptotically in time, the Universal Portfolio achieves the
same exponential growth rate as the BCRP.
9
Only a modified version with significantly increased computational complex-
ity achieves the same bounds as Universal Portfolio. According to its inventors
however, Exponentiated Gradient provides better real life performance, quite
often coming very close to BCRP performance.
Let xi and bi denote asset performance and portfolio weights as before. Fur-
thermore, let η denote the learning rate of the algorithm. This parameter will
be held constant, although this is not strictly a requirement. A higher value
means faster reallocation reaction to relative overperformance of a particular as-
set compared to other assets in the portfolio. For the Exponentiated Gradient
(EG) algorithm, the future portfolio weights are determined according to
ηx
bi,j exp bTijx
i
bi+1,j = P .
m ηxik
k=1 b i,k exp T
b x
i
As can be seen from the above formula, the weights used by this algorithm can
easily be calculated in vector form, facilitating implementation in e.g. Matlab
and enabling efficient testing of performance of portfolios consisting of more than
two assets. The calculation of weights and performance of the EG algorithm
is straightforward. The actual performance of portfolios consisting of more
than two assets needs to be evaluated to judge whether the complexity-imposed
restriction on Universal Portfolio significantly limits its efficiency. If EG proves
to provide as good or better returns for two-asset portfolios as for portfolios
consisting of more than two assets, then, heuristically, Universal Portfolio could
be assumed to follow this behavior, since it is basically similar in structure to
EG.
2.4 Anticor
The Anticor algorithm was introduced by Borodin et al [4] and is based on the
theory of mean-reverting asset prices. It is parameterized by the length of the
window, which is a time period over which the portfolio assets’ correlations are
determined and used to calculate the weights for the following subperiod. Its
name stems from the fact that it assumes anticorrelated assets (i.e. assets with
negative correlation).
Let w be the integer length of the window, measured in number of trading times.
Define the growth rate of an asset over the length of the window as the product
of relative prices during this window. For Anticor to transfer investments from
asset i to asset j, two conditions must be fulfilled.
• Asset i must have had a higher growth rate than asset j over the most
recent window
• Asset i over the second most recent window must be positively correlated
with asset j over the most recent window.
Under the assumption of mean-reverting and equally well performing assets over
longer time periods, these two conditions together indicate that asset j should
outperform asset i over the next window.
10
For a more formal description of the Anticor algorithm, define
T T
LX1i = [log(xi−2w+1 ), . . . , log(xi−w )] , LX2i = [log(xi−w+1 ), . . . , log(xi )]
where log(xk ) denotes [log(xk (1)), . . . , log(xk (m))]T and m is the number of as-
sets included in the portfolio. Consequently, LX1i and LX2i are w × m matrices
containing log-relative prices of assets over the second most recent and most re-
cent window respectively. Let the jth column of LXli be denoted LXli (j).
Furthermore, let µl = [µl (1), . . . , µl (m)] and σl = [σl (1), . . . , σl (m)] be the vec-
tors of averages and standard deviations of the columns of LXli respectively.
The cross-correlation matrix is then given by
1
Mcov,i (j, k) = (LX1i (j) − µ1 (j))T (LX2i (k) − µ2 (k))
w−1
(
Mcov,i (j,k)
σ1 (j)σ2 (k) if σ1 (j), σ2 (k) 6= 0
Mcor,i (j, k) =
0 otherwise.
Now, Mcor (j, k) measures the correlation between log-relative prices of asset j
over the first window with those of asset k over the second window. If σ1 (j)
or σ2 (k) is zero over some window, then there is constant growth of the corres-
ponding asset over that window. In this case, no transfer is made between the
two assets in the portfolio.
Next, the claim matrix is calculated, claimi (j, k) denoting the extent to which
the algorithm wants to transfer wealth from asset j to asset k.
Mcor,i (j, k) + Ai (j) + Ai (k) if µ2 (j) > µ2 (k) and Mcor,i (j, k) > 0
claimi (j, k) =
0 otherwise.
Intuitively, Mcor,i (j, k) > 0 could be interpreted to mean that assets j and k
are correlated in consecutive windows and Mcor,i (h, h) < 0 predicts negative
autocorrelation of asset h in consecutive windows.
The actual transfers between assets are calculated through the expression
(
bi (j) Pclaim i (j,k)
P
if k claimi (j, k) 6= 0
transferi (j, k) = k claimi (j,k)
0 otherwise.
Finally, the portfolio weights at time i + 1 are given relative to the weights at
time i through the following relation:
X
bi+1 = bi + [transferi (k, j) − transferi (j, k)] .
k6=j
11
2.5 Constant Proportion Portfolio Insurance
Introduced by Black and Jones [2] and Perold and Sharpe [13] and later de-
scribed by Bertrand and Prigent [1], the Constant Proportion Portfolio Insur-
ance (CPPI) algorithm is commonly used for insurance purposes. It combines
one risky asset with a risk free asset that increases in value at an exponential
risk free rate r.
Ei = mCi ,
where m is a constant called the multiple. Letting m > 1 makes the payoff func-
tion convex, but simultaneously, the floor is no longer a guaranteed absolute
minimum at all times. If on the other hand m ≤ 1, it is clear that the exposure
is at no time larger than the total portfolio wealth less the value of the floor
since the exposure in this case is at the most equal to the cushion.
In its standard form, assuming that the risky asset behaves like a geometric
Brownian motion, the CPPI algorithm wealth at the end of the investment
period can be expressed in closed form. The solution is
m
−km ST
VT = V 0 + C 0 e ,
S0
where
mσ 2
km = (m − 1) +r
2
The CPPI algorithm can be extended in several ways, as presented by Boulier
and Kanniganti [5]. One way is to implement a moving floor, that besides the
risk free rate growth can make leaps upwards following exceptionally quick and
large gains from the risky asset, limiting the exposure to the risky asset to pro-
tect the portfolio from subsequent falls in the price of the risky asset, but also
obviously limiting the possibility to fully capture sustained risky asset price in-
creases over extended periods of time.
The moving floor strategy suggested introduces a new parameter called p, which
denotes the maximum fraction of wealth to be invested in the risky asset. To
make the floor a deterministiccally guaranteed minimum value, p should be set
to be 1 − f , where f is the minimum desired floor expressed as a fraction of
portfolio wealth, i.e. f = (F/V )min .
12
Enforcing the maximum relative exposure determined by p transfers the excess
cushion to the floor. This excess cushion is given by
mCi − pVi m(Vi − Fi ) − pVi m−p
= = Vi − F i
m m m
Thus, the floor is changed according to
m−p
Finew = m Vi if mCi > pVi
Fiold otherwise.
It is easily seen that this can simply be interpreted as ’If the suggested exposure
is too large as a fraction of portfolio wealth, move the floor up until the exposure
is exactly the maximum fraction of portfolio wealth allowed’, since if mCi > pVi ,
we set
m−p
Fi = Vi ,
m
giving
m−p p
Ei = mCi = m(Vi − Fi ) = m Vi − Vi = m Vi − V i + Vi =
m m
p
m Vi = pVi .
m
In this case, there exists no closed form solution for the portfolio wealth, but
the SDE can be expressed as
rVt dt if Vt ≤ Ft
m
dVt = (Vt − Ft )dZt + rFt dt if Ft < Vt < m−p Ft
m
Vt dXt if Vt ≥ m−p Ft .
Here,
dZt = (m(µ − r) + r)dt + mσdWt ,
dXt = (p(µ − r) + r)dt + pσdWt .
Another strategy instead focuses on not letting the exposure to the risky asset
grow too small in the case of a decline of the value of the risky asset, noting
that a CPPI portfolio will follow the floor if it ever reaches it and behave un-
predictably in the case of aggressive investing leading to a portfolio value below
the floor.
Denote the initial margin M0 . Also, define Ei∗ as a lower limit for the exposure
at any time i. The margin version of CPPI states that, whenever Ei < Ei∗ /2,
Mi
Finew = Fiold − ,
2
Miold
Minew = ,
2
Einew = mCi = m(Vi − Finew ).
The lower limit can be set in several fashions. I will use a certain proportion of
the portfolio wealth at each time when evaluating this version of CPPI, i.e. I
will use Ei∗ = pVi for all times i.
13
Chapter 3
14
of basis points (hundredths of percents) of the total value of the volume of as-
sets traded. I will be using trading costs between 2 and 8 basis points, based on
information from experienced traders, to test the robustness of the algorithms
in the sense of their ability to provide satisfactory returns even when the usual
assumption of absence of trading costs is removed.
15
Chapter 4
The testing will include testing the algorithms’ performance on simulated Geo-
metric Brownian Motion (GBM) data as well as their performance on real asset
price data, to find out what the optimal patterns are for the scalable algorithms
(e.g. if it seems preferrable to use a particular number of assets) and to find
evidence of the dependence of algorithms on the different parameters of the
assets used.
Dir(1/2,1/2) Dir(1,1)
250 250
200 200
150 150
Frequency
Frequency
100 100
50 50
0 0
−0.14 −0.12 −0.1 −0.08 −0.06 −0.04 −0.02 0 0.02 0.04 −0.14 −0.12 −0.1 −0.08 −0.06 −0.04 −0.02 0 0.02 0.04
S−0.5(S1+S2) S−0.5(S1+S2)
16
It is quite obvious that, having settled for the Dirichlet class of probability
measures, the actual choice of its parameters is not very relevant. Only small
changes in the ’width’ of the distribution can be seen. This conclusion is also
confirmed by other tests. Also, some of the sources used for this thesis also
tests the Universal Portfolio algorithm with respect to sensitivity to the choice
of probability measure, reaching the same conclusion. Henceforth, this thesis
shall exclusively use the Dirichlet(1/2,1/2) probability measure for the Univer-
sal Portfolio algorithm.
Performance for universal portfolio of two stocks compared to their arithmetic average performance
400
350
300
250
Frequency
200
150
100
50
0
−0.14 −0.12 −0.1 −0.08 −0.06 −0.04 −0.02 0 0.02
S−0.5(S1+S2)
In this figure, S is the Universal Portfolio total return factor and S1 and S2
are relative prices of asset 1 and 2 respectively. As can be seen, the algorithm
does seem to have an ability to outperform the arithmetic average portfolio in a
rather large share of all cases. Also, it seems the distribution has a heavier left
tail and a lighter right tail, indicating that when the universal portfolio is un-
successful, it underperforms the arithmetic average portfolio by larger amounts
than the amounts by which it outperforms the arithmetic average when it is
17
successful. The mean difference however is insignificantly different from zero,
as is the median difference.
Performance for universal portfolio of two stocks compared to their arithmetic average performance
350
300
250
Frequency
200
150
100
50
0
−0.1 −0.08 −0.06 −0.04 −0.02 0 0.02
S−0.5(S1+S2)
A test was also done to see how the algorithm reacts to higher volatility for
the GBM:s. Below are presented histograms for the high volatility tests. The
leftmost one uses two assets, each with an annual volatility of 80% and the
rightmost one uses two assets, each with an annual volatility of 150%.
18
Performance for universal portfolio of two stocks compared to their arithmetic average performance
700 Performance for universal portfolio of two stocks compared to their arithmetic average performance
900
600 800
700
500
600
Frequency
400
Frequency
500
300 400
300
200
200
100
100
0 0
−5 −4 −3 −2 −1 0 1 −25 −20 −15 −10 −5 0 5
S−0.5(S1+S2) S−0.5(S1+S2)
It seems that the Universal algorithm has a tendency to underperform the arith-
metic average portfolio by large amounts in some cases. In order to distinguish
a pattern, a test was done to determine common traits of situations where Uni-
versal underperforms.
Universal Portfolio total return factor less average total return factor Average total return factor for two stock portfolios
0.04 2.2
2
0.02
1.8
0
1.6
S−0.5(S1+S2)
−0.02
0.5(S1+S2)
1.4
−0.04
1.2
−0.06
1
−0.08
0.8
−0.1
0 100 200 300 400 500 600 700 800 900 1000 0 100 200 300 400 500 600 700 800 900 1000
Simulation number Simulation number
19
Scatterplot of Universal excess total return factor against average portfolio performance
0.04
−0.02
−0.04
−0.06
−0.08
−0.1
0.8 1 1.2 1.4 1.6 1.8 2 2.2
Arithmetic average portfolio return factor
Figure 4.6: Scatterplot of Universal Portfolio excess total return factor against
arithmetic average portfolio total return factor
It is important to note that the low peaks of the left figure coincide with high
peaks in the right figure, which can be interpreted to mean that the Universal
algorithm is not able to fully capture very high returns of the individual assets.
Note however that the total return of the Universal algorithm is still signific-
antly positive, even in the negative peak simulations in the left figure, since this
figure shows the actual return factor less the arithmetic average return factor.
For comparison, see the scatterplot which shows that negative excess perform-
ance in most cases coexists with high arithmetic average portfolio performance.
In conclusion, it still appears reasonable to apply the Universal algorithm, since
disregarding the negative peaks in the left figure, corresponding to quite satis-
factory returns, the Universal algorithm on average outperforms the arithmetic
average portfolio. Only in a few cases does the algorithm underperform an
already poor arithmetic average portfolio. In order to better judge the real re-
turn capabilities of the Universal Portfolio algorithm, actual price data should
be used instead.
The first real price data test of the Universal algorithm used monthly actual
asset price data. The comparison with the arithmetic average portfolio gave the
following result. The horizontal axis shows integers corresponding to the looping
over the different assets. In total, there were nine assets to choose from, making
the total number of portfolios 92 = 36. Note that the Universal algorithm
20
Universal portfolio and arithmetic average portfolio performance
1.5
Universal portfolio
Arithmetic average portfolio
1.4
1.3
Total return factor
1.2
1.1
0.9
0 5 10 15 20 25 30 35 40
Assets combined
21
Performance of Universal, EG and Anticor depending on second asset expected return
1.18
Universal
EG
1.16
Anticor
1.14
1.1
1.08
1.06
1.04
1.02
0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2
µ2
1.25
1.2
1.15
1.1
1.05
0.95
0.9
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6
σ2
22
Performance of Universal, EG and Anticor depending on correlation between assets
1.09
Universal
EG
1.08
Anticor
1.07
1.05
1.04
1.03
1.02
1.01
−1 −0.5 0 0.5 1
ρ
The results are not very surprising. Higher expected return leads to better
algorithm performance for all three algorithms, indicating that they are all ba-
sically capable of capturing return from individual assets, even though earlier
tests showed that they might not be able to fully capture unusually high re-
turns. Higher volatility increases uncertainty about portfolio performance, en-
abling outcomes of higher as well as lower total return than using assets with
lower volatility. What might be considered unexpected is the inconclusive de-
pendence on asset correlation. Especially Anticor might be expected to perform
significantly better for negatively correlated assets than for positively correlated
assets, but there is no clear evidence that this is in fact the case. However, there
appears to be a small peak for Anticor for correlations around -0.4.
Since the EG algorithm is able to handle any number of assets in one port-
folio with computational complexity being only linear in the number of assets
as compared to Universal’s exponential behavior, tests were performed to see
how EG performed for different numbers of assets in each portfolio. The hori-
zontal axis shows the loop number for the portfolio. To ensure the testing of
all possible asset combinations, the loop in each step creates a binary string
representing a choice vector, where 0 represents not including the asset and 1
represents including it. Assuming a data set of time series for N assets, this
means creating N -bit strings, where the last string, corresponding to including
all assets and thus having 1 in all positions, is equivalent to the number 2N − 1.
Thus, the loop goes up to 2N − 1, converting the loop index to a binary number
and using the binary string to single out the assets to be used in the partic-
ular portfolio examined at the current stage of the loop, discarding the cases
where the binary string has zero or one occurence of 1, since these correspond
to uninteresting zero- and one-asset portfolios, respectively.
23
Performance of EG portfolio compared to best individual asset
0.05
−0.05
−0.1
−0.15
S−Smax
−0.2
−0.25
−0.3
−0.35
−0.4
0 100 200 300 400 500 600
Portfolio composition number
Finding the portfolio compositions of the top performers shows that top per-
formers are without exception made up of only two assets, a result also valid
using more frequent rebalancings as well as when using other sets of data. It is
also found to be valid for the Anticor algorithm. Intuitively, this is merely a case
of high risk, high return. The potential return is increased by not diversifying in
several assets and thus having a relatively high risk in the general case. Thus,
it seems reasonable to restrict the further analysis to portfolios consisting of
only two assets. Apart from restricting computational complexity significantly
through removing the need to test most possible portfolio combinations, this
also has the advantage of enabling fair comparisons between the algorithms,
trying to establish a ranking between the algorithms. This fairness is due to the
CPPI algorithm restriction to two-asset portfolios by definition and the imposed
restriction of the Universal Portfolio algorithm used in this thesis.
In table 4.2 is presented results using the exponentiated gradient (EG) portfolio
rebalancing algorithm as well as the universal portfolio algorithm on monthly
quoted asset prices over a seven year period. The percentages given are the per-
centages of BCRP performance realized by the algorithms. The final column,
b1 , presents the BCRP weight for the first asset. Note that in 34 out of 36
cases, the BCRP is obtained by investing the full wealth in one of the assets in
the portfolio (indicated by b1 being exactly 0 or 1), further explaining the weak
performance of Universal and EG on this data set. Also, BCRP performance
is less than impressive for all portfolios presented here. Finally, note that there
are no significant differences between Universal Portfolio and EG total return
factors for any of these portfolios.
24
Table 4.1: Performance of EG and Universal portfolios compared to BCRP. The
rightmost column shows the first asset’s weight in the BCRP.
Assets BCRP EG (%) Universal (%) b1
OMX, Hedge 1.5236 1.2216 (80.1791) 1.2155 (79.7793) 0.0000
OMX, MSCI 0.9264 0.9240 (99.7379) 0.9156 (98.8322) 0.3192
OMX, Tbond 1.4105 1.1917 (84.4867) 1.1723 (83.1130) 0.0000
OMX, Tbill 1.2718 1.1267 (88.5878) 1.1051 (86.8921) 0.0000
OMX, Mort 1.4233 1.1943 (83.9107) 1.1768 (82.6817) 0.0000
OMX, Real 1.5284 1.2440 (81.3946) 1.2280 (80.3448) 0.0000
OMX, danska_b 1.4974 1.2245 (81.7718) 1.2104 (80.8355) 0.0000
OMX, eur_gov 1.4152 1.1967 (84.5597) 1.1760 (83.0966) 0.0000
Hedge, MSCI 1.5236 1.2034 (78.9856) 1.2124 (79.5744) 1.0000
Hedge, Tbond 1.5236 1.4734 (96.7069) 1.4703 (96.5004) 1.0000
Hedge, Tbill 1.5236 1.3981 (91.7655) 1.3979 (91.7513) 1.0000
Hedge, Mort 1.5236 1.4792 (97.0858) 1.4764 (96.8992) 1.0000
Hedge, Real 1.5344 1.5342 (99.9838) 1.5301 (99.7220) 0.4262
Hedge, danska_b 1.5236 1.5166 (99.5390) 1.5136 (99.3431) 1.0000
Hedge, eur_gov 1.5236 1.4764 (96.9037) 1.4730 (96.6757) 1.0000
MSCI, Tbond 1.4105 1.1652 (82.6099) 1.1651 (82.6007) 0.0000
MSCI, Tbill 1.2718 1.1043 (86.8264) 1.0999 (86.4873) 0.0000
MSCI, Mort 1.4233 1.1690 (82.1357) 1.1702 (82.2157) 0.0000
MSCI, Real 1.5284 1.2157 (79.5408) 1.2198 (79.8082) 0.0000
MSCI, danska_b 1.4974 1.1990 (80.0703) 1.2037 (80.3835) 0.0000
MSCI, eur_gov 1.4152 1.1695 (82.6406) 1.1684 (82.5622) 0.0000
Tbond, Tbill 1.4105 1.3404 (95.0333) 1.3408 (95.0572) 1.0000
Tbond, Mort 1.4233 1.4172 (99.5695) 1.4170 (99.5593) 0.0000
Tbond, Real 1.5284 1.4696 (96.1555) 1.4696 (96.1498) 0.0000
Tbond, danska_b 1.4974 1.4540 (97.1030) 1.4540 (97.1014) 0.0000
Tbond, eur_gov 1.4152 1.4131 (99.8526) 1.4130 (99.8427) 0.0000
Tbill, Mort 1.4233 1.3458 (94.5554) 1.3466 (94.6146) 0.0000
Tbill, Real 1.5284 1.3966 (91.3790) 1.3983 (91.4910) 0.0000
Tbill, danska_b 1.4974 1.3810 (92.2236) 1.3828 (92.3441) 0.0000
Tbill, eur_gov 1.4152 1.3427 (94.8754) 1.3431 (94.9029) 0.0000
Mort, Real 1.5284 1.4765 (96.6074) 1.4762 (96.5848) 0.0000
Mort, danska_b 1.4974 1.4604 (97.5269) 1.4604 (97.5265) 0.0000
Mort, eur_gov 1.4233 1.4198 (99.7519) 1.4195 (99.7327) 1.0000
Real, danska_b 1.5284 1.5146 (99.0998) 1.5138 (99.0448) 1.0000
Real, eur_gov 1.5284 1.4723 (96.3285) 1.4720 (96.3129) 1.0000
danska_b, eur_gov 1.4974 1.4565 (97.2716) 1.4564 (97.2638) 1.0000
In table 4.2 is presented results using the exponentiated gradient (EG) portfolio
rebalancing algorithm as well as the universal portfolio algorithm on another
data set containing daily quoted asset prices. Note that EG outperforms Uni-
versal in all ten cases, which also corresponds to the findings of Helmbold et al
[9]. Also note that for this data set, the BCRP is obtained by investing com-
pletely in one asset in only two out of ten cases, although three more cases are
close to this situation, showing that the potential for the algorithms presented
to obtain higher returns should be larger than for the data set examined in the
above table.
25
Table 4.2: Performance of EG and Universal portfolios on daily data, compared
to BCRP. The rightmost column shows the first asset’s weight in the BCRP.
Assets BCRP EG (%) Universal (%) b1
sur37005, com20350 4.9233 4.0469 (82.1983) 3.5691 (72.4935) 0.8390
sur37005, com20440 6.3865 6.1462 (96.2377) 4.8782 (76.3824) 0.6248
sur37005, swe38000 4.7297 3.5031 (74.0665) 3.2424 (68.5551) 0.9472
sur37005, swe14332 4.7949 3.7101 (77.3751) 3.3579 (70.0301) 0.8960
com20350, com20440 2.7501 2.3932 (87.0223) 2.2570 (82.0699) 0.0466
com20350, swe38000 1.5113 1.4652 (96.9483) 1.4168 (93.7444) 0.8208
com20350, swe14332 1.4971 1.4213 (94.9365) 1.4100 (94.1840) 1.0000
com20440, swe38000 2.7479 2.2725 (82.7009) 2.1324 (77.6004) 0.9724
com20440, swe14332 2.7461 2.2125 (80.5697) 2.1182 (77.1339) 1.0000
swe38000, swe14332 1.3385 1.3341 (99.6678) 1.3020 (97.2724) 0.3808
In figure 4.2 is presented a graph where the constant rebalanced portfolio per-
formance for the assets in table 4.2 is plotted as a function of the weight of the
first asset listed for each portfolio in the daily quotes data. The maximum of
each curve obviously corresponds to the BCRP. As already seen, the BCRP for
pairs of these time series is still in two cases out of ten obtained by investing
the full wealth in one of the assets in the portfolio. Looking at the results in the
above table, it is clear that these assets are better suited for usage with these
algorithms, with EG and Universal outperforming both the individual assets in
some of these portfolios.
0 0 0 0
0 0.5 1 0 0.5 1 0 0.5 1 0 0.5 1
b1 b1 b1 b1
com20350, com20440 com20350, swe38000 com20350, swe14332
3 1.6 1.5
2 1.4 1.4
1 1.3
0 0.5 1 0 0.5 1 0 0.5 1
b1 b1 b1
com20440, swe38000 com20440, swe14332
3 3
2 2
1 1
0 0.5 1 0 0.5 1
b1 b1
swe38000, swe14332
1.4
1.3
0 0.5 1
b1
26
The performance of Anticor proved to be rather dependent on the choice of the
window length parameter, w. Using low values of w gives highly unpredictable
behavior, while values of about 20 and above seems to stabilize performance.
Below are presented some examples of Anticor performance for two-asset port-
folios. A test completely analogous to that made for EG above was also made
for Anticor, showing that the performance of Anticor also tends to be best for
two-asset portfolios.
3
Total return factor
2.5
1.5
0.5
0 200 400 600 800 1000 1200 1400 1600 1800
Rebalancing number
2.5
Total return factor
1.5
0.5
0 200 400 600 800 1000 1200 1400 1600 1800
Rebalancing number
The above figures show performance using daily rebalancings. When the re-
27
balancing frequency was lowered, bahavior tended to change more for Anticor
than for the other algorithms, indicating that this algorithm is not quite robust.
Below are presented some examples of monthly rebalanced Anticor portfolios.
3.5
Total return factor
2.5
1.5
0.5
0
0 10 20 30 40 50 60 70 80 90
Rebalancing number
3.5
Total return factor
2.5
1.5
0.5
0
0 10 20 30 40 50 60 70 80 90
Rebalancing number
28
Evaluation of Anticor algorithm on sur37005 and com20440 rebalancing each 20 days
5
Anticor portfolio
4.5 sur37005
com20440
4
3.5
Total return factor
2.5
1.5
0.5
0
0 10 20 30 40 50 60 70 80 90
Rebalancing number
4.3 CPPI
The CPPI algorithm differs from the other algorithms in that it is restricted to
two-asset portfolios, where one asset should be riskfree and the other should be
risky. However, it should be noted that the risky asset in itself may in reality
very well be a portfolio of assets, for instance a portfolio whose internal com-
position is determined by Universal, EG or Anticor.
Firstly, the performance of real one-risky-asset CPPI portfolios was tested. Be-
low is presented a graph of one such portfolio’s value process over time.
29
Evaluation of CPPI algorithm on sur37005, rebalancing each 20 days
5
CPPI
4.5 CPPI with margin
sur37005
4 Floor without margin
Floor with margin
3.5
2.5
1.5
0.5
0
0 10 20 30 40 50 60 70 80 90
Rebalancing time
Secondly, there is nothing to restrict the CPPI algorithm from using a portfolio
of risky assets as its risky asset. Thus, to try to improve CPPI performance,
tests were performed on some of the best portfolios for the EG and Anticor
algorithms.
0
0 10 20 30 40 50 60 70 80 90
Rebalancing time
30
Evaluation of CPPI algorithm on sur37005,com20350, rebalancing each 20 days
8
CPPI
7 CPPI with margin
sur37005,com20350
Floor without margin
6
Floor with margin
0
0 10 20 30 40 50 60 70 80 90
Rebalancing time
31
Chapter 5
Tuning of parameters
To use the algorithms for real portfolios, it is also necessary to fine-tune the
parameters of the different methods. This includes the learning rate of EG, the
window length of Anticor and the floor level of CPPI. Additionally, the length
of the side information window and the size of the weight changes that the side
information suggests must be investigated.
For the EG algorithm, the data sets used all benefitted from selecting a low
value of the algorithm’s only parameter, the learning rate η. The inventors of
the EG algorithm found that a value of 0.05 was usually preferrable. I was not
able to reproduce this result, finding that η = 0.01 was optimal in more than
90% of all cases.
The Anticor algorithm also has only one parameter, namely the length of the
window. As could be understood intuitively, very short windows spanning over
only a few days of past price information provides unpredictable, volatile per-
formance of the algorithm, with very high returns being mixed with very low
returns even for the same portfolios, making only small changes to the window
length between consecutive tests. A value of about w = 20 would stabilize per-
formance, with only insignificant changes of investment period total return if
the window was increased further.
Finally, the CPPI algorithm has several parameters. The choice of the mul-
tiple is arguably the most important, deciding how strictly the floor guarantee
is enforced. Keeping m ≤ 1 strictly enforces the floor at all times, allowing only
the cushion itself to be used for investing in the risky asset. The p and F0 para-
meters are at least philosophically strongly linked to one another, both denoting
limits to the investment in the two assets included in the CPPI portfolio. I used
p = 1 − F0 /V0 to ensure consistency between the desired relative guarantee and
the desired maximal relative risky asset investment. Introducing the moving
32
floor by letting p < 1 proved preferrable on the average, providing higher re-
turns while also limiting downside risk by continuously securing realized profits.
Optimum was obtained for p ∈ [0.15, 0.30] for all but a few portfolios. It should
also be noted that by setting a low p, one can still provide decent returns with
a lower m.
33
Chapter 6
Conclusions
This thesis has evaluated four different algorithms used for automatic portfo-
lio rebalancing, to test their ability to produce higher returns than more naïve
investment strategies such as buy-and-hold or an equally weighted constant re-
balanced portfolio. All algorithms have proven ability to provide higher returns
than these benchmarks in a majority of cases, with different algorithms having
slightly different requirements on asset price time series characteristics desirable
for optimal results.
All algorithms naturally benefit from higher expected return for the individual
assets. Increased volatility has the effect of allowing for higher returns but also
naturally increases uncertainty of final outcome, allowing for worse outcomes
as well as better. Using different correlations does not seem to affect algorithm
performance for any of the algorithms when geometric Brownian motions are
used to simulate asset price processes. That this holds even for the Anticor
algorithm which is supposed to benefit from anticorrelated assets is not quite as
surprising as one might believe, since the geometric Brownian motion does not
satisfy the mean reversion criterion that Anticor also imposes.
The performance on real life data has proven to be quite impressive at times,
especially when using the concept of side information to improve the standard
algorithm weight calculations. Several portfolios could provide fifteenfold in-
34
creases of capital invested over an investment window of six to seven years. On
average over a large amount of tests, the algorithms perform in the order (best
to worst) EG, Anticor, Universal Portfolio, CPPI, but for certain choices of as-
sets especially adapted to the mean reversion and anticorrelation assumptions
of the algorithm, the Anticor algorithm outperforms all the other algorithms.
35
Bibliography
36