Forecasting financial markets using the random forest algorithm

Authors

DOI:

https://doi.org/10.31498/2225-6733.47.2023.299987

Keywords:

machine learning, Python, Randomforestregressor, Scikit-Learn, training sample, mean square error

Abstract

The article provides material on the analysis of the financial market using the random forest algorithm. The general problem of forecasting financial markets and the role of modern technologies for accurate forecasts and automation of trading strategies are considered. An overview of existing forecasting models and the possibility of their application for financial markets was conducted. The latest studies and publications were analyzed, on the basis of which a research program was developed. The created program has a modular structure and represents a library that can be used for further research. A neural network was built and trained, which, using a random forest algorithm, can perform analysis over a certain period and provide predictions. As part of the research, open data and an analysis of the Apple company were used. During the experiments, an analysis of the accuracy of the model under the influence of hyperparameters, an analysis of the model's operation under different market conditions, a comparison with other forecasting methods, and an analysis of the impact of the amount of data on the accuracy of the model were made. Several neural network mathematical models were built for market forecasting. After that, they were trained on the selected datasets. For training, information was taken for a long period of time, data for quarters, daily profit, profit for a year. The software was written in Python, a number of libraries were used, namely yfinance, Sklearn-Scikit-learn, Matplotlib.pyplot, Pandas. Experimental studies compared the results of different approaches to analysis. Models using the random forest method and the linear regression model were compared, proving the feasibility of using the random die method for this type of problem. With the help of graphs, the metrics are demonstrated and the root mean square errors are derived. To determine the adequacy of the work of the developed neural network, testing was conducted to identify errors when compared with other markets

Author Biographies

A.V. Serhiienko, State Higher Education Institution "Priazovskyi state technical university", Dnipro

PhD (Engineering)

V.R. Bashkiser, State Higher Education Institution "Priazovskyi state technical university", Dnipro

Master's student

D.V. Sushchevsky, Dnipro University of Technology, Dnipro

PhD (Engineering), associate professor

Ya.V. Panferova, Dnipro University of Technology, Dnipro

Assistant

References

Poon S.H., Granger C.W. Forecasting volatility in financial markets: A review. Journal of economic literature. 2003. Vol. 41(2). Pp. 478-539. DOI: https://doi.org/10.1257/002205103765762743.

Moody J., Saffell M. Learning to trade via direct reinforcement. IEEE Transactions on Neural Networks. 2001. Vol. 12. Iss. 4. Pp. 875-889. DOI: https://doi.org/10.1109/72.935097.

Géron A. Hands-on machine learning with Scikit-Learn, Keras, and TensorFlow: concepts, tools, and techniques to build intelligent systems. 2nd ed. O'Reilly Media. 2019. 856 p.

Mitchell M. Artificial intelligence: a guide for thinking humans. Farrar, Straus and Giroux, 2019. 336 p.

Goldberg D. Universe! A course in survival among black holes, time paradoxes, quantum uncertainty, 2016. 264 p.

Smith M.D., Telang R. Streaming, sharing, stealing : big data and the future of entertainment. 2016. Cambridge, MA : MIT Press. 232 p.

Graduate studies in mathematics. American Mathematical Society, 2018. Vol. 195: Combinatorial reciprocity theorems: an invitation to enumerative geometric combinatorics / M. Beck, R. Sanyal. 312 p.

Commons M.L., Goldberg D. Clinical Approaches to Adult Development. 1996. 372 p.

Published

2023-12-28

How to Cite

Serhiienko, A. ., Bashkiser, V. ., Sushchevsky, D. ., & Panferova, Y. . (2023). Forecasting financial markets using the random forest algorithm. Reporter of the Priazovskyi State Technical University. Section: Technical Sciences, (47), 100–108. https://doi.org/10.31498/2225-6733.47.2023.299987