Vous êtes sur la page 1sur 17

PERRY J.

KAUFMAN
Specialist in product development and
financial engineering

PORTFOLIO ALLOCATION
FOR THE ACTIVE TRADER
Using Genetic Algorithm Technology

Proper Allocation is Important


The amount allocated can change failure to
success or success to failure
It considers the risk of each market
It considers the correlation in returns
between each pair of markets

20%

25%

15%

5%

35%

Microsoft

U.S.
notes

Crude oil

Gold
stocks

Cisco

Allocation Objectives

In general, equalizing the risk of each


market maximizes diversification
In general, allocating equally across
correlated groups maximizes diversification

Everyone Uses Markowitz

Markowitz is the creator of MPT


Modern Portfolio Theory
Expected risk is the portfolio variance

2
R =

2
2
w
i

+ wiwjCij

Note that is the standard deviation (risk)

Note that Cij are the cross-correlations

Note that wi are the weighting factors

Most Traders Have Disjoint Returns

MPT is intended to use continuous returns, such as stock


prices expressed as a percentage return series
Real trading is not always in the market; returns are
disjoint separated by periods of zero (no activity)
Periods of zero returns artificially make smaller and
create suspicious covariance values
4
3.5
3
No m a rke t positions
2.5
%Returns

2
Risk is le ss
w he n only one
m a rke t ha s a n
oe n position

1.5
1
0.5
0
-0.5

Risk is gre a te r w he n
the re a re positions
in both m a rke ts

The Genetic Algorithm


If MPT does not show the true risk of
trading, then another method is needed
A Genetic Algorithm solves this problem
It is a very powerful search method that is
based on the concepts of reproduction and
survival of the fittest

Genetic Algorithm Process


1.
2.
3.
4.
5.
6.

Start with a gene pool


Rank the best attributes
Propagate the survival of the fittest
Mate
Introduce mutations
Cycle into step 2

Gene Pool
Create of Gene
Pool using random
numbers between
0 and 1.0
Each line is a new
portfolio
Scale between
0 and 1.0,
sum = 1.0

Portfolio
1
2
3
4
5
6
7
8
9
10
11
12
.
.
.

ASSET (RANDOM ALLOCATION)


1
2
3
4
5
0.65 0.33 0.59 0.94 0.08
0.42 0.87 0.17 0.01 0.66
0.30 0.09 0.98 0.97 0.44
0.13 0.27 0.57 0.99 0.22
0.08 0.61 0.16 0.51 0.41
0.82 0.98 0.60 0.76 0.97
0.52 0.93 0.61 0.45 0.86
0.25 0.39 0.41 0.45 0.75
0.76 0.61 0.89 0.59 0.33
0.58 0.76 0.14 0.14 0.86
0.70 0.69 0.77 0.57 0.17
0.53 0.69 0.24 0.20 0.85
0.93 0.80 0.16 0.35 0.23
0.50 0.29 0.27 0.92 0.99
0.97 0.28 0.38 0.57 0.66

Scaling the Pool into Weighting Factors

Total each row and divide by the total


ASSET (RANDOM ALLOCATION)

ASSET (RESCALED VALUES)

Portfolio

Total

Portfolio

Total

0.65

0.33

0.59

0.94

0.08

2.59

0.25

0.13

0.23

0.36

0.03

1.00

0.42

0.87

0.17

0.01

0.66

2.13

0.20

0.41

0.08

0.00

0.31

1.00

0.30

0.09

0.98

0.97

0.44

2.78

0.11

0.03

0.35

0.35

0.16

1.00

0.13

0.27

0.57

0.99

0.22

2.18

0.06

0.12

0.26

0.45

0.10

1.00

0.08

0.61

0.16

0.51

0.41

1.77

0.05

0.34

0.09

0.29

0.23

1.00

0.82

0.98

0.60

0.76

0.97

4.13

0.20

0.24

0.15

0.18

0.23

1.00

0.52

0.93

0.61

0.45

0.86

3.37

0.15

0.28

0.18

0.13

0.26

1.00

0.25

0.39

0.41

0.45

0.75

2.25

0.11

0.17

0.18

0.20

0.33

1.00

0.76

0.61

0.89

0.59

0.33

3.18

0.24

0.19

0.28

0.19

0.10

1.00

10

0.58

0.76

0.14

0.14

0.86

2.48

10

0.23

0.31

0.06

0.06

0.35

1.00

11

0.70

0.69

0.77

0.57

0.17

2.90

11

0.24

0.24

0.27

0.20

0.06

1.00

12

0.53

0.69

0.24

0.20

0.85

2.51

12

0.21

0.27

0.10

0.08

0.34

1.00

0.93

0.80

0.16

0.35

0.23

2.47

0.38

0.32

0.06

0.14

0.09

1.00

0.50

0.29

0.27

0.92

0.99

2.97

0.17

0.10

0.09

0.31

0.33

1.00

0.97

0.28

0.38

0.57

0.66

2.86

0.34

0.10

0.13

0.20

0.23

1.00

Gene Pool Rescaling


with Whole Numbers
Portfolio
1
2
3
4
5
6
7
8
9
10
11
12
.
.
.

ASSET (RANDOM ALLOCATION)


1
2
3
4
5
0.07 0.74 0.87 0.13 0.47
0.20 0.62 0.77 0.30 0.70
0.41 0.22 0.04 0.50 0.54
0.60 0.52 0.79 0.10 0.26
0.72 0.66 0.53 0.70 0.04
0.75 0.77 0.60 0.99 0.77
0.41 0.70 0.62 0.83 0.45
0.54 0.15 0.30 0.09 0.66
0.13 0.07 0.59 0.89 0.00
0.02 0.80 0.49 0.17 0.47
0.61 0.53 0.89 0.83 0.32
0.02 0.21 0.63 0.25 0.41
0.15 0.88 0.96 0.22 0.06
0.91 0.91 0.44 0.47 0.12
0.04 0.80 0.57 0.77 0.70

100
Total
2.28
2.59
1.71
2.27
2.65
3.87
3.01
1.74
1.68
1.94
3.18
1.53
2.27
2.86
2.88

SCALE BETWEEN 0 AND 100


1
2
3
4
5
3
33
38
6
21
8
24
30
11
27
24
13
2
29
31
27
23
35
4
11
27
25
20
27
1
19
20
15
26
20
14
23
21
27
15
31
8
17
5
38
8
4
35
53
0
1
41
25
9
24
19
17
28
26
10
2
14
41
16
27
7
39
42
10
3
32
32
16
17
4
1
28
20
27
24

Propagation
Using portfolio 1
allocations,
calculate returns,
risk, and ratio of
return/risk
Find all ratios
Sort by ratio

RETURNS OF PORTFOLIO 1
1
2
3
4
5
0.19
0.07
0.20
0.39
0.14
19990104

-0.241

-0.018

19990105

0.184

0.120

19990106

0.084

0.190

19990107

0.008

0.182

19990108

0.041

0.011

19990111

0.142

0.166

0.198

19990112

0.040

0.023

19990113

-0.029

0.028

0.010

-0.070

19990114

0.048

0.128

-0.373

0.460

19990115

0.012

0.034

0.100

19990119

0.003

0.417

19990120

0.097

0.103

0.050

19990121

-0.179

-0.102

0.710

19990122

-0.064

-0.107

0.057

19990125

0.121

-0.008

0.040

-0.018

19990126

-0.017

0.052

-0.011

-0.733

-0.150

19990127

-0.088

-0.098

-0.145

0.057

-0.020

19990128

-0.002

-0.065

-0.462

-0.208

19990129

-0.078

0.159

19990201

0.117

0.063

19990202

-0.026

0.02

-0.142

19990203

-0.055

-0.006

0.101

19990204

0.056

0.132

-0.122

19990205

0.067

0.045

0.056

-0.013

19990208

0.039

-0.034

-0.212

19990209

-0.003

-0.038

0.122

19990210

-0.021

0.121

-0.080

19990211

-0.03

-0.119

0.220

19990212

-0.009

0.057

0.017

19990216

0.145

-0.014

0.023

-0.205

-0.045

-0.046

0.036

0.420

0.103

19990217

Sta nda rd de via tion =


Ra te of re turn =
Annua lize d sta nda rd de via tion =
Annua lize d ra te of re turn =
RETURN RATIO

Da ily Tota l
Re turn Re turn
-0.050 -0.050
0.054 0.004
0.044 0.048
0.036 0.084
0.005 0.089
0.121 0.210
0.019 0.229
-0.010 0.219
-0.062 0.157
0.044 0.201
0.165 0.366
0.046 0.412
0.238 0.649
0.003 0.652
0.020 0.672
-0.312 0.360
-0.033 0.327
-0.225 0.102
0.026 0.127
0.021 0.148
-0.032 0.116
0.009 0.125
-0.004 0.121
0.022 0.143
-0.083 0.061
0.010 0.070
0.008 0.078
0.003 0.081
0.016 0.097
-0.049 0.048
0.176 0.224
0.1011
0.224
0.8218
1.8181
2.2123

How Much to Propagate?


(Make more copies of the best)
5.2

4.5

4.1

3.8 3.6 3.5 3.5

Sort portfolios by rank


Get a random number between 3.5 and 5.2
Create as many copies as the closest rank to
the random number
(if random number is 4.9, make 5 copies)
Put the copies into a new pool

Mating
RANDOM P OINT
1

S W ITCH LEFT AS S ETS


A

Pick 2 portfolios at random from the pool


Pick a random point from 0 to 5 assets
Switch the left allocations
Mate all of the portfolios in the pool

Mutating Creates New Possibilities

Choose a portfolio at
random
Choose an asset at
random
Choose a new
allocation at random
Rescale portfolio
Mutate 1 asset in 10%
of all portfolios

Portfolio
1
2
3
4
5
6
7
8
9
10
11
12
.
.
.

ASSET
3

Why Mutate?
If you dont mutate, then you can only find
the best result from combinations in the
original pool. The bigger the pool, the more
combinations. This is called premature
convergence.
Too much mutation may change all the best
combinations and you may lose the best
results. We may get no convergence.

Cycle Back to Ranking Are We Done?


If there are no
portfolios with
higher ratios,
then we are done.

Create pool
Calculate ratios
Are we done?
Propagate best
Mate
Mutate

yes

More About Genetic Algorithms

A GA searches for the global maximum


50 x 50 x x 50 (100 times) combinations
It may find a local maximum
Repeat the search 5 times for a better chance
Each search takes about 10 minutes

CONTOUR MAP OF
POSSIBLE RETURNS

Global maximum

Local maximum

Returns

Weights
1% to
100%

1 .

Assets

. 50

Vous aimerez peut-être aussi