IDEAS home Printed from https://ideas.repec.org/a/wsi/ijfexx/v08y2021i04ns2424786321410115.html
   My bibliography  Save this article

Trading on online social mood: A machine learning strategy based on Twitter sentiment

Author

Listed:
  • Chengying He

    (Sino-UK Blockchain Industry Research Institute, Guangxi University, Nanning, P. R. China)

  • Mason Lin

    (Davidson College Davidson, NC 28035, USA)

  • Ning Wang

    (Oxford Nie Financial Big Data Laboratory, Mathematical Institute, University of Oxford, Oxford, UK)

Abstract

This paper examines the potential of using online social sentiment data in algorithmic trading strategies. Several machine learning models are tested to produce a trading signal from the sentiment data to forecast the trend of a stock’s price. The algorithms are trained on the features extracted from PsychSignal data (containing bullish and bearish sentiment from Twitter). One most popular model, Random Forest (RF) classifier, is selected to generate a signal for the trading strategy. After backtesting on 1386 stocks listed in both NYSE and NASDAQ, the results show that the proposed model outperforms the baseline model, a simple moving average (SMA) strategy. We use the GridSearchCV to fine-tune the parameters of the classifier and compare the performance with the SMA baseline and the SPY benchmark, showing that our model generates 114.5% return on investment from January 2013 through October 2015. Additionally, the portfolios constructed by the RF classifier appear to produce a higher return than portfolios constructed by an SMA strategy. The results show that Twitter sentiment data is a valuable technical trading indicator for specific sectors.

Suggested Citation

  • Chengying He & Mason Lin & Ning Wang, 2021. "Trading on online social mood: A machine learning strategy based on Twitter sentiment," International Journal of Financial Engineering (IJFE), World Scientific Publishing Co. Pte. Ltd., vol. 8(04), pages 1-16, December.
  • Handle: RePEc:wsi:ijfexx:v:08:y:2021:i:04:n:s2424786321410115
    DOI: 10.1142/S2424786321410115
    as

    Download full text from publisher

    File URL: http://www.worldscientific.com/doi/abs/10.1142/S2424786321410115
    Download Restriction: Access to full text is restricted to subscribers

    File URL: https://libkey.io/10.1142/S2424786321410115?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
    ---><---

    As the access to this document is restricted, you may want to search for a different version of it.

    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:wsi:ijfexx:v:08:y:2021:i:04:n:s2424786321410115. 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.

    We have no bibliographic references for this item. You can help adding them by using 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: Tai Tone Lim (email available below). General contact details of provider: http://www.worldscientific.com/worldscinet/ijfe .

    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.