ALFFLLM·FINANCE

The List / Trading, Investment, and Portfolio Management / paper

Sentiment-driven prediction of financial returns: a Bayesian-enhanced FinBERT approach

R. G. Cestari; Simone Formentin

Abstract

Predicting financial returns accurately poses a significant challenge due to the inherent uncertainty in financial time series data. Enhancing prediction models' performance hinges on effectively capturing both social and financial sentiment. In this study, we showcase the efficacy of leveraging sentiment information extracted from tweets using the FinBERT large language model. By meticulously curating an optimal feature set through correlation analysis and employing Bayesian-optimized Recursive Feature Elimination for automatic feature selection, we surpass existing methodologies, achieving an F1-score exceeding 70% on the test set. This success translates into demonstrably higher cumulative profits during backtested trading. Our investigation focuses on real-world SPY ETF data alongside corresponding tweets sourced from the StockTwits platform.

In one sentence

The paper demonstrates that combining FinBERT-extracted sentiment features with Bayesian-optimized feature selection significantly improves SPY ETF return sign prediction and cumulative trading profits compared to existing benchmarks.

Summary

Predicting financial asset returns is challenging due to market uncertainty and the need to effectively integrate textual sentiment data. This study addresses the problem of selecting optimal features from social media text to enhance return sign prediction models, specifically focusing on the SPY ETF. The authors argue that while sentiment is valuable, the sheer volume of data requires rigorous feature selection to avoid noise and overfitting, positioning their work as an improvement over previous literature that used larger, less curated feature sets. The methodology employs FinBERT to classify 3.2 million StockTwits tweets into positive, negative, or neutral sentiments, computing a daily sentiment index. To select features, the authors implement Bayesian-optimized Recursive Feature Elimination (BO-RFE) using a Random Forest kernel, which iteratively identifies the most informative subset of features based on F1-score. They further enrich this set using correlation analysis, identifying that negative sentiment and its lagged values (7 days) capture slow, weekly seasonal dynamics. The final prediction model is a Support Vector Machine (SVM) with SMOTE and bagging, trained on a moving window of SPY price and volume data alongside the selected sentiment features. Results show that the proposed BO-RFE-5 architecture (5 features) achieves an F1-score above 70% and 64.1% accuracy, outperforming the literature benchmark (F1 0.622). The optimal feature set is dominated by sentiment indicators (4 out of 5 features), highlighting their predictive power. Backtesting reveals that the BO-RFE-5 strategy generates significantly higher cumulative profits during volatile periods compared to the benchmark. A key advantage is the reduced training window requirement (210 days vs. 240 days), allowing for faster model adaptation. Limitations include the focus on a single ETF and the exclusion of transaction costs in the simulation.

Research problem

The paper addresses the challenge of accurately predicting the sign of financial asset returns by effectively leveraging social media sentiment. Specifically, it tackles the problem of feature selection in high-dimensional textual data, aiming to identify the minimal set of sentiment and financial features that maximize prediction performance. The study seeks to improve upon existing methodologies by demonstrating that a curated, sentiment-heavy feature set outperforms broader, less optimized approaches.

Core contributions

  • Introduction of a Bayesian-optimized Recursive Feature Elimination (BO-RFE) pipeline for automated feature selection in financial sentiment prediction.
  • Demonstration that sentiment features dominate the optimal feature set for SPY return prediction, with 4 out of 5 selected features being sentiment-based.
  • Identification of weekly seasonal dynamics in sentiment-return correlations, leading to the inclusion of 7-day lagged sentiment features.
  • Empirical evidence that a reduced feature set allows for a shorter training window (210 days vs. 240 days), enhancing model reactivity.
  • Backtesting results showing superior cumulative profits for the proposed method compared to literature benchmarks during volatile market periods.

Method

  • FinBERT Classification: Fine-tuned BERT model used to classify tweets into positive, negative, or neutral sentiments.
  • Sentiment Index Computation: Calculation of a daily sentiment score (St) based on the ratio of positive to negative tweets.
  • BO-RFE Algorithm: Bayesian Optimization tunes the number of features and Random Forest hyperparameters to maximize F1-score via Recursive Feature Elimination.
  • Correlation Analysis: Pearson correlation and autocorrelation functions used to identify lagged sentiment features with predictive power.
  • SVM Prediction Model: Support Vector Machine with RBF kernel, SMOTE for class imbalance, and bagging for ensemble prediction.
  • Backtesting Simulation: Rule-based trading strategy executing long/short positions based on predicted return signs.

Results & findings

  • BO-RFE-5 achieves an F1-score of 0.702, surpassing the Literature benchmark's 0.622.
  • Accuracy for BO-RFE-5 is 64.1%, with a recall of 78.5% for positive returns.
  • The optimal feature set for BO-RFE-5 consists of 1 financial feature (lagged return) and 4 sentiment features (current and lagged sentiment indices, negative tweet count).
  • Correlation analysis reveals a weekly periodicity in the impact of negative sentiment on returns.
  • Backtesting shows BO-RFE-5 generates significantly higher cumulative profits than the benchmark, particularly during high-volatility periods.
  • The BO-RFE-5 model requires a 210-day training window, 30 days less than the Literature benchmark's 240 days.
  • Sentiment features constitute 80% of the BO-RFE-5 feature set, compared to 30% in the Literature benchmark.

Data & experiments

  • Dataset: 3,261,867 StockTwits tweets tagged 'SPY' from March 2020 to March 2022.
  • Financial Data: Daily SPY ETF price, volume, and return data aligned with tweet dates.
  • Benchmarks: Comparison against a literature baseline (Liu et al., 2023) using 10 features.
  • Experimental Design: Three architectures compared: Literature (10 features), BO-RFE-2 (2 features), and BO-RFE-5 (5 features).
  • Metrics: Accuracy, Precision, Recall, F1-score for return sign prediction; cumulative profit for backtesting.
  • Simulation: Trading strategy involving long/short positions of $10,000 based on predicted return signs, excluding transaction costs.

Limitations & caveats

  • The study is limited to a single asset (SPY ETF), limiting generalizability to other stocks or assets.
  • Transaction costs are excluded from the backtesting, which may overestimate real-world profitability.
  • The dataset covers a specific period (2020-2022) characterized by high volatility, potentially affecting robustness.
  • The use of StockTwits data may introduce noise from non-financial or spammy content.
  • The model relies on a fixed prediction horizon (next day's return sign), not magnitude.
  • The correlation analysis is based on Pearson coefficients, which may miss non-linear relationships.

Curator notes

Discovery status: specific_domain_focus_promoted. Source links: FinBERT ETF financial returns SPY