Forecasting financial markets using the random forest algorithm
DOI:
https://doi.org/10.31498/2225-6733.47.2023.299987Keywords:
machine learning, Python, Randomforestregressor, Scikit-Learn, training sample, mean square errorAbstract
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
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.
Downloads
Published
How to Cite
Issue
Section
License
The journal «Reporter of the Priazovskyi State Technical University. Section: Technical sciences» is published under the CC BY license (Attribution License).
This license allows for the distribution, editing, modification, and use of the work as a basis for derivative works, even for commercial purposes, provided that proper attribution is given. It is the most flexible of all available licenses and is recommended for maximum dissemination and use of non-restricted materials.
Authors who publish in this journal agree to the following terms:
1. Authors retain the copyright of their work and grant the journal the right of first publication under the terms of the Creative Commons Attribution License (CC BY). This license allows others to freely distribute the published work, provided that proper attribution is given to the original authors and the first publication of the work in this journal is acknowledged.
2. Authors are allowed to enter into separate, additional agreements for non-exclusive distribution of the work in the same form as published in this journal (e.g., depositing it in an institutional repository or including it in a monograph), provided that a reference to the first publication in this journal is maintained.







