<< Click to Display Table of Contents >> Portfolio Optimization |
|
Example File: GHSAMPLE.XLS, Portfolio Optimization worksheet Solution Type: Continuous Chromosomes
Note: This example is located in a tab labeled Portfolio Optimization in the GHSAMPLE.XLS worksheet that was installed in the C:\GENEHUNTER\EXAMPLES\EXCEL subdirectory if you chose the default directory during GeneHunter installation. (If you install the entire AI Trilogy set of programs, the GeneHunter folder is a subfolder of the C:\AI Trilogy folder.)
The subject of portfolio optimization actually goes well beyond the simple bin packing example 'Portfolio'. In true portfolio optimization, a trader or fund manager would seek to minimize his/her risk while simultaneously trying to maximize return.
There are several techniques which have been used for stock portfolio optimization [Markowitz, Ref. 19], [Sharpe, Ref. 20] (full citations are in References section of the help file). Many of these can be accomplished with a genetic algorithm. More recently, Lowe [Ref. 18] has presented a technique for portfolio optimization using an esoteric type of neural network. However, the same type of optimization may also be performed with GeneHunter, and, in fact, we believe GeneHunter is better suited than the neural network for this purpose.
Lowe's technique is simple and elegant. The idea is to minimize risk by diversification of stocks of interest (giving good returns) in a manner similar to the diversification that is available in some existing optimized portfolio. This already optimized portfolio could be any portfolio, but the S&P500 is a readily available example of a diversified portfolio that comes to mind. So we want to divide our available investment cash into N portions so we can purchase N stocks of interest. We would like our new portfolio of N stocks to be purchased in such a way that the total portfolio value would most closely follow the S&P500, thus diversifying risk as we would if we could purchase all of the S&P500 stocks.
As a concrete example, suppose we are interested in 15 stocks: IBM, Coca-Cola, ..., AT&T. We want to know the percentages p1, p2, ... p15 of our investment cash that should be invested in each of the 15 stocks. If p1 should turn out to be 8%, then we will invest 8 percent of our cash in IBM.
Figure 5.16 Portfolio Optimization
We want to minimize the difference between the value of an "average" share in our portfolio and value of an average share of the S&P500 portfolio. The average share in our portfolio is valued at [p1*(IBM price) + p2*(GE price) + ... + p15*(AT&T price)]/100. We divided by 100 because all of the p values are percentages. Let's call that OURAV. The average share value in the S&P500 is just the value of the S&P, which we will call SP500. Therefore we want to minimize the difference between the two, and the best way to do this statistically is to minimize the squared difference:
(OURAV - SP500)^2
However, this squared difference will vary over time, so what we really want is the average of the squared difference over a period, such as 12 months of 1994. Therefore the GeneHunter fitness function (cell D12) is:
average over 12 months of (OURAV - SP500)^2
Actually, the SP500 index is not a simple "average" share price, so the range of SP500 variation differs significantly from the range of variation of OURAV. We need to scale both SP500 and OURAV into the same range to perform a valid comparison. The simplest way is to normalize each curve to its maximum value.
The continuous/integer chromosomes to be used are c1 through c15 (range G9:U9). The range of variation of each of those will be from 0 to 127, and we will convert the chromosomes to share percentages using a formula: p=c/sum*100, where p and c stand for share percentage and corresponding chromosome value, and the sum (cell F9) is calculated as: sum=c1+c2+...+c14+c15. This method ensures us that for every combination of chromosomes values c1, c2, ..., c15 the sum of percentages p1+p2+...+p15 will always equal 100%.
The 1994 database with weekly values of SP500 and 15 major stock prices is in the range E14:U65. Our portfolio values are in column A, and normalized values of our portfolio and of the SP500 are in columns B and C correspondingly. Their squared difference is calculated in column D and the average value over 52 weeks (the fitness function) is in cell D12.
That's all there is to it! You can pick your own stocks and the number (N) of them, and your own time period (which was 52 weeks above). |