Stock Movement Prediction from Tweets and Historical Prices

Yumo Xu, Shay B. Cohen

Abstract

Predicting stock market movements is a complex task due to the high stochasticity of markets and the noisy nature of social media data. This paper introduces StockNet, a deep generative model designed to forecast stock price trends by integrating Twitter sentiment with historical price data. StockNet addresses market randomness through a variational auto-encoder framework and captures temporal dependencies using a novel "temporal auxiliary" objective. Experimental results on a large-scale dataset of 88 high-volume stocks demonstrate that StockNet significantly outperforms existing discriminative models, achieving an accuracy of 58.23% and a Matthews Correlation Coefficient (MCC) of 0.0808.

Introduction

The efficient market hypothesis suggests that stock prices reflect all available information, making future movements appear as a "random walk." However, the rapid dissemination of news via social media platforms like Twitter provides a rich, albeit noisy, source of information that can signal market shifts before they are fully reflected in prices. Traditional models often struggle with three key challenges: the inherent stochasticity of markets, the chaotic nature of social media text, and the complex temporal dependencies where events impact prices over several days.

To address these challenges, researchers from the University of Edinburgh developed StockNet. Unlike standard discriminative models that directly map inputs to outputs, StockNet is a generative model that infers latent factors driving market behavior, providing a more robust framework for handling uncertainty and noise.

Methodology: The StockNet Architecture

StockNet is composed of three integrated modules designed to process multi-modal data and model temporal dynamics.

Overview of the StockNet architecture including the Market Information Encoder (MIE), Variational Movement Decoder (VMD), and Attentive Temporal Auxiliary (ATA).

Market Information Encoder (MIE)

The MIE processes both textual (tweets) and numerical (historical prices) data. It utilizes a Bidirectional Gated Recurrent Unit (Bi-GRU) to create embeddings for tweet text. To filter out irrelevant "chatter," an attention mechanism is employed to prioritize tweets that contain high-signal information relevant to stock movements.

Variational Movement Decoder (VMD)

The VMD treats stock movements as being driven by unobserved latent variables. By implementing a Variational Auto-Encoder (VAE) framework, the model learns a distribution of these latent states. This approach allows StockNet to better accommodate the "random walk" nature of the market by modeling the uncertainty inherent in price predictions rather than attempting a deterministic mapping.

Attentive Temporal Auxiliary (ATA)

The ATA module is designed to capture the ripple effects of news events. Instead of focusing solely on a single target day, the model generates auxiliary predictions for each day within a 5-day "lag window." A temporal attention mechanism then learns to weigh these prior days based on their relevance to the final prediction, effectively denoising the input and focusing on persistent trends.

Experimental Setup

The researchers curated a comprehensive dataset consisting of 88 high-volume stocks from nine different industries over a two-year period (2014-2016). Data was sourced from the Twitter API, using NASDAQ ticker symbols (e.g., $AAPL, $GOOG) for filtering, and historical prices were obtained from Yahoo Finance.

The task was framed as a binary classification problem: predicting whether a stock price would rise or fall. To ensure the model learned from significant signals, "minor" price movements (between -0.5% and 0.55%) were excluded, resulting in a balanced dataset of approximately 26,000 prediction targets.

Results and Discussion

The performance of StockNet, specifically the "HedgeFundAnalyst" configuration, was compared against several baselines, including traditional statistical models (ARIMA), random forests, and state-of-the-art neural networks like the Hierarchical Attention Network (HAN).

Comparison of StockNet variations against baseline models in terms of Accuracy and MCC.

StockNet achieved a top accuracy of 58.23%, surpassing the previous best of 57.64% held by HAN. More significantly, its Matthews Correlation Coefficient (MCC) reached 0.0808, a substantial leap over the 0.0518 achieved by HAN. In the context of financial forecasting, these improvements are highly significant and suggest that the generative approach is better suited for capturing the nuances of market volatility.

Ablation studies revealed that the "Fundamental Analyst" version of the model, which relies solely on tweet data, performed remarkably well. This underscores the power of social sentiment as a leading indicator for short-term stock movements, provided the model can effectively filter noise.

Conclusion

StockNet represents a significant advancement in financial sentiment analysis by combining deep generative modeling with temporal attention. By treating market states as latent variables and accounting for the multi-day impact of news, the model provides a more resilient framework for stock prediction. Future work may involve incorporating structured event extraction to better understand the specific causes of market shifts and extending the temporal window to capture longer-term market cycles.

Summary updated

BibTeX
@inproceedings{xu2018stock,
  author = {Yumo Xu and Shay B. Cohen},
  title = {{Stock Movement Prediction from Tweets and Historical Prices}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2018},
  doi = {10.18653/v1/p18-1183},
}
Figure