diff --git a/README.md b/README.md index 7e90c60f..4c97b680 100644 --- a/README.md +++ b/README.md @@ -1,69 +1,54 @@ -

- -

- -
- arXiv - Discord - WeChat - X Follow -
- Community -
-
- - Deutsch | - Español | - français | - 日本語 | - 한국어 | - Português | - Русский | - 中文 + +### 📌 **Note:** This repository is a fork of the original [TradingAgents](https://github.com/TauricResearch/TradingAgents) repository from the paper "TradingAgents: Multi-Agents LLM Financial Trading Framework" ([arXiv:2412.20138](https://arxiv.org/abs/2412.20138)). This fork implements **FinAgents**, an extension that integrates a domain-adapted language model (FinLLaMA+) to enhance sentiment analysis and improve trading performance. +
--- -# TradingAgents: Multi-Agents LLM Financial Trading Framework +# FinAgents: Multi-Agent Financial Trading with Domain-Adapted Language Models -> 🎉 **TradingAgents** officially released! We have received numerous inquiries about the work, and we would like to express our thanks for the enthusiasm in our community. -> -> So we decided to fully open-source the framework. Looking forward to building impactful projects with you! - -
- - - - - TradingAgents Star History - - -
+> **FinAgents** extends the TradingAgents framework by integrating **FinLLaMA+**, a fine-tuned version of Llama 3.1–8B trained via LoRA on financial filings, earnings calls, and labeled sentiment datasets. This domain-adapted model provides ticker-grounded, confidence-calibrated sentiment embeddings that enhance textual reasoning and improve decision precision in multi-agent trading systems.
-🚀 [TradingAgents](#tradingagents-framework) | ⚡ [Installation & CLI](#installation-and-cli) | 🎬 [Demo](https://www.youtube.com/watch?v=90gr5lwjIho) | 📦 [Package Usage](#tradingagents-package) | 🤝 [Contributing](#contributing) | 📄 [Citation](#citation) +🚀 [FinAgents Framework](#finagents-framework) | ⚡ [Installation](#installation-and-cli) | 🎬 [Demo](https://www.youtube.com/watch?v=90gr5lwjIho) | 📦 [Package Usage](#tradingagents-package) | 🤝 [Contributing](#contributing) | 📄 [Citation](#citation)
-## TradingAgents Framework +## FinAgents Framework -TradingAgents is a multi-agent trading framework that mirrors the dynamics of real-world trading firms. By deploying specialized LLM-powered agents: from fundamental analysts, sentiment experts, and technical analysts, to trader, risk management team, the platform collaboratively evaluates market conditions and informs trading decisions. Moreover, these agents engage in dynamic discussions to pinpoint the optimal strategy. +FinAgents extends the TradingAgents multi-agent trading framework, which mirrors the dynamics of real-world trading firms. By deploying specialized LLM-powered agents—from fundamental analysts, sentiment experts, and technical analysts, to trader and risk management teams—the platform collaboratively evaluates market conditions and informs trading decisions. These agents engage in dynamic discussions to pinpoint the optimal strategy. + +### Key Enhancements + +**FinLLaMA+ Integration**: The framework integrates a domain-adapted language model (FinLLaMA+) that replaces the generic sentiment analysis used in the original TradingAgents. This enhancement includes: + +- **Domain-Adaptive Pretraining (DAPT)**: Pre-training on earnings call transcripts (~304M tokens) to improve financial language understanding, achieving a 22.52% reduction in perplexity +- **Supervised Fine-Tuning (SFT)**: Fine-tuning on Financial PhraseBank and SemEval-2017 Task 5 datasets (~6,000 labeled examples) for sentiment classification +- **Ticker-Grounded Sentiment Analysis**: Produces structured JSON outputs with sentiment polarity, confidence scores, and relevance metrics +- **Confidence-Weighted Aggregation**: Aggregates multiple news items into daily sentiment scores using confidence-weighted means + +### Project Team + +- **Vaibhav Dhanuka** ([vdhanuka@wisc.edu](mailto:vdhanuka@wisc.edu)) - Infrastructure, LLM training, evaluation +- **Negi Shashwat** ([negi3@wisc.edu](mailto:negi3@wisc.edu)) - LLM fine-tuning, agent coordination, system design +- **Zichen Liu** ([zliu2263@wisc.edu](mailto:zliu2263@wisc.edu)) - Data collection/preprocessing, pipelines +- **Quanliang Liu** ([qliu388@wisc.edu](mailto:qliu388@wisc.edu)) - Backtesting, visualization, performance

-> TradingAgents framework is designed for research purposes. Trading performance may vary based on many factors, including the chosen backbone language models, model temperature, trading periods, the quality of data, and other non-deterministic factors. [It is not intended as financial, investment, or trading advice.](https://tauric.ai/disclaimer/) +> TradingAgents framework is designed for research purposes. Trading performance may vary based on many factors, including the chosen backbone language models, model temperature, trading periods, the quality of data, and other non-deterministic factors. It is not intended as financial, investment, or trading advice. Our framework decomposes complex trading tasks into specialized roles. This ensures the system achieves a robust, scalable approach to market analysis and decision-making. ### Analyst Team -- Fundamentals Analyst: Evaluates company financials and performance metrics, identifying intrinsic values and potential red flags. -- Sentiment Analyst: Analyzes social media and public sentiment using sentiment scoring algorithms to gauge short-term market mood. -- News Analyst: Monitors global news and macroeconomic indicators, interpreting the impact of events on market conditions. -- Technical Analyst: Utilizes technical indicators (like MACD and RSI) to detect trading patterns and forecast price movements. +- **Fundamentals Analyst**: Evaluates company financials and performance metrics, identifying intrinsic values and potential red flags. +- **Sentiment Analyst**: Analyzes social media and public sentiment using sentiment scoring algorithms to gauge short-term market mood. +- **News Analyst**: Enhanced with FinLLaMA+ for domain-specialized sentiment analysis. Monitors global news and macroeconomic indicators, interpreting the impact of events on market conditions with improved financial language understanding. +- **Technical Analyst**: Utilizes technical indicators (like MACD and RSI) to detect trading patterns and forecast price movements.

@@ -95,7 +80,13 @@ Our framework decomposes complex trading tasks into specialized roles. This ensu ### Installation -Clone TradingAgents: +Clone this fork: +```bash +git clone +cd TradingAgents +``` + +Or clone the original repository: ```bash git clone https://github.com/TauricResearch/TradingAgents.git cd TradingAgents @@ -127,29 +118,7 @@ cp .env.example .env # Edit .env with your actual API keys ``` -**Note:** We are happy to partner with Alpha Vantage to provide robust API support for TradingAgents. You can get a free AlphaVantage API [here](https://www.alphavantage.co/support/#api-key), TradingAgents-sourced requests also have increased rate limits to 60 requests per minute with no daily limits. Typically the quota is sufficient for performing complex tasks with TradingAgents thanks to Alpha Vantage’s open-source support program. If you prefer to use OpenAI for these data sources instead, you can modify the data vendor settings in `tradingagents/default_config.py`. - -### CLI Usage - -You can also try out the CLI directly by running: -```bash -python -m cli.main -``` -You will see a screen where you can select your desired tickers, date, LLMs, research depth, etc. - -

- -

- -An interface will appear showing results as they load, letting you track the agent's progress as it runs. - -

- -

- -

- -

+**Note:** We are happy to partner with Alpha Vantage to provide robust API support for TradingAgents. You can get a free AlphaVantage API [here](https://www.alphavantage.co/support/#api-key), TradingAgents-sourced requests also have increased rate limits to 60 requests per minute with no daily limits. Typically the quota is sufficient for performing complex tasks with TradingAgents thanks to Alpha Vantage's open-source support program. If you prefer to use OpenAI for these data sources instead, you can modify the data vendor settings in `tradingagents/default_config.py`. ## TradingAgents Package @@ -200,17 +169,50 @@ _, decision = ta.propagate("NVDA", "2024-05-10") print(decision) ``` -> The default configuration uses yfinance for stock price and technical data, and Alpha Vantage for fundamental and news data. For production use or if you encounter rate limits, consider upgrading to [Alpha Vantage Premium](https://www.alphavantage.co/premium/) for more stable and reliable data access. For offline experimentation, there's a local data vendor option that uses our **Tauric TradingDB**, a curated dataset for backtesting, though this is still in development. We're currently refining this dataset and plan to release it soon alongside our upcoming projects. Stay tuned! +> The default configuration uses yfinance for stock price and technical data, and Alpha Vantage for fundamental and news data. For production use or if you encounter rate limits, consider upgrading to [Alpha Vantage Premium](https://www.alphavantage.co/premium/) for more stable and reliable data access. For offline experimentation, there's a local data vendor option available, though this is still in development. You can view the full list of configurations in `tradingagents/default_config.py`. +## FinLLaMA+ Model Details + +### Training Pipeline + +1. **Domain-Adaptive Pretraining (DAPT)** + - Base model: Llama 3.1–8B + - Dataset: Earnings call transcripts (~304M tokens, 20% of full dataset) + - Method: QLoRA with 4-bit NF4 quantization + - Training: 1 epoch on NVIDIA A40 GPU (~6 days) + - Result: 22.52% perplexity reduction (6.4076 → 4.9649) + +2. **Supervised Fine-Tuning (SFT)** + - Datasets: Financial PhraseBank + SemEval-2017 Task 5 (~6,000 examples) + - Task: Sentiment classification (positive/neutral/negative/uncertain) + - Method: LoRA (rank r=16, α=32, dropout=0.05) + - Output: Structured JSON with sentiment, confidence, and relevance scores + +### Integration Architecture + +FinLLaMA+ serves as a drop-in replacement for the News and Social Sentiment agents. It processes financial news and social media updates, producing structured outputs that are aggregated into daily sentiment scores per ticker. The model includes: + +- **Caching and Deduplication**: Content hash-based caching and embedding similarity filtering to reduce redundant LLM calls +- **Relevance Scoring**: Hybrid semantic similarity and keyword matching to prioritize ticker-specific news +- **Market Sentiment Reports**: Generates interpretable narrative summaries for the Researcher Team + +## Evaluation Metrics + +Performance is evaluated using standard financial metrics: +- **Cumulative Return (CR)**: Total portfolio return over the evaluation period +- **Annualized Return (AR)**: Return normalized to an annual basis +- **Sharpe Ratio (SR)**: Risk-adjusted return metric +- **Maximum Drawdown (MDD)**: Largest peak-to-trough decline + ## Contributing -We welcome contributions from the community! Whether it's fixing a bug, improving documentation, or suggesting a new feature, your input helps make this project better. If you are interested in this line of research, please consider joining our open-source financial AI research community [Tauric Research](https://tauric.ai/). +This is a fork implementing FinAgents extensions to the TradingAgents framework. For contributions to the original TradingAgents project, please refer to the [original repository](https://github.com/TauricResearch/TradingAgents). ## Citation -Please reference our work if you find *TradingAgents* provides you with some help :) +### Original TradingAgents Paper ``` @misc{xiao2025tradingagentsmultiagentsllmfinancial, @@ -223,3 +225,11 @@ Please reference our work if you find *TradingAgents* provides you with some hel url={https://arxiv.org/abs/2412.20138}, } ``` + +### Related Works + +This project builds upon several key papers: +- **FinBERT** (Araci, 2019): Domain-specific transformers for finance +- **FinLLaMA** (Konstantinidis et al., 2024): Financial sentiment classification +- **Trading-R1** (Xiao et al., 2025a): Reinforcement learning for trading +- **ElliottAgents** (Wawer & Chudziak, 2025): Multi-agent LLM-based forecasting