IDEAS home Printed from https://ideas.repec.org/a/plo/pone00/0227222.html
   My bibliography  Save this article

Forecasting stock prices with long-short term memory neural network based on attention mechanism

Author

Listed:
  • Jiayu Qiu
  • Bin Wang
  • Changjun Zhou

Abstract

The stock market is known for its extreme complexity and volatility, and people are always looking for an accurate and effective way to guide stock trading. Long short-term memory (LSTM) neural networks are developed by recurrent neural networks (RNN) and have significant application value in many fields. In addition, LSTM avoids long-term dependence issues due to its unique storage unit structure, and it helps predict financial time series. Based on LSTM and an attention mechanism, a wavelet transform is used to denoise historical stock data, extract and train its features, and establish the prediction model of a stock price. We compared the results with the other three models, including the LSTM model, the LSTM model with wavelet denoising and the gated recurrent unit(GRU) neural network model on S&P 500, DJIA, HSI datasets. Results from experiments on the S&P 500 and DJIA datasets show that the coefficient of determination of the attention-based LSTM model is both higher than 0.94, and the mean square error of our model is both lower than 0.05.

Suggested Citation

  • Jiayu Qiu & Bin Wang & Changjun Zhou, 2020. "Forecasting stock prices with long-short term memory neural network based on attention mechanism," PLOS ONE, Public Library of Science, vol. 15(1), pages 1-15, January.
  • Handle: RePEc:plo:pone00:0227222
    DOI: 10.1371/journal.pone.0227222
    as

    Download full text from publisher

    File URL: https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0227222
    Download Restriction: no

    File URL: https://journals.plos.org/plosone/article/file?id=10.1371/journal.pone.0227222&type=printable
    Download Restriction: no

    File URL: https://libkey.io/10.1371/journal.pone.0227222?utm_source=ideas
    LibKey link: if access is restricted and if your library uses this service, LibKey will redirect you to where you can use your library subscription to access this item
    ---><---

    References listed on IDEAS

    as
    1. Diego Ardila & Didier Sornette, 2016. "Dating the Financial Cycle: A Wavelet Proposition," Swiss Finance Institute Research Paper Series 16-29, Swiss Finance Institute, revised May 2016.
    2. Ardila, Diego & Sornette, Didier, 2016. "Dating the financial cycle with uncertainty estimates: a wavelet proposition," Finance Research Letters, Elsevier, vol. 19(C), pages 298-304.
    3. Huicheng Liu, 2018. "Leveraging Financial News for Stock Trend Prediction with Attention-Based Recurrent Neural Network," Papers 1811.06173, arXiv.org.
    Full references (including those not matched with items on IDEAS)

    Citations

    Citations are extracted by the CitEc Project, subscribe to its RSS feed for this item.
    as


    Cited by:

    1. Qihang Zhou & Changjun Zhou & Xiao Wang, 2022. "Stock prediction based on bidirectional gated recurrent unit with convolutional neural network and feature selection," PLOS ONE, Public Library of Science, vol. 17(2), pages 1-20, February.
    2. Conall Butler & Martin Crane, 2023. "Blockchain Transaction Fee Forecasting: A Comparison of Machine Learning Methods," Mathematics, MDPI, vol. 11(9), pages 1-26, May.
    3. Dhruhi Sheth & Manan Shah, 2023. "Predicting stock market using machine learning: best and accurate way to know future stock prices," International Journal of System Assurance Engineering and Management, Springer;The Society for Reliability, Engineering Quality and Operations Management (SREQOM),India, and Division of Operation and Maintenance, Lulea University of Technology, Sweden, vol. 14(1), pages 1-18, February.
    4. Xiaodong Zhang & Suhui Liu & Xin Zheng, 2021. "Stock Price Movement Prediction Based on a Deep Factorization Machine and the Attention Mechanism," Mathematics, MDPI, vol. 9(8), pages 1-21, April.
    5. Janusz Gajda & Rafał Walasek, 2020. "Fractional differentiation and its use in machine learning," Working Papers 2020-32, Faculty of Economic Sciences, University of Warsaw.
    6. Jaydip Sen & Saikat Mondal & Gourab Nath, 2022. "Robust Portfolio Design and Stock Price Prediction Using an Optimized LSTM Model," Papers 2204.01850, arXiv.org.
    7. Akash Doshi & Alexander Issa & Puneet Sachdeva & Sina Rafati & Somnath Rakshit, 2020. "Deep Stock Predictions," Papers 2006.04992, arXiv.org.
    8. Wu, Ling & Hock Ow, Siew, 2021. "The Impact of News Sentiment on the Stock Market Fluctuation: The Case of Selected Energy Sector," Jurnal Ekonomi Malaysia, Faculty of Economics and Business, Universiti Kebangsaan Malaysia, vol. 55(3), pages 1-21.
    9. Yinan Wang & Xiangbing Kong & Kai Guo & Chunjing Zhao & Jintao Zhao, 2023. "Intelligent Extraction of Terracing Using the ASPP ArrU-Net Deep Learning Model for Soil and Water Conservation on the Loess Plateau," Agriculture, MDPI, vol. 13(7), pages 1-23, June.
    10. Yiqi Deng & Siu Ming Yiu, 2022. "Deep Multiple Instance Learning For Forecasting Stock Trends Using Financial News," Papers 2206.14452, arXiv.org.
    11. Lorenzo Menculini & Andrea Marini & Massimiliano Proietti & Alberto Garinei & Alessio Bozza & Cecilia Moretti & Marcello Marconi, 2021. "Comparing Prophet and Deep Learning to ARIMA in Forecasting Wholesale Food Prices," Forecasting, MDPI, vol. 3(3), pages 1-19, September.
    12. Stefenon, Stefano Frizzo & Seman, Laio Oriel & Aquino, Luiza Scapinello & Coelho, Leandro dos Santos, 2023. "Wavelet-Seq2Seq-LSTM with attention for time series forecasting of level of dams in hydroelectric power plants," Energy, Elsevier, vol. 274(C).
    13. Cheng Zhang & Nilam Nur Amir Sjarif & Roslina Ibrahim, 2023. "Deep learning models for price forecasting of financial time series: A review of recent advancements: 2020-2022," Papers 2305.04811, arXiv.org, revised Sep 2023.
    14. Luca Di Persio & Matteo Garbelli & Kai Wallbaum, 2021. "Forward-Looking Volatility Estimation for Risk-Managed Investment Strategies during the COVID-19 Crisis," Risks, MDPI, vol. 9(2), pages 1-16, February.
    15. Shruthi Komarla Rammurthy & Sagar B. Patil, 2021. "An LSTM-Based Approach to Predict Stock Price Movement for IT Sector Companies," International Journal of Cognitive Informatics and Natural Intelligence (IJCINI), IGI Global, vol. 15(4), pages 1-12, October.
    16. Jaydip Sen & Abhishek Dutta, 2022. "A Comparative Study of Hierarchical Risk Parity Portfolio and Eigen Portfolio on the NIFTY 50 Stocks," Papers 2210.00984, arXiv.org.
    17. Johanna Karina Solano Meza & David Orjuela Yepes & Javier Rodrigo-Ilarri & María-Elena Rodrigo-Clavero, 2023. "Comparative Analysis of the Implementation of Support Vector Machines and Long Short-Term Memory Artificial Neural Networks in Municipal Solid Waste Management Models in Megacities," IJERPH, MDPI, vol. 20(5), pages 1-20, February.
    18. Gaurang Sonkavde & Deepak Sudhakar Dharrao & Anupkumar M. Bongale & Sarika T. Deokate & Deepak Doreswamy & Subraya Krishna Bhat, 2023. "Forecasting Stock Market Prices Using Machine Learning and Deep Learning Models: A Systematic Review, Performance Analysis and Discussion of Implications," IJFS, MDPI, vol. 11(3), pages 1-22, July.
    19. Subba Rao Polamuri & K. Srinnivas & A. Krishna Mohan, 2023. "Prediction of stock price growth for novel greedy heuristic optimized multi-instances quantitative (NGHOMQ)," International Journal of System Assurance Engineering and Management, Springer;The Society for Reliability, Engineering Quality and Operations Management (SREQOM),India, and Division of Operation and Maintenance, Lulea University of Technology, Sweden, vol. 14(1), pages 353-366, February.
    20. Ziyuan Xia & Jeffery Chen & Anchen Sun, 2021. "Mining the Relationship Between COVID-19 Sentiment and Market Performance," Papers 2101.02587, arXiv.org, revised Mar 2023.
    21. Firuz Kamalov & Linda Smail & Ikhlaas Gurrib, 2021. "Stock price forecast with deep learning," Papers 2103.14081, arXiv.org.
    22. Ghosh, Pushpendu & Neufeld, Ariel & Sahoo, Jajati Keshari, 2022. "Forecasting directional movements of stock prices for intraday trading using LSTM and random forests," Finance Research Letters, Elsevier, vol. 46(PA).
    23. Chu Myaet Thwal & Ye Lin Tun & Kitae Kim & Seong-Bae Park & Choong Seon Hong, 2024. "Transformers with Attentive Federated Aggregation for Time Series Stock Forecasting," Papers 2402.06638, arXiv.org.

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Strohsal, Till & Proaño, Christian R. & Wolters, Jürgen, 2019. "Characterizing the financial cycle: Evidence from a frequency domain analysis," Journal of Banking & Finance, Elsevier, vol. 106(C), pages 568-591.
    2. Tran, Thuy Nhung, 2022. "The Volatility of the Stock Market and Financial Cycle: GARCH Family Models," Jurnal Ekonomi Malaysia, Faculty of Economics and Business, Universiti Kebangsaan Malaysia, vol. 56(1), pages 151-168.
    3. Saulius Jokubaitis & Dmitrij Celov, 2022. "Business Cycle Synchronization in the EU: A Regional-Sectoral Look through Soft-Clustering and Wavelet Decomposition," Papers 2206.14128, arXiv.org.
    4. Montserrat Reyna Miranda & Ricardo Massa Roldán & Vicente Gómez Salcido, 2022. "Neuro-wavelet Model for price prediction in high-frequency data in the Mexican Stock market," Remef - Revista Mexicana de Economía y Finanzas Nueva Época REMEF (The Mexican Journal of Economics and Finance), Instituto Mexicano de Ejecutivos de Finanzas, IMEF, vol. 17(1), pages 1-23, Enero - M.
    5. C. Colther & J. L. Rojo & R. Hornero, 2022. "A Wavelet Method for Detecting Turning Points in the Business Cycle," Journal of Business Cycle Research, Springer;Centre for International Research on Economic Tendency Surveys (CIRET), vol. 18(2), pages 171-187, July.
    6. Greg Farrell & Esti Kemp, 2020. "Measuring the Financial Cycle in South Africa," South African Journal of Economics, Economic Society of South Africa, vol. 88(2), pages 123-144, June.
    7. Dalia Mansour-Ibrahim, 2023. "Are the Eurozone Financial and Business Cycles Convergent Across Time and Frequency?," Computational Economics, Springer;Society for Computational Economics, vol. 61(1), pages 389-427, January.
    8. Malgorzata Porada - Rochon, 2020. "The Length of Financial Cycle and its Impact on Business Cycle in Poland," European Research Studies Journal, European Research Studies Journal, vol. 0(4), pages 1278-1290.
    9. Zhihan Zhou & Liqian Ma & Han Liu, 2021. "Trade the Event: Corporate Events Detection for News-Based Event-Driven Trading," Papers 2105.12825, arXiv.org, revised May 2021.
    10. Saurabh Kamal & Sahil Sharma & Vijay Kumar & Hammam Alshazly & Hany S. Hussein & Thomas Martinetz, 2022. "Trading Stocks Based on Financial News Using Attention Mechanism," Mathematics, MDPI, vol. 10(12), pages 1-30, June.
    11. Martin Mandler & Michael Scharnagl, 2022. "Financial Cycles in Euro Area Economies: A Cross‐Country Perspective Using Wavelet Analysis," Oxford Bulletin of Economics and Statistics, Department of Economics, University of Oxford, vol. 84(3), pages 569-593, June.
    12. Yiqi Deng & Siu Ming Yiu, 2022. "Deep Multiple Instance Learning For Forecasting Stock Trends Using Financial News," Papers 2206.14452, arXiv.org.

    More about this item

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:plo:pone00:0227222. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: plosone (email available below). General contact details of provider: https://journals.plos.org/plosone/ .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.