Table of Contents
Fetching ...

Generalized Stock Price Prediction for Multiple Stocks Combined with News Fusion

Pei-Jun Liao, Hung-Shin Lee, Yao-Fei Cheng, Li-Wei Chen, Hung-yi Lee, Hsin-Min Wang

Abstract

Predicting stock prices presents challenges in financial forecasting. While traditional approaches such as ARIMA and RNNs are prevalent, recent developments in Large Language Models (LLMs) offer alternative methodologies. This paper introduces an approach that integrates LLMs with daily financial news for stock price prediction. To address the challenge of processing news data and identifying relevant content, we utilize stock name embeddings within attention mechanisms. Specifically, we encode news articles using a pre-trained LLM and implement three attention-based pooling techniques -- self-attentive, cross-attentive, and position-aware self-attentive pooling -- to filter news based on stock relevance. The filtered news embeddings, combined with historical stock prices, serve as inputs to the prediction model. Unlike prior studies that focus on individual stocks, our method trains a single generalized model applicable across multiple stocks. Experimental results demonstrate a 7.11% reduction in Mean Absolute Error (MAE) compared to the baseline, indicating the utility of stock name embeddings for news filtering and price forecasting within a generalized framework.

Generalized Stock Price Prediction for Multiple Stocks Combined with News Fusion

Abstract

Predicting stock prices presents challenges in financial forecasting. While traditional approaches such as ARIMA and RNNs are prevalent, recent developments in Large Language Models (LLMs) offer alternative methodologies. This paper introduces an approach that integrates LLMs with daily financial news for stock price prediction. To address the challenge of processing news data and identifying relevant content, we utilize stock name embeddings within attention mechanisms. Specifically, we encode news articles using a pre-trained LLM and implement three attention-based pooling techniques -- self-attentive, cross-attentive, and position-aware self-attentive pooling -- to filter news based on stock relevance. The filtered news embeddings, combined with historical stock prices, serve as inputs to the prediction model. Unlike prior studies that focus on individual stocks, our method trains a single generalized model applicable across multiple stocks. Experimental results demonstrate a 7.11% reduction in Mean Absolute Error (MAE) compared to the baseline, indicating the utility of stock name embeddings for news filtering and price forecasting within a generalized framework.
Paper Structure (29 sections, 7 equations, 4 figures, 6 tables)

This paper contains 29 sections, 7 equations, 4 figures, 6 tables.

Figures (4)

  • Figure 1: Overview of the proposed stock price prediction framework. We employ Attentive Pooling to derive pooled representations of all news articles from each day. Subsequently, we integrate daily historical stock price data with corresponding news information via News-Price Fusion. Finally, these historical representations are input into an LLM to predict future stock prices. The dotted line represents a process that is optional.
  • Figure 2: Three proposed daily news pooling methods that integrate the stock name. (a) We use the sequence of news embeddings as Keys and Values and the stock name embedding as Query for cross-attention to obtain a pooled representation. (b) We append the stock name embedding in front of the sequence of news embeddings, and apply self-attention to obtain a pooled representation. (c) We add the stock name embedding and positional embeddings to the sequence of news embeddings via matrix addition $\oplus$, and apply self-attention to obtain a pooled representation.
  • Figure 3: The News-Price Fusion Module. Initially, we feed the 20-day price embeddings and pooled news embeddings into distinct dense layers. Subsequently, we apply bidirectional cross-attention, alternating between prices and news as Query/Key and Value. Additionally, a two-layer GCN architecture is employed to model the interaction between prices and news. Finally, we integrate the three fused representations with the original outputs from the dense layers (both price and news embeddings) using a weighted average, yielding the final fused result.
  • Figure 4: (a) and (b) compare the MAE of future 5-day price prediction methods with different backbones: LLaMA (a) and GPT-2 (b). Darker bars indicate results without SNP, while lighter bars show results with SNP. TimeLLM serves as the baseline, +News includes news without stock name embeddings, and +CAP, +SAP, and +PA-SAP are three attentive pooling methods.