Implementing Genetic Algorithms in Finance Applications Nihaar Sinha.
-
Upload
brittany-sanders -
Category
Documents
-
view
216 -
download
0
Transcript of Implementing Genetic Algorithms in Finance Applications Nihaar Sinha.
Implementing Genetic Algorithms in Finance
Applications
Nihaar Sinha
Abstract
This project investigates the use of genetic algorithms in a financial application of
portfolio optimization. Genetic algorithms have long been used in optimization problems
as well as the financial sector. Banks and hedge funds pay millions of dollars to
programmers who can develop the most accurate optimization algorithms. What this
project does is try to replicate that development on a very small scale- using only three
different companies and 8 total shares in the portfolio. The genetic algorithm considers a
number of factors in coming up with the optimized solution. These factors include an
evaluation of the price to earnings ratio of the stock, the yield on the stock, and a special
weight determining how diversified the portfolio is. While the metrics used are to an
extent crude, they serve the purpose of demonstrating how a concept such as genetic
algorithms can be used in the field of finance.
What are Genetic Algorithms?
Search technique used to find exact and approx. solutions
Used in optimization and search problems
“Evolutionary algorithim”
Inheritance, Crossover, Mutation, Crossover
Four phases: initialization, selection, reproduction, termination
Genetic Algorithm
http://www.meteck.org/IMAGES/image001.gif
Similar Research
Genetic Algorithms have been used in finance for years
“Genetic Algorithm Optimisation for Finance and Investment” by Robert Pereira is a good paper to explain fundamentals of financial genetic algorithms
This project is similar in that it uses a simple example to describe applied mathematics
Reading in Data
Source code is imported from the Internet
Data is parsed for keywords
Last Trade: “</small><big><b><span id="yfs_l10_ibm">
P/E :“</span>:</th><td class="yfnc_tabledata1">
Reading in Data (cont.)
Parsing data means source must be permanent
Source utilized is Yahoo! Finance
Snapshot of what the Yahoo! Finance interface looks like
http://finance.yahoo.com/q?s=IBM
Genetic Algorithm
User picks 3 stocks
Stocks are assigned “point value” based on 3 metrics
Metrics are P/E closeness to 16, yield, and diversification
Genetic Algorithm (cont.)
Random combinations of 8 shares amongst 3 stocks are generated
Combinations are ranked, and bottom half are eliminated
Top half are crossed over and re-ranked
Process continues until one solution remains
10/29/09
Class Structure
The Main method prompts for the stock symbols and sends them to the Rank class for data mining and generation
Rank class imports data, calculates it, and formats it
Main method receives the data and runs the genetic algorithm
Problems Run Into
How exactly to parse through all the data and find the relevant information
How to organize the program to make it less cluttered
How to form combinations that can be crossed over
Training the algorithm to return the ideal result every time
Solutions
After inspecting the source, relevant data is always followed by a specific tag
User prompted for information through JDialog boxes
Combinations turned into permutations, with 8 total shares
Ideal result can be pre-derived, and algorithm can then be coached to find the right solution.
How has my hypothesis changed?
Focus has shifted to applying genetic algorithms in finance
Concentration on educational purposes and helping explain how applied mathematics play a role in finance
Testing has shown that the best way to import data is through importing the source code and not trying to download files
Progress since 2nd Quarter
• Program now includes genetic algorithm
• Better class structure and code organization
• Several more complex data structures introduced
• Matrices
• Arrays
• Genetic Algorithm