IDEAS home Printed from https://ideas.repec.org/p/arx/papers/2308.16771.html
   My bibliography  Save this paper

Linking microblogging sentiments to stock price movement: An application of GPT-4

Author

Listed:
  • Rick Steinert
  • Saskia Altmann

Abstract

This paper investigates the potential improvement of the GPT-4 Language Learning Model (LLM) in comparison to BERT for modeling same-day daily stock price movements of Apple and Tesla in 2017, based on sentiment analysis of microblogging messages. We recorded daily adjusted closing prices and translated them into up-down movements. Sentiment for each day was extracted from messages on the Stocktwits platform using both LLMs. We develop a novel method to engineer a comprehensive prompt for contextual sentiment analysis which unlocks the true capabilities of modern LLM. This enables us to carefully retrieve sentiments, perceived advantages or disadvantages, and the relevance towards the analyzed company. Logistic regression is used to evaluate whether the extracted message contents reflect stock price movements. As a result, GPT-4 exhibited substantial accuracy, outperforming BERT in five out of six months and substantially exceeding a naive buy-and-hold strategy, reaching a peak accuracy of 71.47 % in May. The study also highlights the importance of prompt engineering in obtaining desired outputs from GPT-4's contextual abilities. However, the costs of deploying GPT-4 and the need for fine-tuning prompts highlight some practical considerations for its use.

Suggested Citation

  • Rick Steinert & Saskia Altmann, 2023. "Linking microblogging sentiments to stock price movement: An application of GPT-4," Papers 2308.16771, arXiv.org.
  • Handle: RePEc:arx:papers:2308.16771
    as

    Download full text from publisher

    File URL: http://arxiv.org/pdf/2308.16771
    File Function: Latest version
    Download Restriction: no
    ---><---

    References listed on IDEAS

    as
    1. Steve Y. Yang & Sheung Yin Kevin Mo & Anqi Liu, 2015. "Twitter financial community sentiment and its predictive relationship to stock market movement," Quantitative Finance, Taylor & Francis Journals, vol. 15(10), pages 1637-1656, October.
    2. Markus Leippold, 2023. "Sentiment Spin: Attacking Financial Sentiment with GPT-3," Swiss Finance Institute Research Paper Series 23-11, Swiss Finance Institute.
    3. Haohan Zhang & Fengrui Hua & Chengjin Xu & Jian Guo & Hao Kong & Ruiting Zuo, 2023. "Unveiling the Potential of Sentiment: Can Large Language Models Predict Chinese Stock Price Movements?," Papers 2306.14222, arXiv.org.
    4. Fama, Eugene F, 1970. "Efficient Capital Markets: A Review of Theory and Empirical Work," Journal of Finance, American Finance Association, vol. 25(2), pages 383-417, May.
    5. Alejandro Lopez-Lira & Yuehua Tang, 2023. "Can ChatGPT Forecast Stock Price Movements? Return Predictability and Large Language Models," Papers 2304.07619, arXiv.org, revised Sep 2023.
    6. Leippold, Markus, 2023. "Sentiment spin: Attacking financial sentiment with GPT-3," Finance Research Letters, Elsevier, vol. 55(PB).
    7. Jiang, Hao & Li, Sophia Zhengzi & Wang, Hao, 2021. "Pervasive underreaction: Evidence from high-frequency data," Journal of Financial Economics, Elsevier, vol. 141(2), pages 573-599.
    8. Gabriele Ranco & Darko Aleksovski & Guido Caldarelli & Miha Grčar & Igor Mozetič, 2015. "The Effects of Twitter Sentiment on Stock Price Returns," PLOS ONE, Public Library of Science, vol. 10(9), pages 1-21, September.
    9. Mukul Jaggi & Priyanka Mandal & Shreya Narang & Usman Naseem & Matloob Khushi, 2021. "Text Mining of Stocktwits Data for Predicting Stock Prices," Papers 2103.16388, arXiv.org.
    10. R. Cont, 2001. "Empirical properties of asset returns: stylized facts and statistical issues," Quantitative Finance, Taylor & Francis Journals, vol. 1(2), pages 223-236.
    11. Guillaume Coqueret, 2020. "Stock-specific sentiment and return predictability," Quantitative Finance, Taylor & Francis Journals, vol. 20(9), pages 1531-1551, September.
    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. Deborah Miori & Constantin Petrov, 2023. "Narratives from GPT-derived Networks of News, and a link to Financial Markets Dislocations," Papers 2311.14419, 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. Liping Wang & Jiawei Li & Lifan Zhao & Zhizhuo Kou & Xiaohan Wang & Xinyi Zhu & Hao Wang & Yanyan Shen & Lei Chen, 2023. "Methods for Acquiring and Incorporating Knowledge into Stock Price Prediction: A Survey," Papers 2308.04947, arXiv.org.
    2. Zachary McGurk & Adam Nowak & Joshua C. Hall, 2020. "Stock returns and investor sentiment: textual analysis and social media," Journal of Economics and Finance, Springer;Academy of Economics and Finance, vol. 44(3), pages 458-485, July.
    3. Yousaf, Imran & Youssef, Manel & Goodell, John W., 2022. "Quantile connectedness between sentiment and financial markets: Evidence from the S&P 500 twitter sentiment index," International Review of Financial Analysis, Elsevier, vol. 83(C).
    4. Muchnik, Lev & Bunde, Armin & Havlin, Shlomo, 2009. "Long term memory in extreme returns of financial time series," Physica A: Statistical Mechanics and its Applications, Elsevier, vol. 388(19), pages 4145-4150.
    5. Bariviera, Aurelio F. & Font-Ferrer, Alejandro & Sorrosal-Forradellas, M. Teresa & Rosso, Osvaldo A., 2019. "An information theory perspective on the informational efficiency of gold price," The North American Journal of Economics and Finance, Elsevier, vol. 50(C).
    6. Klein, A. & Urbig, D. & Kirn, S., 2008. "Who Drives the Market? Estimating a Heterogeneous Agent-based Financial Market Model Using a Neural Network Approach," MPRA Paper 14433, University Library of Munich, Germany.
    7. David Vidal-Tomás & Simone Alfarano, 2020. "An agent-based early warning indicator for financial market instability," Journal of Economic Interaction and Coordination, Springer;Society for Economic Science with Heterogeneous Interacting Agents, vol. 15(1), pages 49-87, January.
    8. Semei Coronado-Ram'irez & Pedro Celso-Arellano & Omar Rojas, 2014. "Adaptive Market Efficiency of Agricultural Commodity Futures Contracts," Papers 1412.8017, arXiv.org, revised Mar 2015.
    9. Sandrine Jacob Leal & Mauro Napoletano & Andrea Roventini & Giorgio Fagiolo, 2016. "Rock around the clock: An agent-based model of low- and high-frequency trading," Journal of Evolutionary Economics, Springer, vol. 26(1), pages 49-76, March.
    10. Makowiec, D. & Gnaciński, P. & Miklaszewski, W., 2004. "Amplified imitation in percolation model of stock market," Physica A: Statistical Mechanics and its Applications, Elsevier, vol. 331(1), pages 269-278.
    11. Neto, David, 2021. "Are Google searches making the Bitcoin market run amok? A tail event analysis," The North American Journal of Economics and Finance, Elsevier, vol. 57(C).
    12. Oussama Tilfani & My Youssef El Boukfaoui, 2020. "Multifractal Analysis of African Stock Markets During the 2007–2008 US Crisis," Review of Pacific Basin Financial Markets and Policies (RPBFMP), World Scientific Publishing Co. Pte. Ltd., vol. 22(04), pages 1-31, January.
    13. Yudong Wang & Chongfeng Wu, 2013. "Efficiency of Crude Oil Futures Markets: New Evidence from Multifractal Detrending Moving Average Analysis," Computational Economics, Springer;Society for Computational Economics, vol. 42(4), pages 393-414, December.
    14. Torsten Trimborn & Philipp Otte & Simon Cramer & Maximilian Beikirch & Emma Pabich & Martin Frank, 2020. "SABCEMM: A Simulator for Agent-Based Computational Economic Market Models," Computational Economics, Springer;Society for Computational Economics, vol. 55(2), pages 707-744, February.
    15. Onali, Enrico & Goddard, John, 2011. "Are European equity markets efficient? New evidence from fractal analysis," International Review of Financial Analysis, Elsevier, vol. 20(2), pages 59-67, April.
    16. Andrea Di Iura & Giulia Terenzi, 2022. "A Bayesian analysis of gain-loss asymmetry," SN Business & Economics, Springer, vol. 2(5), pages 1-23, May.
    17. Johann Lussange & Stefano Vrizzi & Sacha Bourgeois-Gironde & Stefano Palminteri & Boris Gutkin, 2023. "Stock Price Formation: Precepts from a Multi-Agent Reinforcement Learning Model," Computational Economics, Springer;Society for Computational Economics, vol. 61(4), pages 1523-1544, April.
    18. Ashok Chanabasangouda Patil & Shailesh Rastogi, 2020. "Multifractal Analysis of Market Efficiency across Structural Breaks: Implications for the Adaptive Market Hypothesis," JRFM, MDPI, vol. 13(10), pages 1-18, October.
    19. Johann Lussange & Ivan Lazarevich & Sacha Bourgeois-Gironde & Stefano Palminteri & Boris Gutkin, 2021. "Modelling Stock Markets by Multi-agent Reinforcement Learning," Computational Economics, Springer;Society for Computational Economics, vol. 57(1), pages 113-147, January.
    20. Jimei Shen & Zhehu Yuan & Yifan Jin, 2022. "AlphaMLDigger: A Novel Machine Learning Solution to Explore Excess Return on Investment," Papers 2206.11072, arXiv.org, revised Dec 2022.

    More about this item

    NEP fields

    This paper has been announced in the following NEP Reports:

    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:arx:papers:2308.16771. 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: arXiv administrators (email available below). General contact details of provider: http://arxiv.org/ .

    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.