Touzani Yassine, Douzi Khadija
Computer Lab of Mohammedia, Faculty of Science and Technology of Mohammedia, Hassan II university, Mohammedia, Morocco.
J Big Data. 2021;8(1):126. doi: 10.1186/s40537-021-00512-z. Epub 2021 Sep 24.
Forecasting stock prices is an extremely challenging job considering the high volatility and the number of variables that influence it (political, economical, social, etc.). Predicting the closing price provides useful information and helps the investor make the right decision. The use of deep learning and more precisely of recurrent neural networks (RNNs) in stock market forecasting is an increasingly common practice in the literature. Long Short Term Memory (LSTM) and Gated Recurrent Unit (GRU) architectures are among the most widely used types of RNNs, given their suitability for sequential data. In this paper, we propose a trading strategy designed for the Moroccan stock market, based on two deep learning models: LSTM and GRU to predict the closing price in the short and medium term respectively. Decision rules for buying and selling stocks are implemented based on the forecasting given by the two models, then over four 3-year periods, we simulate transactions using these decision rules with different settings for each stock. The returns obtained will be used to estimate an expected return. We only hold stocks that outperform a benchmark index (expected return > threshold). The random search is then used to choose one of the available parameters and the performance of the portfolio built from the selected stocks will be tested over a further period. The repetition of this process with a variation of portfolio size makes it possible to select the best possible combination of stock each with the optimized parameter for the decision rules. The proposed strategy produces very promising results and outperforms the performance of indices used as benchmarks in the local market. Indeed, the annualized return of our strategy proposed during the test period is 27.13%, while it is 0.43% for Moroccan all share Indice (MASI), 15.24% for the distributor sector indices, and 19.94% for the pharmaceutical industry indices. Noted that brokerage fees are estimated and subtracted for each transaction. which makes the performance found even more realistic.
考虑到股票价格的高波动性以及影响它的众多变量(政治、经济、社会等),预测股票价格是一项极具挑战性的工作。预测收盘价可提供有用信息,并帮助投资者做出正确决策。在股票市场预测中使用深度学习,更确切地说是循环神经网络(RNN),在文献中已越来越普遍。长短期记忆(LSTM)和门控循环单元(GRU)架构是最广泛使用的RNN类型,因为它们适用于序列数据。在本文中,我们基于两种深度学习模型:LSTM和GRU,分别用于预测短期和中期收盘价,提出了一种针对摩洛哥股票市场设计的交易策略。基于这两种模型给出的预测结果实施买卖股票的决策规则,并在四个3年期间,我们使用这些决策规则针对每只股票的不同设置模拟交易。所获得的回报将用于估计预期回报。我们只持有表现优于基准指数(预期回报>阈值)的股票。然后使用随机搜索来选择可用参数之一,并在更长时期内测试从选定股票构建的投资组合的表现。随着投资组合规模的变化重复此过程,就有可能选择每只股票的最佳组合以及决策规则的优化参数。所提出的策略产生了非常有前景的结果,并且优于当地市场用作基准的指数表现。事实上,在测试期间我们提出的策略的年化回报率为27.13%,而摩洛哥全股指数(MASI)为0.43%,分销部门指数为15.24%,制药行业指数为19.94%。请注意,每次交易都估算并扣除了经纪费。这使得所发现的表现更加现实。