A C T A U N I V E R S I T A T I S L O D Z I E N S I S
FO L IA O E C O N O M IC A 175, 2004
J a c e k O l e s i n k i e w i c z * , A n n a R u t k o w s k a - Z i a r k o *
A P P L IC A T IO N O F T H E W O L F ’S A L G O R IT H M IN C O N S T R U C T IN G E F F E C T IV E P O R T F O L IO S
Abstract. The aim o f this paper is to present a method o f constructing effective portfolios with application o f W o lfs algorithm . The effective portfolios are understood as those which have the lowest risk at give rate o f return, and , conversely, which have the highest returns at given risk level. In classic M arkowitz m odel, the rate o f return is understood as expected returns which in practice is replaced by a mean return. The variance o f the portfolio returns is considered as the risk measure.
Ready-m ade programs m ay be used to construct effective portfolios. In practice, using these application causes som e problem s. In order to calculate the p ortfolios efficiently, we have written an application in the D elphi programming language using a suitably adapted W olf’s algorithm.
Key words: quadratic program ming, effective portfolio, risk.
T h e p artic ip a n ts o f business processes act in the risk en v iron m en t. T h is particularly holds tru e fo r the stock exchange investm ents. In o rd e r to reduce risk, the stock exchange investors co n stru c t effective investm ent portfolios; th a t is they invest m onetary resources in stock o f m an y com panies quoted at stock exchange th u s seeking a portfolio w ith th e low est risk at given retu rn s o r w ith the highest returns at given risk level. T h e rate o f re tu rn is u n d ersto o d here as expected return s, which in practice are replaced by m ean retu rn s. In classic M ark o w itz m odel, the variance o f the p o rtfo lio returns is assum ed as the risk m easure ( M a r k o w i t z 1952).
G eneral q u ad ratic program m ing applications (QSB, O perational R esearch) o r a specialized P o rtfo lio p ro g ram ( E l t o n and G r u b e r , 1997) m ay be used for selection o f an effective p ortfolio. U sing these ap p lica tio n causes som e problem s. T h e P o rtfo lio pro gram has lim itation s in re la tio n to the num ber o f considered com panies and observations; m o reo v er it c a n n o t perform the task o f re tu rn s calculation. A vailable ap plicatio ns fo r q u a d ra tic or n on-linear p ro g ram m in g req uire tim e-consum ing en terin g o f d a ta and
pre-d eterm in atio n o f m ean retu rn s and elem ents o f varian ce-co variance m atrix. T he problem o f co n stru ctin g effective portfolios has been studied by many scholars (T r z a s к a 1 i к and J u r e k 1995; К о 1 u p a and P 1 с b a n i а к, 2000) b u t the absence o f an ad e q u ate program has m ad e it practically im possible to select effective portfolios from the set o f all com p anies qu o ted on W arsaw Stock E xchange. In ord er to calculate the p o rtfo lio s efficiently (quickly and fo r any n um ber o f com panies and observ atio n s), we have w ritten an ap p licatio n in the D elphi p rogram m ing language using a suitably ad ap ted W o lfs algorithm .
T h e aim o f this p a p e r is to present a m eth od o f co n stru c tin g effective p ortfolio s w ith ap p lica tio n o f W o lfs algorithm . C lassic M ark o w itz m odel is based on th e follow ing assum ptions:
• the p o rtfo lio includes к shares, A lt A 2, ..., A k\
• the p ro p o rtio n o f shares in the p ortfo lio is varied, which is described by the vector: X = ( x t , x 2, x*)7 w ith non-negative co m p o n en ts ( x , > 0 ) norm alized to one:
Z * < = 1 ( 0
i =t in the m atrix n o tatio n :
X JI k = 1 (2)
where / л = (1, 1, ..., 1) is the /с-dim ensional vector w ith co m p o n en ts equal to one;
• each share Aj, i = 1, 2, к in a specified period o f tim e has m tim e units, in w hich th e re tu rn s z it are recorded, w here t = 1, 2, ..., m. M ean re tu rn s o f given shares are calculated on the basis o f th e follow ing form ula:
1 m
ž, = - Z zii> > = 1. •••. к (3) m t=i
T he m ean re tu rn from the p ortfolio with к shares is expressed by the weighted m ean:
z'p = £ Xjži = X TZ (4)
i = t
T h u s, z p dep en d s b o th on m ean retu rn s from given shares and o n th eir p ro p o rtio n in the p o rtfo lio . C onsidering the colum ns o f th e Z m a trix w ith z„ elem ents, we o b tain in fo rm atio n on the re tu rn s from the shares in question in given m o m en ts in tim e. T he p ro p o rtio n o f the shares is varied, which is expressed by the vector X , so it is possible to d eterm in e the follow ing scalar p roducts:
к
z pl = X TZ t = E xjZ ft, t = 1, m (5) <=i
w here Z , = (z lr, ..., z kt) T is the i-th colum n o f the Z m atrix .
T he re tu rn s from the p o rtfo lio Zp, m ay be com pared to th e m ean retu rn s z p. It is assum ed th a t the variance o f the retu rn s from th e p o rtfo lio is the m easure o f the deviation o f Zp, from z p:
= ~ 7 f > „ - ž p ) 2 = - - T £ x ^ ( Z t - Z ) ( Z ' - Z ) TX = X r C X (6)
m - 1 I = 1 m - l ( =i
where:
C = - ^ - T f ; ( Z t - Z ) ( Z t - Z ) T (7)
m - 1 ( =i
is (k x /c)-dim ensional variance-covariance m atrix from the sam ple. T he m entioned risk m easu re s j for the po rtfolio m ay be expressed as follows:
к
«p = Z x ?c f + 2 ľ W r y ( 8 )
i = l 1
where:
is the variance o f the re tu rn s fo r the i-th an d )-th share, w hereas: 1
CU =
Xczu-zjizjt-zj)
(10)M inim izing the expression:
X TC X —»m in (11)
with the follow ing constraints:
& Х > у (12)
ż X, = i (13)
/=1
i = 1, k, where:
у - is the pre-dcfined re tu rn from the w hole p o rtfo lio , assum ing y ^ m a x z , . In o rd e r to used th e W o lfs m etho d o f q u a d ra tic p ro g ram m in g ( G r a b o w s k i 1982), we need to tran sfo rm the expression (11) an d co n stra in ts (12), (13) to the follow ing form :
— P X + A ^C G —*m in
A X š В (14)
A > 0
w here P is a vector, an d G is a non-negative squ are m atrix.
X is renum bered so th a t x, relatin g to the co m p an y w ith th e highest variance is the last.
x k - the p ro p o rtio n o f shares w ith highest variance from (13) we receive:
x k = i - £ x i ( 15)
i= i x k is substituted to (11) and we receive:
- Q X + X ^ D X - ^ m m (16)
where:
D — [k — 1, к — l]-dim ensional m a trix w ith elem ents:
d i j = c lj + c kk — c kj ~ c ik ( 1 7 )
4i — — 2 C** + C*j + Ci* (18) T w o a ttrib u te s result from the above-presented form ulas:
• elem ents o n the m ain d iag o n al o f the D m atrix are non-negative.
du = £ ( 2 Й- У , ) 2 + E ( z* - I y)2 “ 2 E ( zt t - * í ) ( z j » - ž j ) (19)
t= i «=i
(a2 + h2 — 2ah) is non-negative, so elem ents on the m ain d iag o n al the D m atrix are non-negative, too.
• because ckk is th e largest elem ent o f the С m atrix , from (18) it is concluded th a t the elem ents o f the D vector are negative.
F ro m (12) and (15) we receive:
Z ¥ i + ž / l - X*,) > у
(20)
i = i \ i = i / * - 1 I (žt + žk)xt + Ikž y (21) i = i k - I Y ( ž k - ž l) x l š ž k - y (22) / = i F ro m (14) we receive: k - 1 1 _ Z x i i=i * - iZ
1
i= 1thus, the p ro blem o f selecting an effective portfolio form : — Q x + x JD x —> m in (25) and co n stra in ts A X ^ В X ž O (23) (24)
where
* i “ ľ z i ~ y ••• Z k - 1 - У
(26)
В Ш (27)
In the W o lfs m eth o d [II], introdu ced are the vector o f ad d itio n al variables X d an d Y d plus the vector W o f the artificial variables w ith w, elem ents:
In the abo v e m e th o d , instead o f solving the m odel in the form (25), the sum o f artificial variables is m inim ized with the co n stra in ts (30-33):
A ccording to the W o lfs alg o rith m , we check the signs o f free sets o f equ atio n s X d + A X = В an d 2 X T- D + Y A - Y d + W = Q:
I) if b j ^ O , they'-th e q u a tio n is left unchanged, tre a tin g x d as th e basis variable,
II) if b ^ < 0 , b o th sides o f the j -th eq u a tio n is m ultiplied by -1 and
III) if <?,<0, b o th sides o f th e j -t h eq u atio n is m ultiplied by -1 and the y d is treated as the basis variable,
IV ) if qt > 0, artificial variable w, (treated as the basis v ariable) is added to the left side o f the equatio n.
Y X d + YdX = 0 X d = В - A X (28) Yd = 2 X 7D + Y A - Q k - 1 £ w(—>min i= i (29) X d + A X = В 2 X JD + Y A - Y d + W = Q X > 0 \ X d > 0 ; Y > 0; Y d ž 0; W > 0 Xl/ j = 0; x dyj = 0; i = ( 1, ..., k - I ) ; j = ( 1, 2) (30) (31) (32) (33)
the artificial variable Vj (treated as the basis variable) is added t the left side o f the equation .
*1 Xk-1 A yi- 1 *1 ... " » - I У1 A A Ho f . c . A * i ~ 7 0 ... 0 0 ... 0 0 0 1 0 * 1 - 7 0 A i 1 0 0 0 0 0 0 0 1 1 0 m « - 1 0 0 1 0 0 Ž1 - 7 1 0 0 P i 1 * 0 0 0 0 • wk-i 2 ^ 1 - Ц - 1 0 0 - 1 0 0 1 * k - i - V 1 0 0 K -1 1
I f artificial variable v 1 needs to be added, the starting table will be as follow s:
*1 1 7 Í - 1 * 1 . . . WL - 1 >1 У2 A A V1 Ho f . c . A * 1 + 7 V i + 7 0 0 0 . . . 0 0 0 1 0 1 * 1 - 7 0 A 1 1 0 0 0 . . . 0 0 0 0 1 0 1 0 W 1 4 i - 1 0 0 1 0 0 Ž 1 - 7 1 0 0 0 Pi 1 0 0 0 0 : w l - l 2Л 0 0 - 1 0 0 1 Jk - i - y 1 0 0 ó Pk-l i Ap pl ic at io n of th e W o lf s A lg o ri th m in C o n st r u c ti n g ...
In o u r case:
• < ^ < 0 , for each i = ( l , k — 1), so (IV ) will not occur,
• b 2 = \,
• b { is positive if the co m pany with the highest m ean retu rn s has also the highest re tu rn variance. G enerally, this assu m p tio n is satisfied; it is no t, we ad d the colum n representing th e artificial variab le V! to the startin g table.
In o rd e r to co n stru c t effective portfolios according to the above-described m eth o d , we have w ritten an application in the D elphi language, which has m ade it possible to p re p are a user-friendly interface, easily enter th e d a ta and read the results. T h e pro g ram requirem ents are as follows: a d a ta file (q u o tatio n s o f the com pan ies over a given period o f tim e), specified set o f com panies (num bers), n u m b er o f observations, length o f the investm ent period (in days) and pre-dcfincd expected returns. As a result, we receive the nam es o f com p an ies to form o u r p ortfolio , the p ro p o rtio n o f their shares in the p o rtfo lio , variance and o ther risk m easures: variance from the -defined re tu rn s , sem ivariance, and sem ivarian ce fro m p re-defined returns. It is possible to see an d save the successive itera tio n s as well as to choose the so lu tio n elem ent. T h e p rog ram has an ad d itio n al fe atu re o f constructing an effective portfo lio for other risk m easures, such as m inim izing the sem ivariance from pre-defined returns.
REFEREN CES
E l t o n E. J., G r u b e r M. J. (1997), N ow oczesna teoria portfelow a i analiza papierów wartościow ych, W IG Press, Warszawa.
G r a b o w s k i W . (1982), Program ow anie m a tem atyczne, PWE, Warszawa. K o l u p a M ., P l e b a n i a k J. (2000), Budowa portfela lokat, PWE, W arszawa. M a r k o w i t z H. (1952), P o rtfolio selection, J. Finance, 7.
T r z a s k a l i k T, J u r e k R. (1995), Zastosow anie teorii p o rtfela do analizy inw estycji na G iełdzie W arszaw skiej, W ydaw nictw o Uniwersytetu Ł ódzkiego, Łódź.
J a c e k O le s in k ie w ic z , A n n a R u t k o w s k a - Z i a r k o
Z A S T O S O W A N IE A L G O R Y TM U W OLFA 1 )0 W Y Z N A C Z A N IA PO R TFELA EFEKTYW NEGO
Celem artykułu jest przedstawienie m etody uzyskiwania portfeli efektyw nych przy za stosow aniu algorytm u W olfa, czyli portfeli, które przy danej stop ie zwrotu posiadałyby najniższe ryzyko, zaś dla d an ego poziom u ryzyka charakteryzowałyby się najw yższą stopą
zwrotu. W klasycznym m odelu M arkow itza przez stopę zwrotu, rozum ie się oczekiw aną stopę zwrotu w praktyce zastępow aną średnią stopą zwrotu, za miarę ryzyka przyjmuje się wariancję stóp zwrotu z portfela.
W celu wyznaczenia portfela efektyw nego m ożna poshiżyć się gotow ym i program ami. W praktyce w ykorzystanie tych aplikacji stwarza pewne problemy. By sprawnie w yznaczać portfele efektyw ne napisaliśm y program w Delphi wykorzystujący odp ow ied nio dostosow an y algorytm W olfa.