Genetic Algorithm Based Optimization For Efficient Investment
Genetic Algorithm Based Optimization For Efficient Investment
Investment
Sarvesh Tanwar
Manu Bhargav AIIT
AIIT Amity University
Amity University Noida,India
Noida,India [email protected]
[email protected]
Abstract—This work investigates how Genetic Algorithms is not out of the ordinary. Knowing whether stock prices
(GAs) might be used to optimize investment strategies with will rise or fall the following day is necessary in order to
the goal of enhancing financial market decision-making. make financial investments in the stock market. Therefore,
Inspired by natural selection and genetics, genetic algorithms the goal of this study is to forecast whether a stock's peak
provide a potent optimization tool to tackle the intricacies of price will rise or fall the next day. We are attempting to
investment portfolio management. The traditional method of forecast the stock prices of eight distinct firms in this
making investment decisions frequently depends on historical research. We forecast whether the highest price of each
data and static models, which might not fully reflect the company will increase or decrease the following day. There
dynamic nature of financial markets. In contrast, a dynamic are only two classes involved, making it a classification
and adaptable framework that can change over time is offered problem. As a result, we have made every effort to simplify
by genetic algorithms. Their flexibility in handling shifting the issue. Chien-Feng [1] looks for connections between
market conditions and optimizing investment portfolios is a Monday and Friday stock price movements in the stock
result of their adaptability. The study commences with market. Prices have been seen to increase more regularly
delineating the essential concepts of Genetic Algorithms and on Fridays than on any other day. Additionally, compared
their appropriateness in resolving intricate optimization to other days, Mondays have seen the least amount of price
issues. After that, it explores the particular difficulties
increases. Searches for a cross-correlation between price
involved in making investing decisions, highlighting the
and volume changes were conducted by Lauri Nyman [2].
necessity of flexible tactics in the face of volatile markets. The
Volumes are required to move the stock price in order for
creation of a model based on genetic algorithms with the goal
it to alter. Two significant empirical findings were
of optimizing investment portfolios is part of the study
obtained. The first shows a power law cross-correlation in
process. As input parameters, the model takes into account
market patterns, risk tolerance levels, and important financial
the logarithmic changes in price and volume, whereas the
data. A number of simulations and back testing exercises are
second shows that the logarithmic changes in volume and
used to evaluate how well the Genetic Algorithm performs in price follow the same cubic law.
terms of increasing investment returns and lowering risks.
According to Chien-Feng [1], financial insolvency can be
predicted using a genetic algorithm. We have also
attempted to forecast the stock using a comparable method.
Keywords—machine learning, finance, investment,
This might even be used to forecast stock prices. Important
decision-making, genetic algorithms, selection, optimize
traits have been predicted and extracted using the genetic
I. INTRODUCTION method [1-4]. Many analyses of the variables influencing
Stock price forecasting has never been an easy undertaking. stock prices and the financial market have been conducted.
It has been noted that a company's stock price is not always There are various methods for forecasting stock prices.
influenced by the state of the national economy. It is no Feature selection or the extraction of the best characteristics
longer closely associated with the nation's or a specific are two methods for reducing complexity. As the
region's economic growth. Predicting stock prices has complexity goes down, this method will help us predict
therefore become considerably more challenging than it stock prices more accurately. This research employs a
was previously. These days, a variety of factors, such as revolutionary way to anticipate the greatest price. We
news about companies, political developments, natural attempt to determine the relationship weights between each
disasters, etc., can influence stock prices. The stock prices attribute and the stock price prediction. Each organization
have experienced rapid fluctuations due to the efficient
utilizes a total of six qualities. For this reason, we employ
processing of data from these events through enhanced
technology and communication systems. As a result, a six connection weights—one for every attribute. The
significant number of financial institutions must purchase contribution of every element to the price prediction of
aas well as sell equities as quickly as possible. Therefore, a stocks is defined by each connection weight value. For
few hours or even a few days between buying and selling instance, it is possible that the volume attribute makes a
greater contribution than the other attributes.
C. Parameter Tuning
The population size, crossover probability, mutation
probability, selection criterion, and termination point are Figure 2: Function create_data
the parameters that we take into account.
B. Function create_population
The various parameter combinations for all algorithms
Start a population with four genes in it. The functions
are listed as follows:-
create_data, create_genes, and calculate_fitness are all
contained in this function. The user determines the size of
The Genetic Algorithms are configured as follows:-
the population.
TABLE 1) PARAMETERS VALUES FOR GENETIC
ALGORITHMS
D. Model Evaluation
Using historical data, we will conduct extensive
simulations to evaluate the success of established
investment strategies. We are also evaluating the
algorithms in a variety of market circumstances and
benchmarking them against traditional investment
techniques. Figure 4: Create_genes function
H. Decimal numbers
Figure 5: Calculate fitness function
Generating chromosomes as binary in 2’s complements
E. Crossover Function
Create new populations or people (offspring of the original
population) that share the same genes but are distinct from
the original population. The user's value crossover rate (cr)
determines how many people are generated.
I. Main program
Implementation of all functions
Company Open Price Closing Price Highest Price Lowest Price Volume Adjusted Closing
Name Price
Adobe 995 10 27 83 929 38
Apple 98 12 85 18 30 17
Google 89 12 18 15 87 21
IBM 87 5 39 44 71 23
Microsoft 121 135 223 138 218 148
Oracle 963 1 24 18 989 28
Sony 963 7 54 37 975 38
Symantee 976 8 23 18 55 2
Table 2: Using evolutionary strategies to get connection wrights for all the companies [15]
Company Name Open Price Closing Price Highest Price Lowest Price Volume Adjusted Closing Price
Adobe 804 36 767 18 601 727
Apple 309 20 116 8 158 111
Google 890 15 27 46 43 830
IBM 247 23 35 8 907 72
Microsoft 285 5 70 42 24 183
Oracle 842 1 769 7 103 281
Sony 856 9 861 44 854 42
Symantee 778 13 161 302 938 23
Table 3: The best fitness calculated for all the companies. [15]
Company Name Fitness Value calculated from Genetic Algorithms Fitness Value calculated from Evolutionary Strategies
Table 4: Accuracy with which price of stocks was predicted for all the companies [15]
Company Name Fitness Value calculated from Genetic Algorithms Fitness Value calculated from Evolutionary Strategies
[11] Huang, JY., Tung, CL. & Lin, WZ. Using Social
REFERENCES Network Sentiment Analysis and Genetic Algorithm to
Improve the Stock Prediction Accuracy of the Deep
[1] Huang, Chien-Feng. “A hybrid stock selection model Learning-Based Approach. Int J Comput Intell Syst 16,
using genetic algorithms and support vector 93 (2023). https://doi.org/10.1007/s44196-023-00276-
regression.” Applied Soft Computing 12.2 (2012): 807- 9.
818.
[12] Kakkar, L., Gupta, D., Saxena, S., & Tanwar, S. (2019).
[2] Nyman, Lauri. “A Genetic Algorithm for Generating An analysis of integration of internet of things and
Optimal Stock Investment Strategies.” (2017) cloud computing. Journal of Computational and
Theoretical Nanoscience, 16(10), 4345-4349.
[3] Abraham, R.; Samad, M.E.; Bakhach, A.M.; El-
Chaarani, H.; Sardouk, A.; Nemar, S.E.; Jaber, D. [13] Gundaboina, L., Badotra, S., & Tanwar, S. (2022,
Forecasting a Stock Trend Using Genetic Algorithm March). Reducing resource and energy consumption in
and Random Forest. J. Risk Financial Manag. 2022, 15, cryptocurrency mining by using both proof-of-stake
188. https://doi.org/10.3390/jrfm15050188 algorithm and renewable energy. In 2022 International
Mobile and Embedded Technology Conference
[4] de Almeida, Bernardo Jubert, Rui Ferreira Neves, and (MECON) (pp. 605-610). IEEE.
Nuno Horta. “Combining Support Vector Machine with
Genetic Algorithms to optimize investments in Forex [14] Sable, S., Porwal, A., & Singh, U. (2017, April). Stock
markets with high leverage.” Applied Soft Computing price prediction using genetic algorithms and evolution
64 (2018): 596-613. strategies. In 2017 International conference of
Electronics, Communication and Aerospace
[5] Li, Q., Kamaruddin, N., Yuhaniz, S.S. et al. Forecasting Technology (ICECA) (Vol. 2, pp. 549-553). IEEE.
stock prices changes using long-short term memory
neural network with symbolic genetic programming. [15] Katoch, S., Chauhan, S.S. & Kumar, V. A review on
Sci Rep 14, 422 (2024). genetic algorithm: past, present, and future. Multimed
https://doi.org/10.1038/s41598-023-50783-0 Tools Appl 80, 8091–8126 (2021).
https://doi.org/10.1007/s11042-020-10139-6