An End-To-End LLM Enhanced Trading System
An End-To-End LLM Enhanced Trading System
This paper presents an end-to-end trading system that combines large language model (LLM) based sentiment analysis with traditional technical indicators to generate real-time trading signals. The system collects live stock prices via Finnhub WebSocket, financial news via News API, and social media posts from Reddit's WallStreetBets. Text data is summarized using Cohere's model and analyzed by FinGPT, a finance-specific LLM fine-tuned with LoRA, to produce sentiment scores and confidence logits. These sentiment signals are integrated with technical indicators—SMA crossover, RSI, and Stochastic Oscillator—to generate buy/sell/hold signals. The entire pipeline is deployed on Kubernetes using Docker containers for scalability and resilience.
Benchmarking on a financial sentiment dataset shows FinGPT outperforms IBM Granite 3.0 and Meta LLaMA 3.1 in accuracy, precision, recall, and F1-score. Backtesting on TSLA, AAPL, and AMZN using 2022-2023 data demonstrates that incorporating sentiment significantly improves both Sharpe ratio and win ratio compared to using technical indicators alone. For example, the SMA crossover strategy for TSLA sees Sharpe ratio increase from 0.34 to 3.47 and win ratio from 32.2% to 57.0%. The system's modular design and real-time capabilities make it a practical tool for sentiment-driven trading, with future plans for customizable strategies and support for additional assets like cryptocurrencies.
Highlights
- 1End-to-end trading system integrating LLM-based sentiment analysis with technical indicators for real-time trading signals.
- 2Deploys FinGPT for domain-specific sentiment analysis, outperforming general LLMs like LLaMA and Granite on financial sentiment tasks.
- 3Backtesting shows sentiment integration significantly improves Sharpe ratio and win ratio across multiple tickers and strategies.
- 4Scalable deployment using Kubernetes and Docker for real-time data processing and inference.
Methods
- MSentiment analysis using FinGPT with Low-Rank Adaptation (LoRA) fine-tuning.
- MTechnical indicators: SMA crossover, RSI, and Stochastic Oscillator.
- MReal-time data collection from Finnhub (prices), News API, and Reddit (PRAW).
- MBacktesting framework comparing sentiment-enhanced vs. baseline technical strategies.
Results
- RFinGPT achieves 74.62% accuracy, outperforming Granite (58.61%) and LLaMA (65.65%) on financial sentiment analysis.
- RSentiment-enhanced SMA crossover for TSLA improves Sharpe ratio from 0.34 to 3.47 and win ratio from 32.2% to 57.0%.
- RAAPL and AMZN also show substantial improvements: AAPL SMA Sharpe from -4.03 to 2.13, AMZN SMA Sharpe from -2.75 to 3.14.
- RSentiment integration consistently improves risk-adjusted returns across all tested tickers and strategies.
Analyze Paper
Generate insights from "An End-To-End LLM Enhanced Trading System".