diff --git a/README.md b/README.md index a3685271..2bc74088 100644 --- a/README.md +++ b/README.md @@ -6,35 +6,43 @@ # Litadel: Multi-Agents LLM Financial Trading Framework -> **Copyright Notice:** Litadel is a successor of TradingAgents by TaurusResearch. This project builds upon and extends the original TradingAgents framework. +> **Copyright Notice:** Litadel is a successor of TradingAgents. This project builds upon and extends the original TradingAgents framework.
-🚀 [Litadel](#litadel-framework) | ⚡ [Installation & CLI](#installation-and-cli) | 📦 [Package Usage](#litadel-package) | 🤝 [Contributing](#contributing) | 📄 [Citation](#citation) +🚀 [Overview](#overview) | 💻 [Web Interface](#web-interface) | ⚡ [Getting Started](#getting-started) | 🎯 [Usage](#usage) | 🤝 [Contributing](#contributing) | 📄 [Citation](#citation)
-## Litadel Framework +## Overview -Litadel 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. +Litadel is a comprehensive multi-agent trading platform that brings the dynamics of professional trading firms to your fingertips. Powered by specialized LLM agents—from fundamental analysts and sentiment experts to traders and risk managers—the system collaboratively evaluates market conditions across **equities, commodities, and cryptocurrencies** to deliver actionable trading insights.

-> Litadel 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/) +> Litadel framework is designed for research and educational 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/) -### Additional Functionality in Litadel +### What You Get -Litadel extends the original TradingAgents framework with enhanced capabilities: +**Three Ways to Analyze Markets:** +- 🌐 **Web Dashboard** - Modern, real-time interface with live analysis tracking, interactive charts, and comprehensive reports +- 💻 **Interactive CLI** - Rich terminal experience with live agent progress and automatic report generation +- 📦 **Python Package** - Integrate Litadel's multi-agent analysis directly into your own applications -- ✅ **Commodities Support** - Full analysis and trading support for commodity markets -- ✅ **Cryptocurrency Support** - Native support for crypto asset analysis and trading -- 🚧 **Web Frontend** - Interactive web interface (in progress) -- 🚧 **Automated Trading Mode** - Continuous automated trading execution (in progress) -- 🚧 **Portfolio Management** - Multi-asset portfolio tracking and optimization (in progress) +**Multi-Asset Coverage:** +- 📈 **Equities** - Full fundamental, technical, and sentiment analysis for stocks +- 🛢️ **Commodities** - Specialized analysis for oil, metals, agricultural products, and more +- ₿ **Cryptocurrencies** - Real-time crypto market analysis with sentiment tracking -Our framework decomposes complex trading tasks into specialized roles. This ensures the system achieves a robust, scalable approach to market analysis and decision-making. +**Professional-Grade Analysis:** +- Real-time market data integration with automatic caching +- Multi-agent collaboration with structured debates between bull and bear perspectives +- Comprehensive reports covering technical indicators, fundamentals, news sentiment, and risk assessment +- Trading recommendations with confidence scores and detailed rationale + +Our framework decomposes complex trading tasks into specialized roles, ensuring robust and scalable market analysis. ### Analyst Team - Fundamentals Analyst: Evaluates company financials and performance metrics, identifying intrinsic values and potential red flags. @@ -68,7 +76,62 @@ Our framework decomposes complex trading tasks into specialized roles. This ensu

-## Installation and CLI +## Web Interface + +Litadel includes a modern web dashboard that provides a complete command center for managing your trading analyses. The interface offers real-time monitoring, interactive visualizations, and comprehensive reporting—all in a sleek, terminal-inspired design. + +### Dashboard - Your Control Center + +The main dashboard gives you an at-a-glance view of your trading operations with system metrics, recent activity, and quick access to create new analyses. + +

+ +

+ +### Analysis Management + +Browse all your analyses with smart filtering and grouping. Track active analyses in real-time and review historical decisions with detailed statistics. + +

+ +

+ +### Real-Time Analysis Tracking + +Watch your analysis unfold in real-time as agents collaborate to evaluate market conditions. See live progress updates, agent pipeline status, and streaming reports as they're generated. + +

+ +

+ +### Comprehensive Analysis Reports + +Each completed analysis provides detailed insights with: +- **Trading Decision** - Clear BUY/SELL/HOLD recommendation with confidence score +- **Interactive Price Charts** - Candlestick charts with analysis date markers and 60-day history +- **Market Metrics** - Current price, daily change, volume, and 52-week ranges +- **Agent Reports** - Detailed analysis from each specialist (market, news, sentiment, fundamentals) +- **Research Debate** - Bull vs. bear perspectives with investment recommendations +- **Risk Assessment** - Comprehensive risk evaluation and portfolio impact analysis + +

+ +

+ +

+ +

+ +### Key Features + +- **Real-Time WebSocket Updates** - Live progress tracking without page refreshes +- **Interactive Charts** - Visualize price action with candlestick or line charts +- **Export Capabilities** - Download complete analysis data as JSON +- **Analysis History** - Browse and compare past analyses by ticker and date +- **Secure API Access** - API key authentication with configurable endpoints +- **Responsive Design** - Works seamlessly on desktop and tablet devices + +## Getting Started ### Installation @@ -78,7 +141,7 @@ git clone https://github.com/TauricResearch/Litadel.git cd Litadel ``` -Create a virtual environment in any of your favorite environment managers: +Create a virtual environment: ```bash conda create -n litadel python=3.13 conda activate litadel @@ -89,36 +152,63 @@ Install dependencies: pip install -r requirements.txt ``` -### Required APIs +### API Keys Setup -You will need the OpenAI API for all the agents, and [Alpha Vantage API](https://www.alphavantage.co/support/#api-key) for fundamental and news data (default configuration). +You will need API keys for LLM providers and market data. The default configuration uses OpenAI for agents and [Alpha Vantage](https://www.alphavantage.co/support/#api-key) for market data. -```bash -export OPENAI_API_KEY=$YOUR_OPENAI_API_KEY -export ALPHA_VANTAGE_API_KEY=$YOUR_ALPHA_VANTAGE_API_KEY -``` - -Alternatively, you can create a `.env` file in the project root with your API keys (see `.env.example` for reference): +Create a `.env` file in the project root: ```bash 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 Litadel. You can get a free AlphaVantage API [here](https://www.alphavantage.co/support/#api-key), Litadel-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 Litadel 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`. +Or export them directly: +```bash +export OPENAI_API_KEY=$YOUR_OPENAI_API_KEY +export ALPHA_VANTAGE_API_KEY=$YOUR_ALPHA_VANTAGE_API_KEY +``` -### CLI Usage +**Note:** Litadel partners with Alpha Vantage to provide robust API support. Get a free API key [here](https://www.alphavantage.co/support/#api-key)—Litadel users receive increased rate limits (60 requests/minute, no daily limits) through Alpha Vantage's open-source support program. + +## Usage + +### Web Dashboard (Recommended) + +The web interface provides the most comprehensive experience with real-time tracking, interactive charts, and complete analysis history. + +**1. Start the API Server:** +```bash +python -m api.main +``` + +On first run, the system will automatically create a database and generate an API key. **Save this key—you'll need it for the web interface.** + +**2. Start the Frontend:** +```bash +cd frontend +npm install +npm run dev +``` + +**3. Access the Dashboard:** + +Open your browser to `http://localhost:5173` and enter your API key in Settings. You're ready to create your first analysis! + +### Interactive CLI + +For a terminal-based experience with live agent progress tracking: -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. + +Select your ticker, analysis date, analyst team, LLM models, and research depth through the interactive prompts.

-An interface will appear showing results as they load, letting you track the agent's progress as it runs. +Watch as agents collaborate in real-time, with live updates showing their reasoning and tool usage:

@@ -128,63 +218,76 @@ An interface will appear showing results as they load, letting you track the age

-## Litadel Package +Results are automatically saved to `results///` with detailed logs and markdown reports. -### Implementation Details +### Python Package -We built Litadel with LangGraph to ensure flexibility and modularity. We utilize `o1-preview` and `gpt-4o` as our deep thinking and fast thinking LLMs for our experiments. However, for testing purposes, we recommend you use `o1-mini` and `gpt-4o-mini` to save on costs as our framework makes **lots of** API calls. +Integrate Litadel's multi-agent analysis directly into your own applications, trading bots, or research pipelines. -### Python Usage - -To use Litadel inside your code, you can import the `tradingagents` module and initialize a `TradingAgentsGraph()` object. The `.propagate()` function will return a decision. You can run `main.py`, here's also a quick example: +**Basic Usage:** ```python from tradingagents.graph.trading_graph import TradingAgentsGraph from tradingagents.default_config import DEFAULT_CONFIG +# Initialize the trading agents ta = TradingAgentsGraph(debug=True, config=DEFAULT_CONFIG.copy()) -# forward propagate +# Run analysis and get trading decision _, decision = ta.propagate("NVDA", "2024-05-10") print(decision) ``` -You can also adjust the default configuration to set your own choice of LLMs, debate rounds, etc. +**Custom Configuration:** + +Customize LLM models, debate rounds, and data sources to match your needs: ```python from tradingagents.graph.trading_graph import TradingAgentsGraph from tradingagents.default_config import DEFAULT_CONFIG -# Create a custom config +# Create custom configuration config = DEFAULT_CONFIG.copy() -config["deep_think_llm"] = "o1-mini" # Use a different model -config["quick_think_llm"] = "gpt-4o-mini" # Use a different model -config["max_debate_rounds"] = 1 # Increase debate rounds +config["deep_think_llm"] = "o1-mini" # Deep reasoning model +config["quick_think_llm"] = "gpt-4o-mini" # Fast operations model +config["max_debate_rounds"] = 3 # More thorough research debates -# Configure data vendors (default uses yfinance and Alpha Vantage) +# Configure data sources config["data_vendors"] = { - "core_stock_apis": "yfinance", # Options: yfinance, alpha_vantage, local - "technical_indicators": "yfinance", # Options: yfinance, alpha_vantage, local - "fundamental_data": "alpha_vantage", # Options: openai, alpha_vantage, local - "news_data": "alpha_vantage", # Options: openai, alpha_vantage, google, local + "core_stock_apis": "yfinance", # Price data + "technical_indicators": "yfinance", # Technical analysis + "fundamental_data": "alpha_vantage", # Company fundamentals + "news_data": "alpha_vantage", # News and sentiment } -# Initialize with custom config +# Run with custom config ta = TradingAgentsGraph(debug=True, config=config) - -# forward propagate -_, decision = ta.propagate("NVDA", "2024-05-10") -print(decision) +_, decision = ta.propagate("AAPL", "2024-05-10") ``` -> 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! +**Cost Optimization:** -You can view the full list of configurations in `tradingagents/default_config.py`. +For testing and development, we recommend using `gpt-4o-mini` and `o1-mini` to minimize costs, as the multi-agent framework makes numerous API calls during analysis. For production use with higher accuracy requirements, consider `gpt-4o` and `o1-preview`. -## Roadmap +**Data Sources:** -### Upcoming Improvements -- [ ] **Switch from LangChain/LangGraph to OpenAI Agents SDK** - For better maintainability and parallelization +The default configuration uses YFinance for price/technical data and Alpha Vantage for fundamentals/news. You can switch to OpenAI for web-based data fetching or use local cached data for offline experimentation. See `tradingagents/default_config.py` for all available options. + +## What's New in Litadel + +### Completed Features +- ✅ **Web Dashboard** - Full-featured web interface with real-time analysis tracking +- ✅ **REST API** - Complete API for programmatic access with WebSocket support +- ✅ **Multi-Asset Support** - Equities, commodities, and cryptocurrencies +- ✅ **Interactive Charts** - Real-time candlestick and line charts with market data +- ✅ **Analysis History** - Persistent storage and browsing of all analyses +- ✅ **Export Capabilities** - Download complete analysis data as JSON + +### Roadmap +- 🚧 **Automated Trading Mode** - Continuous automated trading execution +- 🚧 **Portfolio Management** - Multi-asset portfolio tracking and optimization +- 🚧 **Backtesting Engine** - Historical performance analysis with TauricDB +- 🚧 **OpenAI Agents SDK Migration** - Enhanced parallelization and maintainability ## Contributing @@ -194,6 +297,18 @@ We welcome contributions from the community! Whether it's fixing a bug, improvin Please reference our work if you find *Litadel* provides you with some help :) +Litadel citation: + +``` +@software{gabler2025litadel, + title={Litadel: Multi-Agents LLM Financial Trading Framework}, + author={Marvin Gabler}, + year={2025}, + url={https://github.com/deepweather/Litadel}, + note={Extended framework based on TradingAgents} +} +``` + Original TradingAgents citation: ``` diff --git a/api/endpoints/data.py b/api/endpoints/data.py index 3300ac2d..c7020e34 100644 --- a/api/endpoints/data.py +++ b/api/endpoints/data.py @@ -67,11 +67,23 @@ def _normalize_ohlcv_rows_from_csv(csv_text: str) -> List[Dict[str, str]]: volume_val = get_field(r, "Volume", "volume") if not date_val: - # Skip rows without date continue + # Fallbacks for single-value series (e.g., commodities time,value) + if close_val is None: + close_val = get_field(r, "value", "price") + + # If only a close-like value exists, mirror it to O/H/L so charts render + if close_val is not None: + if open_val is None: + open_val = close_val + if high_val is None: + high_val = close_val + if low_val is None: + low_val = close_val + rows.append({ - "Date": str(date_val)[:10], # ensure YYYY-MM-DD + "Date": str(date_val)[:10], "Close": close_val if close_val is not None else "", "High": high_val if high_val is not None else "", "Low": low_val if low_val is not None else "", @@ -198,26 +210,51 @@ async def get_cached_data( # Read CSV data data = [] - try: - with open(csv_file, "r") as f: + def _read_csv_to_rows(file_path: Path) -> List[Dict[str, str]]: + rows: List[Dict[str, str]] = [] + with open(file_path, "r") as f: reader = csv.DictReader(f) for row in reader: - # Filter by date if specified row_date = row.get("Date", "") if start_date and row_date < start_date: continue if end_date and row_date > end_date: continue - - # Convert numeric fields for field in ["Close", "High", "Low", "Open", "Volume"]: if field in row and row[field]: try: row[field] = float(row[field]) except: pass - - data.append(row) + rows.append(row) + return rows + + try: + data = _read_csv_to_rows(csv_file) + # Self-heal: if all numeric fields are empty, regenerate cache once + has_any_price = any( + isinstance(r.get("Close"), (int, float)) or str(r.get("Close", "")) not in ("",) + for r in data + ) + if not has_any_price: + # Delete and regenerate cache + try: + os.remove(csv_file) + except Exception: + pass + # Recreate + _ensure_cached_data(ticker, start_date, end_date) + # Re-discover and re-read + matching_files = list(DATA_CACHE_DIR.glob(pattern)) + if not matching_files: + raise HTTPException( + status_code=status.HTTP_404_NOT_FOUND, + detail=f"No cached data found for ticker {ticker}", + ) + csv_file = matching_files[0] + data = _read_csv_to_rows(csv_file) + except HTTPException: + raise except Exception as e: raise HTTPException( status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, diff --git a/assets/aapl_analysis.png b/assets/aapl_analysis.png new file mode 100644 index 00000000..7d55bbda Binary files /dev/null and b/assets/aapl_analysis.png differ diff --git a/assets/analyses.png b/assets/analyses.png new file mode 100644 index 00000000..227127ec Binary files /dev/null and b/assets/analyses.png differ diff --git a/assets/anlaysis_report_example.png b/assets/anlaysis_report_example.png new file mode 100644 index 00000000..b4ea2ffa Binary files /dev/null and b/assets/anlaysis_report_example.png differ diff --git a/assets/btc_single_analysis.png b/assets/btc_single_analysis.png new file mode 100644 index 00000000..3c1f8735 Binary files /dev/null and b/assets/btc_single_analysis.png differ diff --git a/assets/dashboard.png b/assets/dashboard.png new file mode 100644 index 00000000..80ada645 Binary files /dev/null and b/assets/dashboard.png differ diff --git a/assets/wechat.png b/assets/wechat.png deleted file mode 100644 index 94355680..00000000 Binary files a/assets/wechat.png and /dev/null differ