IDEAS home Printed from https://ideas.repec.org/a/gam/jmathe/v10y2022i12p2001-d835568.html
   My bibliography  Save this article

Trading Stocks Based on Financial News Using Attention Mechanism

Author

Listed:
  • Saurabh Kamal

    (Engineering and Technology Department, Liverpool John Moores University, Liverpool L3 5UX, UK)

  • Sahil Sharma

    (Computer Science and Engineering Department, Thapar Institute of Engineering and Technology, Patiala 147004, India)

  • Vijay Kumar

    (Computer Science and Engineering Department, National Institute of Technology, Hamirpur 177005, India)

  • Hammam Alshazly

    (Faculty of Computers and Information, South Valley University, Qena 83523, Egypt)

  • Hany S. Hussein

    (Electrical Engineering Department, College of Engineering, King Khalid University, Abha 62529, Saudi Arabia
    Electrical Engineering Department, Faculty of Engineering, Aswan University, Aswan 81528, Egypt)

  • Thomas Martinetz

    (Institute for Neuro- and Bioinformatics, University of Lübeck, 23562 Lübeck, Germany)

Abstract

Sentiment analysis of news headlines is an important factor that investors consider when making investing decisions. We claim that the sentiment analysis of financial news headlines impacts stock market values. Hence financial news headline data are collected along with the stock market investment data for a period of time. Using Valence Aware Dictionary and Sentiment Reasoning (VADER) for sentiment analysis, the correlation between the stock market values and sentiments in news headlines is established. In our experiments, the data on stock market prices are collected from Yahoo Finance and Kaggle. Financial news headlines are collected from the Wall Street Journal, Washington Post, and Business-Standard website. To cope with such a massive volume of data and extract useful information, various embedding methods, such as Bag-of-words (BoW) and Term Frequency-Inverse Document Frequency (TF-IDF), are employed. These are then fed into machine learning models such as Naive Bayes and XGBoost as well as deep learning models such as Convolutional Neural Network (CNN) and Long Short-Term Memory (LSTM). Various natural language processing, andmachine and deep learning algorithms are considered in our study to achieve the desired outcomes and to attain superior accuracy than the current state-of-the-art. Our experimental study has shown that CNN (80.86%) and LSTM (84%) are the best performing models in relation to machine learning models, such as Support Vector Machine (SVM) (50.3%), Random Forest (67.93%), and Naive Bayes (59.79%). Moreover, two novel methods, BERT and RoBERTa, were applied with the expectation of better performance than all the other models, and they did exceptionally well by achieving an accuracy of 90% and 88%, respectively.

Suggested Citation

  • 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.
  • Handle: RePEc:gam:jmathe:v:10:y:2022:i:12:p:2001-:d:835568
    as

    Download full text from publisher

    File URL: https://www.mdpi.com/2227-7390/10/12/2001/pdf
    Download Restriction: no

    File URL: https://www.mdpi.com/2227-7390/10/12/2001/
    Download Restriction: no
    ---><---

    References listed on IDEAS

    as
    1. Hyunyoung Choi & Hal Varian, 2012. "Predicting the Present with Google Trends," The Economic Record, The Economic Society of Australia, vol. 88(s1), pages 2-9, June.
    2. Huicheng Liu, 2018. "Leveraging Financial News for Stock Trend Prediction with Attention-Based Recurrent Neural Network," Papers 1811.06173, arXiv.org.
    3. Hewamalage, Hansika & Bergmeir, Christoph & Bandara, Kasun, 2021. "Recurrent Neural Networks for Time Series Forecasting: Current status and future directions," International Journal of Forecasting, Elsevier, vol. 37(1), pages 388-427.
    4. Tim Loughran & Bill Mcdonald, 2011. "When Is a Liability Not a Liability? Textual Analysis, Dictionaries, and 10‐Ks," Journal of Finance, American Finance Association, vol. 66(1), pages 35-65, February.
    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. Zhishuo Zhang & Manting Luo & Ziyu Luo & Huayong Niu, 2022. "The International City Image of Beijing: A Quantitative Analysis Based on Twitter Texts from 2017–2021," Sustainability, MDPI, vol. 14(17), pages 1-21, August.

    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. Leif Anders Thorsrud, 2016. "Nowcasting using news topics Big Data versus big bank," Working Papers No 6/2016, Centre for Applied Macro- and Petroleum economics (CAMP), BI Norwegian Business School.
    2. Youngjoon Lee & Soohyon Kim & Ki Young Park, 2018. "Deciphering Monetary Policy Committee Minutes with Text Mining Approach: A Case of South Korea," Working papers 2018rwp-132, Yonsei University, Yonsei Economics Research Institute.
    3. Stolbov, Mikhail & Shchepeleva, Maria & Karminsky, Alexander, 2022. "When central bank research meets Google search: A sentiment index of global financial stress," Journal of International Financial Markets, Institutions and Money, Elsevier, vol. 81(C).
    4. Ali Kabiri & Harold James & John Landon‐Lane & David Tuckett & Rickard Nyman, 2023. "The role of sentiment in the US economy: 1920 to 1934," Economic History Review, Economic History Society, vol. 76(1), pages 3-30, February.
    5. Young Joon Lee & Soohyon Kim & Ki Young Park, 2019. "Deciphering Monetary Policy Board Minutes with Text Mining: The Case of South Korea," Korean Economic Review, Korean Economic Association, vol. 35, pages 471-511.
    6. Patrick Houlihan & Germán G. Creamer, 2021. "Leveraging Social Media to Predict Continuation and Reversal in Asset Prices," Computational Economics, Springer;Society for Computational Economics, vol. 57(2), pages 433-453, February.
    7. Mikhail Stolbov & Maria Shchepeleva, 2023. "Sentiment-based indicators of real estate market stress and systemic risk: international evidence," Annals of Finance, Springer, vol. 19(3), pages 355-382, September.
    8. Zongwu Cai & Pixiong Chen, 2022. "New Online Investor Sentiment and Asset Returns," WORKING PAPERS SERIES IN THEORETICAL AND APPLIED ECONOMICS 202216, University of Kansas, Department of Economics, revised Nov 2022.
    9. Ali Kabiri & Harold James & John Landon-Lane & David Tuckett & Rickard Nyman, 2020. "The Role of Sentiment in the Economy: 1920 to 1934," CESifo Working Paper Series 8336, CESifo.
    10. Patrick Houlihan & Germán G. Creamer, 2017. "Can Sentiment Analysis and Options Volume Anticipate Future Returns?," Computational Economics, Springer;Society for Computational Economics, vol. 50(4), pages 669-685, December.
    11. Yanjian Zhu & Zhaoying Wu & Hua Zhang & Jing Yu, 2017. "Media sentiment, institutional investors and probability of stock price crash: evidence from Chinese stock markets," Accounting and Finance, Accounting and Finance Association of Australia and New Zealand, vol. 57(5), pages 1635-1670, December.
    12. Matthew Gentzkow & Bryan T. Kelly & Matt Taddy, 2017. "Text as Data," NBER Working Papers 23276, National Bureau of Economic Research, Inc.
    13. Fulop, Andras & Kocsis, Zalan, 2023. "News indices on country fundamentals," Journal of Banking & Finance, Elsevier, vol. 154(C).
    14. Mioara, POPESCU, 2015. "Construction Of Economic Indicators Using Internet Searches," Annals of Spiru Haret University, Economic Series, Universitatea Spiru Haret, vol. 6(1), pages 25-31.
    15. Gu, Chen & Kurov, Alexander & Wolfe, Marketa Halova, 2018. "Relief Rallies after FOMC Announcements as a Resolution of Uncertainty," Journal of Empirical Finance, Elsevier, vol. 49(C), pages 1-18.
    16. Francesco Capozza & Ingar Haaland & Christopher Roth & Johannes Wohlfart, 2021. "Studying Information Acquisition in the Field: A Practical Guide and Review," CEBI working paper series 21-15, University of Copenhagen. Department of Economics. The Center for Economic Behavior and Inequality (CEBI).
    17. Tommaso Colussi & Ingo E. Isphording & Nico Pestel, 2021. "Minority Salience and Political Extremism," American Economic Journal: Applied Economics, American Economic Association, vol. 13(3), pages 237-271, July.
    18. Müller, Karsten, 2020. "German forecasters' narratives: How informative are German business cycle forecast reports?," Working Papers 23, German Research Foundation's Priority Programme 1859 "Experience and Expectation. Historical Foundations of Economic Behaviour", Humboldt University Berlin.
    19. David W Carter & Scott Crosson & Christopher Liese, 2015. "Nowcasting Intraseasonal Recreational Fishing Harvest with Internet Search Volume," PLOS ONE, Public Library of Science, vol. 10(9), pages 1-18, September.
    20. Aaryan Gupta & Vinya Dengre & Hamza Abubakar Kheruwala & Manan Shah, 2020. "Comprehensive review of text-mining applications in finance," Financial Innovation, Springer;Southwestern University of Finance and Economics, vol. 6(1), pages 1-25, December.

    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:gam:jmathe:v:10:y:2022:i:12:p:2001-:d:835568. 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: MDPI Indexing Manager (email available below). General contact details of provider: https://www.mdpi.com .

    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.