Simplified CLI and add TODO list
This commit is contained in:
parent
718df34932
commit
003605735a
|
|
@ -0,0 +1,2 @@
|
|||
OPENAI_API_KEY=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
|
||||
FINNHUB_API_KEY=d1ersfhr01qghj42q250d1ersfhr01qghj42q25g
|
||||
|
|
@ -6,3 +6,6 @@ src/
|
|||
eval_results/
|
||||
eval_data/
|
||||
*.egg-info/
|
||||
|
||||
# Results folder - ignore all analysis outputs
|
||||
results/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,666 @@
|
|||
# TradingAgents: Comprehensive Technical Documentation
|
||||
|
||||
## Table of Contents
|
||||
1. [Project Overview](#project-overview)
|
||||
2. [Architecture & Design Patterns](#architecture--design-patterns)
|
||||
3. [Technology Stack](#technology-stack)
|
||||
4. [System Components](#system-components)
|
||||
5. [Data Flow & Workflow](#data-flow--workflow)
|
||||
6. [Configuration Management](#configuration-management)
|
||||
7. [API & Integration](#api--integration)
|
||||
8. [Development Patterns](#development-patterns)
|
||||
9. [Deployment & Scaling](#deployment--scaling)
|
||||
10. [Troubleshooting](#troubleshooting)
|
||||
|
||||
---
|
||||
|
||||
## Project Overview
|
||||
|
||||
TradingAgents is a sophisticated multi-agent trading framework that simulates the collaborative decision-making process of a real-world trading firm. The system employs specialized LLM-powered agents that work together to analyze market conditions, debate investment strategies, and make informed trading decisions.
|
||||
|
||||
### Key Features
|
||||
- **Multi-Agent Architecture**: Specialized agents for different aspects of trading analysis
|
||||
- **Collaborative Decision Making**: Agents engage in structured debates and discussions
|
||||
- **Real-time & Historical Data**: Integrates multiple data sources for comprehensive analysis
|
||||
- **Modular Design**: Easily extensible and configurable components
|
||||
- **Research-Focused**: Designed for academic and research purposes
|
||||
|
||||
---
|
||||
|
||||
## Architecture & Design Patterns
|
||||
|
||||
### 1. Multi-Agent System (MAS) Pattern
|
||||
The core architecture follows a Multi-Agent System pattern where autonomous agents collaborate to achieve a common goal:
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────┐
|
||||
│ TradingAgentsGraph │
|
||||
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
||||
│ │ Analyst │ │ Researcher │ │ Trader │ │
|
||||
│ │ Team │→ │ Team │→ │ Agent │ │
|
||||
│ └─────────────┘ └─────────────┘ └─────────────┘ │
|
||||
│ │ │ │
|
||||
│ ▼ ▼ │
|
||||
│ ┌─────────────┐ ┌─────────────┐ │
|
||||
│ │ Risk Mgmt │◄───────────────────│ Portfolio │ │
|
||||
│ │ Team │ │ Manager │ │
|
||||
│ └─────────────┘ └─────────────┘ │
|
||||
└─────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### 2. State Machine Pattern
|
||||
The system uses LangGraph's state machine pattern to manage the flow between different agent interactions:
|
||||
|
||||
```python
|
||||
class AgentState(MessagesState):
|
||||
company_of_interest: str
|
||||
trade_date: str
|
||||
market_report: str
|
||||
sentiment_report: str
|
||||
news_report: str
|
||||
fundamentals_report: str
|
||||
investment_plan: str
|
||||
trader_investment_plan: str
|
||||
final_trade_decision: str
|
||||
```
|
||||
|
||||
### 3. Strategy Pattern
|
||||
Different LLM providers are supported through the Strategy pattern:
|
||||
|
||||
```python
|
||||
# LLM Provider Strategy
|
||||
if config["llm_provider"].lower() == "openai":
|
||||
self.deep_thinking_llm = ChatOpenAI(...)
|
||||
elif config["llm_provider"].lower() == "anthropic":
|
||||
self.deep_thinking_llm = ChatAnthropic(...)
|
||||
elif config["llm_provider"].lower() == "google":
|
||||
self.deep_thinking_llm = ChatGoogleGenerativeAI(...)
|
||||
```
|
||||
|
||||
### 4. Observer Pattern
|
||||
The CLI implements an observer pattern for real-time status updates:
|
||||
|
||||
```python
|
||||
class MessageBuffer:
|
||||
def update_agent_status(self, agent, status):
|
||||
if agent in self.agent_status:
|
||||
self.agent_status[agent] = status
|
||||
self.current_agent = agent
|
||||
```
|
||||
|
||||
### 5. Factory Pattern
|
||||
Tool nodes are created using the Factory pattern for different data sources:
|
||||
|
||||
```python
|
||||
def _create_tool_nodes(self) -> Dict[str, ToolNode]:
|
||||
return {
|
||||
"market": ToolNode([...]),
|
||||
"social": ToolNode([...]),
|
||||
"news": ToolNode([...]),
|
||||
"fundamentals": ToolNode([...]),
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Technology Stack
|
||||
|
||||
### Core Framework
|
||||
- **Python 3.10+**: Primary programming language
|
||||
- **LangGraph 0.4.8**: Multi-agent orchestration framework
|
||||
- **LangChain 0.3.25**: LLM integration and chaining
|
||||
|
||||
### Large Language Models
|
||||
- **OpenAI GPT-4o/GPT-4o-mini**: Quick thinking agents
|
||||
- **OpenAI o1/o3**: Deep thinking agents
|
||||
- **Anthropic Claude**: Alternative LLM provider
|
||||
- **Google Gemini**: Alternative LLM provider
|
||||
|
||||
### Data Sources & APIs
|
||||
- **Yahoo Finance (yfinance)**: Stock price data
|
||||
- **Finnhub**: Financial news and insider data
|
||||
- **Reddit API (PRAW)**: Social sentiment analysis
|
||||
- **Google News**: Global news aggregation
|
||||
- **StockStats**: Technical indicators
|
||||
|
||||
### Data Management
|
||||
- **Pandas**: Data manipulation and analysis
|
||||
- **ChromaDB**: Vector database for memory storage
|
||||
- **Redis**: Caching and session management
|
||||
|
||||
### Development Tools
|
||||
- **Rich**: CLI interface and formatting
|
||||
- **Typer**: Command-line interface framework
|
||||
- **Questionary**: Interactive CLI prompts
|
||||
- **TQDM**: Progress bars
|
||||
- **UV**: Package management
|
||||
|
||||
### Deployment
|
||||
- **Docker**: Containerization
|
||||
- **Chainlit**: Web interface
|
||||
- **FastAPI**: API endpoints (implied in dependencies)
|
||||
|
||||
---
|
||||
|
||||
## System Components
|
||||
|
||||
### 1. Agent Hierarchy
|
||||
|
||||
#### Analyst Team
|
||||
```
|
||||
tradingagents/agents/analysts/
|
||||
├── market_analyst.py # Technical analysis
|
||||
├── news_analyst.py # News impact analysis
|
||||
├── social_media_analyst.py # Sentiment analysis
|
||||
└── fundamentals_analyst.py # Financial metrics analysis
|
||||
```
|
||||
|
||||
#### Research Team
|
||||
```
|
||||
tradingagents/agents/researchers/
|
||||
├── bull_researcher.py # Bullish perspective
|
||||
└── bear_researcher.py # Bearish perspective
|
||||
```
|
||||
|
||||
#### Management Team
|
||||
```
|
||||
tradingagents/agents/managers/
|
||||
├── research_manager.py # Coordinates research debate
|
||||
└── risk_manager.py # Risk assessment
|
||||
```
|
||||
|
||||
#### Trading Team
|
||||
```
|
||||
tradingagents/agents/trader/
|
||||
└── trader.py # Makes trading decisions
|
||||
```
|
||||
|
||||
#### Risk Management Team
|
||||
```
|
||||
tradingagents/agents/risk_mgmt/
|
||||
├── aggressive_debator.py # High-risk perspective
|
||||
├── conservative_debator.py # Low-risk perspective
|
||||
└── neutral_debator.py # Balanced perspective
|
||||
```
|
||||
|
||||
### 2. Data Flow Components
|
||||
|
||||
#### Data Interfaces
|
||||
```
|
||||
tradingagents/dataflows/
|
||||
├── interface.py # Main data access layer
|
||||
├── yfin_utils.py # Yahoo Finance integration
|
||||
├── finnhub_utils.py # Finnhub API integration
|
||||
├── reddit_utils.py # Reddit API integration
|
||||
├── googlenews_utils.py # Google News integration
|
||||
└── stockstats_utils.py # Technical indicators
|
||||
```
|
||||
|
||||
#### Configuration Management
|
||||
```
|
||||
tradingagents/
|
||||
├── default_config.py # Default configuration
|
||||
└── dataflows/config.py # Runtime configuration
|
||||
```
|
||||
|
||||
### 3. Graph Orchestration
|
||||
|
||||
#### Core Graph Components
|
||||
```
|
||||
tradingagents/graph/
|
||||
├── trading_graph.py # Main orchestration class
|
||||
├── setup.py # Graph setup and initialization
|
||||
├── conditional_logic.py # Decision routing logic
|
||||
├── propagation.py # State propagation
|
||||
├── reflection.py # Agent reflection capabilities
|
||||
└── signal_processing.py # Trading signal processing
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Data Flow & Workflow
|
||||
|
||||
### 1. Initialization Phase
|
||||
```mermaid
|
||||
graph TD
|
||||
A[User Input] --> B[Configuration Setup]
|
||||
B --> C[LLM Initialization]
|
||||
C --> D[Memory Initialization]
|
||||
D --> E[Tool Node Creation]
|
||||
E --> F[Graph Setup]
|
||||
```
|
||||
|
||||
### 2. Analysis Phase
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Market Data] --> B[Market Analyst]
|
||||
C[Social Media] --> D[Sentiment Analyst]
|
||||
E[News Sources] --> F[News Analyst]
|
||||
G[Financial Data] --> H[Fundamentals Analyst]
|
||||
|
||||
B --> I[Research Team Debate]
|
||||
D --> I
|
||||
F --> I
|
||||
H --> I
|
||||
|
||||
I --> J[Investment Plan]
|
||||
```
|
||||
|
||||
### 3. Decision Phase
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Investment Plan] --> B[Trader Agent]
|
||||
B --> C[Trading Plan]
|
||||
C --> D[Risk Management Debate]
|
||||
D --> E[Risk Assessment]
|
||||
E --> F[Portfolio Manager]
|
||||
F --> G[Final Decision]
|
||||
```
|
||||
|
||||
### 4. Execution Flow
|
||||
|
||||
#### Step 1: Data Collection
|
||||
```python
|
||||
# Each analyst collects relevant data
|
||||
market_data = toolkit.get_YFin_data_online(ticker, start_date, end_date)
|
||||
news_data = toolkit.get_finnhub_news(ticker, curr_date, lookback_days)
|
||||
social_data = toolkit.get_reddit_stock_info(ticker, curr_date)
|
||||
```
|
||||
|
||||
#### Step 2: Analysis & Reporting
|
||||
```python
|
||||
# Analysts generate reports
|
||||
market_report = market_analyst.analyze(market_data)
|
||||
sentiment_report = sentiment_analyst.analyze(social_data)
|
||||
news_report = news_analyst.analyze(news_data)
|
||||
fundamentals_report = fundamentals_analyst.analyze(financial_data)
|
||||
```
|
||||
|
||||
#### Step 3: Research Debate
|
||||
```python
|
||||
# Bull vs Bear debate
|
||||
investment_debate_state = InvestDebateState(
|
||||
bull_history="",
|
||||
bear_history="",
|
||||
history="",
|
||||
current_response="",
|
||||
judge_decision="",
|
||||
count=0
|
||||
)
|
||||
```
|
||||
|
||||
#### Step 4: Trading Decision
|
||||
```python
|
||||
# Trader makes investment plan
|
||||
trader_plan = trader.create_plan(investment_plan, market_context)
|
||||
```
|
||||
|
||||
#### Step 5: Risk Assessment
|
||||
```python
|
||||
# Risk management team evaluates
|
||||
risk_debate_state = RiskDebateState(
|
||||
risky_history="",
|
||||
safe_history="",
|
||||
neutral_history="",
|
||||
judge_decision="",
|
||||
count=0
|
||||
)
|
||||
```
|
||||
|
||||
#### Step 6: Final Decision
|
||||
```python
|
||||
# Portfolio manager makes final call
|
||||
final_decision = portfolio_manager.decide(trader_plan, risk_assessment)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Configuration Management
|
||||
|
||||
### 1. Environment Variables
|
||||
```bash
|
||||
# Required API Keys
|
||||
OPENAI_API_KEY=your_openai_api_key
|
||||
FINNHUB_API_KEY=your_finnhub_api_key
|
||||
|
||||
# Optional Environment Variables
|
||||
TRADINGAGENTS_RESULTS_DIR=./results
|
||||
ANTHROPIC_API_KEY=your_anthropic_key
|
||||
GOOGLE_API_KEY=your_google_key
|
||||
```
|
||||
|
||||
### 2. Default Configuration
|
||||
```python
|
||||
DEFAULT_CONFIG = {
|
||||
"project_dir": "path/to/project",
|
||||
"results_dir": "./results",
|
||||
"data_dir": "path/to/data",
|
||||
"data_cache_dir": "path/to/cache",
|
||||
|
||||
# LLM settings
|
||||
"llm_provider": "openai",
|
||||
"deep_think_llm": "o1-preview",
|
||||
"quick_think_llm": "gpt-4o",
|
||||
"backend_url": "https://api.openai.com/v1",
|
||||
|
||||
# Debate settings
|
||||
"max_debate_rounds": 5,
|
||||
"max_risk_discuss_rounds": 5,
|
||||
"max_recur_limit": 100,
|
||||
|
||||
# Tool settings
|
||||
"online_tools": True,
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Runtime Configuration
|
||||
```python
|
||||
# Custom configuration example
|
||||
config = DEFAULT_CONFIG.copy()
|
||||
config.update({
|
||||
"deep_think_llm": "gpt-4o-mini", # Cost-effective option
|
||||
"max_debate_rounds": 3, # Faster execution
|
||||
"online_tools": False, # Use cached data
|
||||
})
|
||||
|
||||
# Initialize with custom config
|
||||
ta = TradingAgentsGraph(config=config)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## API & Integration
|
||||
|
||||
### 1. Core API Interface
|
||||
```python
|
||||
from tradingagents.graph.trading_graph import TradingAgentsGraph
|
||||
|
||||
# Initialize
|
||||
ta = TradingAgentsGraph(
|
||||
selected_analysts=["market", "social", "news", "fundamentals"],
|
||||
debug=True,
|
||||
config=config
|
||||
)
|
||||
|
||||
# Execute analysis
|
||||
final_state, decision = ta.propagate("AAPL", "2024-01-15")
|
||||
```
|
||||
|
||||
### 2. CLI Interface
|
||||
```bash
|
||||
# Interactive CLI
|
||||
python -m cli.main
|
||||
|
||||
# Available commands
|
||||
python -m cli.main --help
|
||||
```
|
||||
|
||||
### 3. Web Interface (Chainlit)
|
||||
```python
|
||||
# Chainlit integration for web interface
|
||||
import chainlit as cl
|
||||
from tradingagents.graph.trading_graph import TradingAgentsGraph
|
||||
|
||||
@cl.on_message
|
||||
async def main(message: cl.Message):
|
||||
# Process trading request
|
||||
pass
|
||||
```
|
||||
|
||||
### 4. Data Provider Integrations
|
||||
|
||||
#### Yahoo Finance
|
||||
```python
|
||||
def get_YFin_data_online(symbol, start_date, end_date):
|
||||
ticker = yf.Ticker(symbol)
|
||||
data = ticker.history(start=start_date, end=end_date)
|
||||
return data
|
||||
```
|
||||
|
||||
#### Finnhub
|
||||
```python
|
||||
def get_finnhub_news(ticker, curr_date, look_back_days):
|
||||
# Fetch news data from Finnhub API
|
||||
pass
|
||||
```
|
||||
|
||||
#### Reddit
|
||||
```python
|
||||
def get_reddit_stock_info(ticker, curr_date):
|
||||
# Fetch social sentiment from Reddit
|
||||
pass
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Development Patterns
|
||||
|
||||
### 1. Agent Development Pattern
|
||||
```python
|
||||
class BaseAgent:
|
||||
def __init__(self, llm, toolkit, memory):
|
||||
self.llm = llm
|
||||
self.toolkit = toolkit
|
||||
self.memory = memory
|
||||
|
||||
def analyze(self, data):
|
||||
# Agent-specific analysis logic
|
||||
pass
|
||||
|
||||
def generate_report(self, analysis):
|
||||
# Generate structured report
|
||||
pass
|
||||
```
|
||||
|
||||
### 2. Memory Management Pattern
|
||||
```python
|
||||
class FinancialSituationMemory:
|
||||
def __init__(self, name, config):
|
||||
self.client = OpenAI(base_url=config["backend_url"])
|
||||
self.chroma_client = chromadb.Client()
|
||||
self.collection = self.chroma_client.create_collection(name=name)
|
||||
|
||||
def add_situations(self, situations_and_advice):
|
||||
# Store financial situations and advice
|
||||
pass
|
||||
|
||||
def retrieve_similar_situations(self, query):
|
||||
# Vector similarity search
|
||||
pass
|
||||
```
|
||||
|
||||
### 3. Tool Integration Pattern
|
||||
```python
|
||||
class Toolkit:
|
||||
def __init__(self, config):
|
||||
self.config = config
|
||||
self.online_tools = config.get("online_tools", True)
|
||||
|
||||
def get_data(self, source, *args, **kwargs):
|
||||
if self.online_tools:
|
||||
return self._get_online_data(source, *args, **kwargs)
|
||||
else:
|
||||
return self._get_cached_data(source, *args, **kwargs)
|
||||
```
|
||||
|
||||
### 4. State Management Pattern
|
||||
```python
|
||||
def update_state(current_state, new_data):
|
||||
"""Update agent state with new information"""
|
||||
updated_state = current_state.copy()
|
||||
updated_state.update(new_data)
|
||||
return updated_state
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Deployment & Scaling
|
||||
|
||||
### 1. Local Development
|
||||
```bash
|
||||
# Setup virtual environment
|
||||
uv venv .venv
|
||||
source .venv/bin/activate
|
||||
|
||||
# Install dependencies
|
||||
uv sync
|
||||
|
||||
# Run CLI
|
||||
python -m cli.main
|
||||
```
|
||||
|
||||
### 2. Docker Deployment
|
||||
```dockerfile
|
||||
FROM python:3.10-slim
|
||||
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
CMD ["python", "-m", "cli.main"]
|
||||
```
|
||||
|
||||
### 3. Scaling Considerations
|
||||
|
||||
#### Horizontal Scaling
|
||||
- Agent parallelization for multiple stocks
|
||||
- Distributed data fetching
|
||||
- Load balancing across multiple instances
|
||||
|
||||
#### Vertical Scaling
|
||||
- Memory optimization for large datasets
|
||||
- GPU acceleration for LLM inference
|
||||
- Caching strategies for frequent data access
|
||||
|
||||
#### Performance Optimization
|
||||
```python
|
||||
# Concurrent data fetching
|
||||
with ThreadPoolExecutor(max_workers=4) as executor:
|
||||
futures = [
|
||||
executor.submit(get_market_data, ticker),
|
||||
executor.submit(get_news_data, ticker),
|
||||
executor.submit(get_social_data, ticker),
|
||||
executor.submit(get_fundamentals_data, ticker)
|
||||
]
|
||||
results = [future.result() for future in futures]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### 1. Common Issues
|
||||
|
||||
#### API Key Issues
|
||||
```bash
|
||||
# Check environment variables
|
||||
echo $OPENAI_API_KEY
|
||||
echo $FINNHUB_API_KEY
|
||||
|
||||
# Load from .env file
|
||||
source .env
|
||||
```
|
||||
|
||||
#### Memory Issues
|
||||
```python
|
||||
# Monitor memory usage
|
||||
import psutil
|
||||
print(f"Memory usage: {psutil.Process().memory_info().rss / 1024 / 1024:.2f} MB")
|
||||
```
|
||||
|
||||
#### Rate Limiting
|
||||
```python
|
||||
# Implement exponential backoff
|
||||
import time
|
||||
import random
|
||||
|
||||
def retry_with_backoff(func, max_retries=3):
|
||||
for attempt in range(max_retries):
|
||||
try:
|
||||
return func()
|
||||
except RateLimitError:
|
||||
wait_time = (2 ** attempt) + random.uniform(0, 1)
|
||||
time.sleep(wait_time)
|
||||
raise Exception("Max retries exceeded")
|
||||
```
|
||||
|
||||
### 2. Debugging Tips
|
||||
|
||||
#### Enable Debug Mode
|
||||
```python
|
||||
ta = TradingAgentsGraph(debug=True, config=config)
|
||||
```
|
||||
|
||||
#### Logging Configuration
|
||||
```python
|
||||
import logging
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
```
|
||||
|
||||
#### State Inspection
|
||||
```python
|
||||
# Inspect intermediate states
|
||||
for chunk in ta.graph.stream(initial_state):
|
||||
print(chunk)
|
||||
```
|
||||
|
||||
### 3. Performance Monitoring
|
||||
|
||||
#### Execution Time Tracking
|
||||
```python
|
||||
import time
|
||||
|
||||
start_time = time.time()
|
||||
final_state, decision = ta.propagate("AAPL", "2024-01-15")
|
||||
execution_time = time.time() - start_time
|
||||
print(f"Execution time: {execution_time:.2f} seconds")
|
||||
```
|
||||
|
||||
#### Memory Profiling
|
||||
```python
|
||||
from memory_profiler import profile
|
||||
|
||||
@profile
|
||||
def run_analysis():
|
||||
ta = TradingAgentsGraph()
|
||||
return ta.propagate("AAPL", "2024-01-15")
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Best Practices
|
||||
|
||||
### 1. Configuration Management
|
||||
- Use environment variables for sensitive data
|
||||
- Implement configuration validation
|
||||
- Provide sensible defaults
|
||||
- Document configuration options
|
||||
|
||||
### 2. Error Handling
|
||||
- Implement comprehensive error handling
|
||||
- Use structured logging
|
||||
- Provide meaningful error messages
|
||||
- Implement retry mechanisms
|
||||
|
||||
### 3. Testing
|
||||
- Unit tests for individual agents
|
||||
- Integration tests for the full pipeline
|
||||
- Mock external API calls
|
||||
- Performance testing
|
||||
|
||||
### 4. Security
|
||||
- Never commit API keys to version control
|
||||
- Use secure credential management
|
||||
- Implement rate limiting
|
||||
- Validate all inputs
|
||||
|
||||
### 5. Documentation
|
||||
- Maintain up-to-date documentation
|
||||
- Include code examples
|
||||
- Document API changes
|
||||
- Provide troubleshooting guides
|
||||
|
||||
---
|
||||
|
||||
This documentation provides a comprehensive overview of the TradingAgents framework, covering its architecture, technologies, design patterns, and operational aspects. The system represents a sophisticated approach to algorithmic trading using multi-agent AI systems, designed for research and educational purposes.
|
||||
|
|
@ -0,0 +1,150 @@
|
|||
# TradingAgents Simplified CLI Guide
|
||||
|
||||
## 🚀 Quick Start (Simplified Mode)
|
||||
|
||||
The TradingAgents CLI has been simplified for faster and easier usage. Now you only need to provide one input: **the ticker symbol**.
|
||||
|
||||
### Basic Usage
|
||||
|
||||
```bash
|
||||
# Run with default settings
|
||||
python -m cli.main
|
||||
|
||||
# The CLI will prompt you for just the ticker symbol:
|
||||
# Enter ticker symbol (default: SPY): AAPL
|
||||
```
|
||||
|
||||
### What Gets Applied Automatically
|
||||
|
||||
When you use the simplified mode, these optimal defaults are automatically applied:
|
||||
|
||||
| Parameter | Default Value | Description |
|
||||
|-----------|---------------|-------------|
|
||||
| **Date** | Today's date | Uses the latest trading day |
|
||||
| **Analysts** | All 4 analysts | Market, Social, News, Fundamentals |
|
||||
| **Research Depth** | 5 rounds | Deep analysis with comprehensive debates |
|
||||
| **LLM Provider** | OpenAI | Most reliable and capable provider |
|
||||
| **Quick Thinking** | GPT-4o | Fast model for routine tasks |
|
||||
| **Deep Thinking** | o3 | Advanced reasoning model for complex analysis |
|
||||
|
||||
### Example Workflow
|
||||
|
||||
1. **Run the command:**
|
||||
```bash
|
||||
python -m cli.main
|
||||
```
|
||||
|
||||
2. **See the welcome screen** with project information
|
||||
|
||||
3. **Enter your ticker symbol:**
|
||||
```
|
||||
Enter Ticker Symbol
|
||||
Enter the stock ticker you want to analyze (e.g., AAPL, TSLA, SPY)
|
||||
Default: SPY
|
||||
|
||||
[SPY]: AAPL
|
||||
```
|
||||
|
||||
4. **Review the auto-configuration:**
|
||||
```
|
||||
Configuration:
|
||||
• Ticker: AAPL
|
||||
• Date: 2025-01-26 (latest trading day)
|
||||
• Analysts: All analysts (Market, Social, News, Fundamentals)
|
||||
• Research Depth: Deep (5 rounds of debate)
|
||||
• LLM Provider: OpenAI
|
||||
• Quick Thinking: GPT-4o
|
||||
• Deep Thinking: o3
|
||||
|
||||
Starting analysis with optimized settings...
|
||||
```
|
||||
|
||||
5. **Watch the analysis proceed** through all stages automatically
|
||||
|
||||
## 🔧 Advanced Mode (Optional)
|
||||
|
||||
If you need full control over the configuration, use the advanced mode:
|
||||
|
||||
```bash
|
||||
# Run with advanced configuration options
|
||||
python -m cli.main --advanced
|
||||
```
|
||||
|
||||
This will present the full step-by-step configuration interface where you can customize:
|
||||
- Analysis date
|
||||
- Specific analysts to include
|
||||
- Research depth levels
|
||||
- LLM provider choice
|
||||
- Specific model selections
|
||||
|
||||
## 💡 Benefits of Simplified Mode
|
||||
|
||||
- **⚡ Faster**: No need to go through 6 configuration steps
|
||||
- **🎯 Focused**: Just enter the stock you want to analyze
|
||||
- **🧠 Optimized**: Uses the best-performing configuration
|
||||
- **👥 Beginner-friendly**: Perfect for new users
|
||||
- **🔄 Consistent**: Same high-quality analysis every time
|
||||
|
||||
## 🛠️ Command Options
|
||||
|
||||
```bash
|
||||
# Default simplified mode
|
||||
python -m cli.main
|
||||
|
||||
# Advanced configuration mode
|
||||
python -m cli.main --advanced
|
||||
python -m cli.main -a
|
||||
|
||||
# Specific analyze command (same as default)
|
||||
python -m cli.main analyze
|
||||
|
||||
# Advanced analyze command
|
||||
python -m cli.main analyze --advanced
|
||||
|
||||
# Help and usage
|
||||
python -m cli.main --help
|
||||
```
|
||||
|
||||
## 📊 What You Get
|
||||
|
||||
The simplified mode provides the same comprehensive analysis as the advanced mode:
|
||||
|
||||
1. **📈 Market Analysis**: Technical indicators, price trends, trading volume
|
||||
2. **💭 Social Sentiment**: Reddit discussions, social media sentiment
|
||||
3. **📰 News Analysis**: Recent news impact, global events
|
||||
4. **💰 Fundamentals**: Financial metrics, company performance
|
||||
5. **🔬 Research Debate**: Bull vs Bear perspectives
|
||||
6. **💼 Trading Plan**: Specific investment recommendations
|
||||
7. **⚖️ Risk Assessment**: Multi-perspective risk evaluation
|
||||
8. **📋 Final Decision**: Portfolio management recommendation
|
||||
|
||||
## 🎯 Perfect For
|
||||
|
||||
- **Day traders** who need quick analysis
|
||||
- **Researchers** doing multiple stock analyses
|
||||
- **Students** learning about algorithmic trading
|
||||
- **Developers** integrating into automated workflows
|
||||
- **Anyone** who wants powerful analysis without complexity
|
||||
|
||||
## 🔄 Migration from Old Interface
|
||||
|
||||
If you were using the old multi-step interface:
|
||||
|
||||
**Before (6 steps):**
|
||||
```bash
|
||||
python -m cli.main
|
||||
# Step 1: Enter ticker
|
||||
# Step 2: Enter date
|
||||
# Step 3: Select analysts
|
||||
# Step 4: Select research depth
|
||||
# Step 5: Select LLM provider
|
||||
# Step 6: Select thinking agents
|
||||
```
|
||||
|
||||
**Now (1 step):**
|
||||
```bash
|
||||
python -m cli.main
|
||||
# Just enter ticker - everything else is optimized automatically!
|
||||
```
|
||||
|
||||
The new simplified interface reduces user input by 83% while maintaining the same analytical power!
|
||||
|
|
@ -0,0 +1,556 @@
|
|||
# TradingAgents - Feature Roadmap & TODO
|
||||
|
||||
## 🚀 Upcoming Features
|
||||
|
||||
### ⭐ **Coming Soon - Exciting New Features!**
|
||||
- 📱 **Mobile App with Broker Integration**: Link your existing broker accounts for automatic portfolio import and personalized trading advice
|
||||
- ☁️ **Cloud-Based Daily Notifications**: AI agents running 24/7 in the cloud, sending you daily market briefings and position updates
|
||||
|
||||
### Priority Levels
|
||||
- 🔴 **High Priority** - Core functionality enhancements
|
||||
- 🟡 **Medium Priority** - User experience improvements
|
||||
- 🟢 **Low Priority** - Nice-to-have features
|
||||
|
||||
---
|
||||
|
||||
## 🔴 1. Portfolio & Trading History Integration
|
||||
|
||||
### 1.1 User Position Management
|
||||
**Status:** 📋 Planning Phase
|
||||
**Timeline:** Q2 2025
|
||||
**Priority:** 🔴 High
|
||||
|
||||
#### Features:
|
||||
- [ ] **Position Input Interface**
|
||||
- [ ] CLI interface for position entry
|
||||
- [ ] Web form for portfolio input
|
||||
- [ ] CSV/JSON import functionality
|
||||
- [ ] Real-time portfolio sync with brokers (TD Ameritrade, Interactive Brokers)
|
||||
|
||||
- [ ] **Position Data Structure**
|
||||
```python
|
||||
class UserPosition:
|
||||
ticker: str
|
||||
quantity: float
|
||||
average_cost: float
|
||||
current_value: float
|
||||
unrealized_pnl: float
|
||||
entry_date: datetime
|
||||
position_type: str # "long", "short", "options"
|
||||
```
|
||||
|
||||
- [ ] **Trading History Tracking**
|
||||
- [ ] Historical trade records
|
||||
- [ ] Performance analytics
|
||||
- [ ] Win/loss ratios
|
||||
- [ ] Risk-adjusted returns
|
||||
|
||||
#### Technical Implementation:
|
||||
- [ ] Database schema design for positions
|
||||
- [ ] Position storage (SQLite → PostgreSQL migration)
|
||||
- [ ] API endpoints for position CRUD operations
|
||||
- [ ] Real-time position value updates
|
||||
|
||||
### 1.2 Portfolio Management Agent
|
||||
**Status:** 📋 Planning Phase
|
||||
**Timeline:** Q2 2025
|
||||
**Priority:** 🔴 High
|
||||
|
||||
#### Features:
|
||||
- [ ] **Portfolio Agent** (`tradingagents/agents/portfolio/portfolio_manager.py`)
|
||||
- [ ] Position size calculations
|
||||
- [ ] Correlation analysis with existing holdings
|
||||
- [ ] Sector/geographic diversification checks
|
||||
- [ ] Risk budget allocation
|
||||
- [ ] Rebalancing recommendations
|
||||
|
||||
- [ ] **Integration with Analysis Pipeline**
|
||||
- [ ] Feed current positions to all analysts
|
||||
- [ ] Position-aware risk management
|
||||
- [ ] Personalized trading recommendations
|
||||
- [ ] Exit strategy suggestions for existing positions
|
||||
|
||||
#### Data Flow Enhancement:
|
||||
```python
|
||||
class EnhancedAgentState(AgentState):
|
||||
user_portfolio: List[UserPosition]
|
||||
portfolio_analytics: PortfolioMetrics
|
||||
position_specific_insights: Dict[str, str]
|
||||
correlation_analysis: Dict[str, float]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔴 2. Advanced Technical Analysis Enhancement
|
||||
|
||||
### 2.1 Enhanced Market Analyst
|
||||
**Status:** 📋 Planning Phase
|
||||
**Timeline:** Q1 2025
|
||||
**Priority:** 🔴 High
|
||||
|
||||
#### New Technical Indicators:
|
||||
- [ ] **Momentum Indicators**
|
||||
- [ ] Relative Strength Index (RSI) variations
|
||||
- [ ] Williams %R
|
||||
- [ ] Rate of Change (ROC)
|
||||
- [ ] Commodity Channel Index (CCI)
|
||||
- [ ] Stochastic Oscillator (Fast/Slow)
|
||||
|
||||
- [ ] **Trend Indicators**
|
||||
- [ ] Ichimoku Cloud analysis
|
||||
- [ ] Parabolic SAR
|
||||
- [ ] Average Directional Index (ADX)
|
||||
- [ ] MACD variations (Signal line, histogram)
|
||||
- [ ] Moving Average convergence patterns
|
||||
|
||||
- [ ] **Volume Indicators**
|
||||
- [ ] On-Balance Volume (OBV)
|
||||
- [ ] Volume Rate of Change
|
||||
- [ ] Accumulation/Distribution Line
|
||||
- [ ] Money Flow Index (MFI)
|
||||
- [ ] Chaikin Money Flow
|
||||
|
||||
- [ ] **Volatility Indicators**
|
||||
- [ ] Bollinger Bands (multiple timeframes)
|
||||
- [ ] Average True Range (ATR)
|
||||
- [ ] Volatility Index
|
||||
- [ ] Keltner Channels
|
||||
- [ ] Donchian Channels
|
||||
|
||||
#### Advanced Calculations:
|
||||
- [ ] **Multi-timeframe Analysis**
|
||||
- [ ] 1min, 5min, 15min, 1hr, 4hr, daily, weekly analysis
|
||||
- [ ] Timeframe correlation scoring
|
||||
- [ ] Trend alignment across timeframes
|
||||
|
||||
- [ ] **Pattern Recognition**
|
||||
- [ ] Candlestick pattern detection (50+ patterns)
|
||||
- [ ] Chart pattern recognition (triangles, flags, channels)
|
||||
- [ ] Support/resistance level identification
|
||||
- [ ] Fibonacci retracement analysis
|
||||
|
||||
- [ ] **Statistical Analysis**
|
||||
- [ ] Standard deviation calculations
|
||||
- [ ] Z-score analysis
|
||||
- [ ] Regression analysis
|
||||
- [ ] Correlation with market indices
|
||||
|
||||
#### Implementation:
|
||||
```python
|
||||
class AdvancedMarketAnalyst:
|
||||
def __init__(self):
|
||||
self.indicators = {
|
||||
"momentum": MomentumIndicators(),
|
||||
"trend": TrendIndicators(),
|
||||
"volume": VolumeIndicators(),
|
||||
"volatility": VolatilityIndicators()
|
||||
}
|
||||
self.pattern_detector = PatternDetector()
|
||||
self.timeframe_analyzer = MultiTimeframeAnalyzer()
|
||||
```
|
||||
|
||||
### 2.2 Enhanced Data Pipeline
|
||||
**Status:** 📋 Planning Phase
|
||||
**Timeline:** Q1 2025
|
||||
**Priority:** 🟡 Medium
|
||||
|
||||
- [ ] **Real-time Data Feeds**
|
||||
- [ ] Alpha Vantage integration
|
||||
- [ ] Polygon.io integration
|
||||
- [ ] IEX Cloud integration
|
||||
- [ ] WebSocket data streams
|
||||
|
||||
- [ ] **Data Quality & Validation**
|
||||
- [ ] Data completeness checks
|
||||
- [ ] Outlier detection
|
||||
- [ ] Data source reliability scoring
|
||||
- [ ] Automatic data source failover
|
||||
|
||||
---
|
||||
|
||||
## 🟡 3. Celebrity Trading Strategy Agents
|
||||
|
||||
### 3.1 Warren Buffett Strategy Agent
|
||||
**Status:** 📋 Planning Phase
|
||||
**Timeline:** Q3 2025
|
||||
**Priority:** 🟡 Medium
|
||||
|
||||
#### Strategy Characteristics:
|
||||
- [ ] **Value Investing Focus**
|
||||
- [ ] P/E ratio analysis (prefer < 15)
|
||||
- [ ] Price-to-Book ratio evaluation
|
||||
- [ ] Debt-to-equity analysis
|
||||
- [ ] Return on Equity (ROE) assessment
|
||||
- [ ] Free cash flow analysis
|
||||
|
||||
- [ ] **Quality Company Metrics**
|
||||
- [ ] Competitive moats identification
|
||||
- [ ] Management quality assessment
|
||||
- [ ] Business model sustainability
|
||||
- [ ] Brand strength evaluation
|
||||
- [ ] Market position analysis
|
||||
|
||||
- [ ] **Long-term Perspective**
|
||||
- [ ] 5-10 year outlook analysis
|
||||
- [ ] Industry trend evaluation
|
||||
- [ ] Economic cycle positioning
|
||||
- [ ] Dividend sustainability
|
||||
|
||||
#### Implementation:
|
||||
```python
|
||||
class BuffettStrategyAgent:
|
||||
strategy_name = "Value Investing (Buffett Style)"
|
||||
investment_horizon = "5-10 years"
|
||||
risk_tolerance = "low-moderate"
|
||||
|
||||
def analyze(self, data):
|
||||
return {
|
||||
"intrinsic_value": self.calculate_intrinsic_value(data),
|
||||
"margin_of_safety": self.calculate_margin_of_safety(data),
|
||||
"quality_score": self.assess_company_quality(data),
|
||||
"moat_strength": self.evaluate_competitive_moat(data)
|
||||
}
|
||||
```
|
||||
|
||||
### 3.2 Cathie Wood (ARK) Strategy Agent
|
||||
**Status:** 📋 Planning Phase
|
||||
**Timeline:** Q3 2025
|
||||
**Priority:** 🟡 Medium
|
||||
|
||||
#### Strategy Characteristics:
|
||||
- [ ] **Innovation Focus**
|
||||
- [ ] Disruptive technology identification
|
||||
- [ ] Total Addressable Market (TAM) analysis
|
||||
- [ ] Technology adoption curves
|
||||
- [ ] Patent portfolio analysis
|
||||
- [ ] R&D investment evaluation
|
||||
|
||||
- [ ] **Growth Metrics**
|
||||
- [ ] Revenue growth acceleration
|
||||
- [ ] Market share expansion
|
||||
- [ ] User/subscriber growth
|
||||
- [ ] Network effects analysis
|
||||
- [ ] Scalability assessment
|
||||
|
||||
- [ ] **Future Trends**
|
||||
- [ ] AI/ML adoption potential
|
||||
- [ ] Genomics revolution impact
|
||||
- [ ] Energy storage opportunities
|
||||
- [ ] Autonomous technology development
|
||||
- [ ] Space economy participation
|
||||
|
||||
### 3.3 Additional Strategy Agents (Future)
|
||||
**Status:** 💭 Concept Phase
|
||||
**Timeline:** Q4 2025
|
||||
**Priority:** 🟢 Low
|
||||
|
||||
- [ ] **Ray Dalio (Bridgewater) - Risk Parity Agent**
|
||||
- [ ] Macroeconomic analysis
|
||||
- [ ] Risk-weighted allocation
|
||||
- [ ] Correlation-based diversification
|
||||
|
||||
- [ ] **Peter Lynch - Growth at Reasonable Price Agent**
|
||||
- [ ] PEG ratio analysis
|
||||
- [ ] Sector rotation strategies
|
||||
- [ ] Small-cap opportunity identification
|
||||
|
||||
- [ ] **George Soros - Reflexivity Theory Agent**
|
||||
- [ ] Market sentiment analysis
|
||||
- [ ] Boom-bust cycle identification
|
||||
- [ ] Currency correlation analysis
|
||||
|
||||
---
|
||||
|
||||
## 🔴 4. Cloud-Based Agent Infrastructure & Daily Notifications
|
||||
|
||||
### 4.1 Cloud Agent Deployment
|
||||
**Status:** 🚀 Coming Soon
|
||||
**Timeline:** Q2 2025
|
||||
**Priority:** 🔴 High
|
||||
|
||||
#### Features:
|
||||
- [ ] **Cloud-Native Agent Execution**
|
||||
- [ ] AWS/Azure/GCP deployment infrastructure
|
||||
- [ ] Kubernetes orchestration for agent scaling
|
||||
- [ ] Serverless functions for lightweight analysis
|
||||
- [ ] Auto-scaling based on user demand
|
||||
- [ ] Multi-region deployment for global access
|
||||
|
||||
- [ ] **Scheduled Analysis Engine**
|
||||
- [ ] Daily market analysis automation
|
||||
- [ ] Pre-market and after-hours analysis
|
||||
- [ ] Weekly portfolio review automation
|
||||
- [ ] Custom analysis scheduling (user-defined intervals)
|
||||
- [ ] Market event-triggered analysis
|
||||
|
||||
#### Technical Implementation:
|
||||
- [ ] **Microservices Architecture**
|
||||
```python
|
||||
class CloudAgentOrchestrator:
|
||||
def schedule_daily_analysis(self, user_portfolio):
|
||||
# Automated daily analysis for user positions
|
||||
pass
|
||||
|
||||
def trigger_market_event_analysis(self, event_type):
|
||||
# Real-time analysis on market events
|
||||
pass
|
||||
```
|
||||
|
||||
- [ ] **Message Queue System**
|
||||
- [ ] Apache Kafka for real-time event streaming
|
||||
- [ ] Redis for task scheduling and queuing
|
||||
- [ ] Celery for distributed task execution
|
||||
|
||||
### 4.2 Daily Notification System
|
||||
**Status:** 🚀 Coming Soon
|
||||
**Timeline:** Q2 2025
|
||||
**Priority:** 🔴 High
|
||||
|
||||
#### Features:
|
||||
- [ ] **Smart Daily Updates**
|
||||
- [ ] **Morning market briefing** (7 AM local time)
|
||||
- [ ] **Midday position alerts** (12 PM local time)
|
||||
- [ ] **After-market summary** (6 PM local time)
|
||||
- [ ] **Weekend portfolio review** (Sunday evenings)
|
||||
- [ ] **Custom alert thresholds** (price targets, volatility spikes)
|
||||
|
||||
- [ ] **Notification Channels**
|
||||
- [ ] **Mobile push notifications** (primary)
|
||||
- [ ] **Email summaries** with detailed analysis
|
||||
- [ ] **SMS alerts** for urgent market events
|
||||
- [ ] **Slack/Discord integration** for teams
|
||||
- [ ] **WhatsApp notifications** (international users)
|
||||
|
||||
- [ ] **Intelligent Alert Types**
|
||||
- [ ] **Position Performance Updates**
|
||||
- [ ] Daily P&L summary
|
||||
- [ ] Top gainers/losers in portfolio
|
||||
- [ ] Risk exposure changes
|
||||
- [ ] **Market Event Alerts**
|
||||
- [ ] Earnings announcements for holdings
|
||||
- [ ] News events affecting portfolio companies
|
||||
- [ ] Sector rotation opportunities
|
||||
- [ ] **Trading Recommendations**
|
||||
- [ ] New investment opportunities
|
||||
- [ ] Exit strategy suggestions
|
||||
- [ ] Rebalancing recommendations
|
||||
- [ ] Risk mitigation alerts
|
||||
|
||||
#### Implementation:
|
||||
```python
|
||||
class DailyNotificationService:
|
||||
def generate_morning_briefing(self, user_id):
|
||||
return {
|
||||
"market_outlook": self.get_market_analysis(),
|
||||
"portfolio_status": self.analyze_user_positions(user_id),
|
||||
"top_opportunities": self.identify_trading_opportunities(),
|
||||
"risk_alerts": self.check_portfolio_risks(user_id)
|
||||
}
|
||||
|
||||
def send_personalized_alert(self, user_id, alert_type, content):
|
||||
# Multi-channel notification delivery
|
||||
pass
|
||||
```
|
||||
|
||||
### 4.3 User Personalization Engine
|
||||
**Status:** 📋 Planning Phase
|
||||
**Timeline:** Q2 2025
|
||||
**Priority:** 🔴 High
|
||||
|
||||
#### Features:
|
||||
- [ ] **Learning User Preferences**
|
||||
- [ ] Trading style detection (value, growth, momentum)
|
||||
- [ ] Risk tolerance profiling
|
||||
- [ ] Sector preference analysis
|
||||
- [ ] Optimal notification timing
|
||||
- [ ] Preferred communication channels
|
||||
|
||||
- [ ] **Adaptive Recommendations**
|
||||
- [ ] Machine learning-based suggestion engine
|
||||
- [ ] Historical performance-based adjustments
|
||||
- [ ] Market condition adaptability
|
||||
- [ ] Personal goal alignment
|
||||
|
||||
---
|
||||
|
||||
## 🟢 5. Additional Enhancements
|
||||
|
||||
### 5.1 User Experience Improvements
|
||||
**Status:** 📋 Planning Phase
|
||||
**Timeline:** Q2 2025
|
||||
**Priority:** 🟡 Medium
|
||||
|
||||
- [ ] **Interactive Dashboard**
|
||||
- [ ] Real-time analysis progress
|
||||
- [ ] Interactive charts and visualizations
|
||||
- [ ] Portfolio performance tracking
|
||||
- [ ] Historical analysis comparison
|
||||
|
||||
- [ ] **Mobile App with Broker Integration** 📱
|
||||
- [ ] React Native mobile application
|
||||
- [ ] **Direct broker account linking** (Schwab, Fidelity, TD Ameritrade, E*TRADE, etc.)
|
||||
- [ ] **Automatic portfolio import and sync**
|
||||
- [ ] **Real-time position tracking and P&L**
|
||||
- [ ] **Personalized trading recommendations** based on current holdings
|
||||
- [ ] Push notifications for alerts and daily updates
|
||||
- [ ] Quick analysis on-the-go
|
||||
- [ ] Portfolio monitoring and analytics
|
||||
- [ ] **One-tap portfolio analysis** for any holding
|
||||
- [ ] **Position-specific exit strategies**
|
||||
|
||||
- [ ] **Integration APIs**
|
||||
- [ ] REST API for third-party integration
|
||||
- [ ] Webhook support for real-time updates
|
||||
- [ ] Trading platform integrations
|
||||
- [ ] Alert system (email, SMS, Slack)
|
||||
|
||||
### 5.2 Advanced Features
|
||||
**Status:** 💭 Concept Phase
|
||||
**Timeline:** Q4 2025
|
||||
**Priority:** 🟢 Low
|
||||
|
||||
- [ ] **Backtesting Engine**
|
||||
- [ ] Historical strategy performance
|
||||
- [ ] Risk-adjusted return metrics
|
||||
- [ ] Drawdown analysis
|
||||
- [ ] Monte Carlo simulations
|
||||
|
||||
- [ ] **Paper Trading Integration**
|
||||
- [ ] Virtual portfolio execution
|
||||
- [ ] Real-time position tracking
|
||||
- [ ] Performance benchmarking
|
||||
- [ ] Strategy validation
|
||||
|
||||
- [ ] **Social Features**
|
||||
- [ ] Strategy sharing community
|
||||
- [ ] Analysis collaboration
|
||||
- [ ] Performance leaderboards
|
||||
- [ ] Discussion forums
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Technical Infrastructure
|
||||
|
||||
### 6.1 Performance Optimization
|
||||
**Priority:** 🔴 High
|
||||
**Timeline:** Q1 2025
|
||||
|
||||
- [ ] **Caching Strategy**
|
||||
- [ ] Redis implementation for market data
|
||||
- [ ] Analysis result caching
|
||||
- [ ] Smart cache invalidation
|
||||
- [ ] Multi-level caching hierarchy
|
||||
|
||||
- [ ] **Parallel Processing**
|
||||
- [ ] Agent execution parallelization
|
||||
- [ ] Data fetching optimization
|
||||
- [ ] GPU acceleration for ML models
|
||||
- [ ] Distributed computing setup
|
||||
|
||||
### 6.2 Data Management
|
||||
**Priority:** 🟡 Medium
|
||||
**Timeline:** Q2 2025
|
||||
|
||||
- [ ] **Database Migration**
|
||||
- [ ] PostgreSQL implementation
|
||||
- [ ] Time-series database (InfluxDB)
|
||||
- [ ] Data archival strategy
|
||||
- [ ] Backup and recovery procedures
|
||||
|
||||
- [ ] **Data Pipeline Enhancement**
|
||||
- [ ] Apache Kafka for real-time streaming
|
||||
- [ ] ETL pipeline optimization
|
||||
- [ ] Data quality monitoring
|
||||
- [ ] Automated data validation
|
||||
|
||||
### 6.3 Security & Compliance
|
||||
**Priority:** 🔴 High
|
||||
**Timeline:** Q1 2025
|
||||
|
||||
- [ ] **Security Enhancements**
|
||||
- [ ] API key encryption
|
||||
- [ ] User authentication system
|
||||
- [ ] Role-based access control
|
||||
- [ ] Audit logging
|
||||
|
||||
- [ ] **Compliance Features**
|
||||
- [ ] GDPR compliance
|
||||
- [ ] Financial data regulations
|
||||
- [ ] Trade reporting capabilities
|
||||
- [ ] Risk disclosure mechanisms
|
||||
|
||||
---
|
||||
|
||||
## 📅 Implementation Timeline
|
||||
|
||||
### Q1 2025 (Jan-Mar)
|
||||
- ✅ Complete CLI simplification
|
||||
- 🔄 Enhanced technical indicators
|
||||
- 🔄 Performance optimization
|
||||
- 🔄 Security enhancements
|
||||
|
||||
### Q2 2025 (Apr-Jun)
|
||||
- 🔄 Portfolio management system
|
||||
- 🔄 User position tracking
|
||||
- 🔄 **Mobile app with broker integration** 📱
|
||||
- 🔄 **Cloud-based agents with daily notifications** ☁️
|
||||
- 🔄 Interactive dashboard
|
||||
- 🔄 Database migration
|
||||
|
||||
### Q3 2025 (Jul-Sep)
|
||||
- 🔄 Celebrity strategy agents (Buffett, Wood)
|
||||
- 🔄 Advanced pattern recognition
|
||||
- 🔄 **Full mobile app deployment** 📱
|
||||
- 🔄 API development
|
||||
|
||||
### Q4 2025 (Oct-Dec)
|
||||
- 🔄 Additional strategy agents
|
||||
- 🔄 Backtesting engine
|
||||
- 🔄 Social features
|
||||
- 🔄 Performance benchmarking
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Success Metrics
|
||||
|
||||
### User Engagement
|
||||
- [ ] Daily active users growth
|
||||
- [ ] Analysis completion rates
|
||||
- [ ] Feature adoption metrics
|
||||
- [ ] User retention rates
|
||||
|
||||
### System Performance
|
||||
- [ ] Analysis execution time < 2 minutes
|
||||
- [ ] 99.9% uptime target
|
||||
- [ ] API response time < 500ms
|
||||
- [ ] Concurrent user capacity: 1000+
|
||||
|
||||
### Analysis Quality
|
||||
- [ ] Prediction accuracy tracking
|
||||
- [ ] User satisfaction scores
|
||||
- [ ] Portfolio performance metrics
|
||||
- [ ] Risk-adjusted return improvements
|
||||
|
||||
---
|
||||
|
||||
## 💡 Innovation Ideas
|
||||
|
||||
### Future Considerations
|
||||
- [ ] **AI Model Enhancement**
|
||||
- [ ] Custom fine-tuned models for finance
|
||||
- [ ] Multi-modal analysis (text + charts)
|
||||
- [ ] Reinforcement learning for strategy optimization
|
||||
|
||||
- [ ] **Blockchain Integration**
|
||||
- [ ] DeFi protocol analysis
|
||||
- [ ] Cryptocurrency trading strategies
|
||||
- [ ] Smart contract risk assessment
|
||||
|
||||
- [ ] **ESG Integration**
|
||||
- [ ] Environmental impact scoring
|
||||
- [ ] Social responsibility metrics
|
||||
- [ ] Governance quality assessment
|
||||
|
||||
---
|
||||
|
||||
This roadmap represents our vision for evolving TradingAgents into a comprehensive, professional-grade trading analysis platform while maintaining its research-focused foundation and user-friendly approach.
|
||||
229
cli/main.py
229
cli/main.py
|
|
@ -20,6 +20,10 @@ from rich import box
|
|||
from rich.align import Align
|
||||
from rich.rule import Rule
|
||||
|
||||
# Load environment variables from .env file
|
||||
from dotenv import load_dotenv
|
||||
load_dotenv()
|
||||
|
||||
from tradingagents.graph.trading_graph import TradingAgentsGraph
|
||||
from tradingagents.default_config import DEFAULT_CONFIG
|
||||
from cli.models import AnalystType
|
||||
|
|
@ -392,7 +396,7 @@ def update_display(layout, spinner_text=None):
|
|||
|
||||
|
||||
def get_user_selections():
|
||||
"""Get all user selections before starting the analysis display."""
|
||||
"""Get user ticker selection with simplified interface and sensible defaults."""
|
||||
# Display ASCII art welcome message
|
||||
with open("./cli/static/welcome.txt", "r") as f:
|
||||
welcome_ascii = f.read()
|
||||
|
|
@ -417,68 +421,38 @@ def get_user_selections():
|
|||
console.print(Align.center(welcome_box))
|
||||
console.print() # Add a blank line after the welcome box
|
||||
|
||||
# Create a boxed questionnaire for each step
|
||||
def create_question_box(title, prompt, default=None):
|
||||
box_content = f"[bold]{title}[/bold]\n"
|
||||
box_content += f"[dim]{prompt}[/dim]"
|
||||
if default:
|
||||
box_content += f"\n[dim]Default: {default}[/dim]"
|
||||
return Panel(box_content, border_style="blue", padding=(1, 2))
|
||||
|
||||
# Step 1: Ticker symbol
|
||||
console.print(
|
||||
create_question_box(
|
||||
"Step 1: Ticker Symbol", "Enter the ticker symbol to analyze", "SPY"
|
||||
)
|
||||
# Simplified input - only ask for ticker symbol
|
||||
ticker_box = Panel(
|
||||
"[bold]Enter Ticker Symbol[/bold]\n[dim]Enter the stock ticker you want to analyze (e.g., AAPL, TSLA, SPY)[/dim]\n[dim]Default: SPY[/dim]",
|
||||
border_style="blue",
|
||||
padding=(1, 2)
|
||||
)
|
||||
console.print(ticker_box)
|
||||
selected_ticker = get_ticker()
|
||||
|
||||
# Step 2: Analysis date
|
||||
default_date = datetime.datetime.now().strftime("%Y-%m-%d")
|
||||
console.print(
|
||||
create_question_box(
|
||||
"Step 2: Analysis Date",
|
||||
"Enter the analysis date (YYYY-MM-DD)",
|
||||
default_date,
|
||||
)
|
||||
)
|
||||
analysis_date = get_analysis_date()
|
||||
# Use sensible defaults for all other parameters
|
||||
analysis_date = datetime.datetime.now().strftime("%Y-%m-%d")
|
||||
selected_analysts = [AnalystType.MARKET, AnalystType.SOCIAL, AnalystType.NEWS, AnalystType.FUNDAMENTALS]
|
||||
selected_research_depth = 5
|
||||
selected_llm_provider = "openai"
|
||||
backend_url = "https://api.openai.com/v1"
|
||||
selected_shallow_thinker = "gpt-4o"
|
||||
selected_deep_thinker = "o3"
|
||||
|
||||
# Step 3: Select analysts
|
||||
console.print(
|
||||
create_question_box(
|
||||
"Step 3: Analysts Team", "Select your LLM analyst agents for the analysis"
|
||||
)
|
||||
)
|
||||
selected_analysts = select_analysts()
|
||||
console.print(
|
||||
f"[green]Selected analysts:[/green] {', '.join(analyst.value for analyst in selected_analysts)}"
|
||||
)
|
||||
# Display the configuration being used
|
||||
config_info = f"""[bold green]Configuration:[/bold green]
|
||||
• [bold]Ticker:[/bold] {selected_ticker}
|
||||
• [bold]Date:[/bold] {analysis_date} (latest trading day)
|
||||
• [bold]Analysts:[/bold] All analysts (Market, Social, News, Fundamentals)
|
||||
• [bold]Research Depth:[/bold] Deep (5 rounds of debate)
|
||||
• [bold]LLM Provider:[/bold] OpenAI
|
||||
• [bold]Quick Thinking:[/bold] GPT-4o
|
||||
• [bold]Deep Thinking:[/bold] o3
|
||||
|
||||
# Step 4: Research depth
|
||||
console.print(
|
||||
create_question_box(
|
||||
"Step 4: Research Depth", "Select your research depth level"
|
||||
)
|
||||
)
|
||||
selected_research_depth = select_research_depth()
|
||||
[dim]Starting analysis with optimized settings...[/dim]"""
|
||||
|
||||
# Step 5: OpenAI backend
|
||||
console.print(
|
||||
create_question_box(
|
||||
"Step 5: OpenAI backend", "Select which service to talk to"
|
||||
)
|
||||
)
|
||||
selected_llm_provider, backend_url = select_llm_provider()
|
||||
|
||||
# Step 6: Thinking agents
|
||||
console.print(
|
||||
create_question_box(
|
||||
"Step 6: Thinking Agents", "Select your thinking agents for analysis"
|
||||
)
|
||||
)
|
||||
selected_shallow_thinker = select_shallow_thinking_agent(selected_llm_provider)
|
||||
selected_deep_thinker = select_deep_thinking_agent(selected_llm_provider)
|
||||
console.print(Panel(config_info, border_style="green", padding=(1, 2), title="Analysis Configuration"))
|
||||
console.print()
|
||||
|
||||
return {
|
||||
"ticker": selected_ticker,
|
||||
|
|
@ -494,7 +468,8 @@ def get_user_selections():
|
|||
|
||||
def get_ticker():
|
||||
"""Get ticker symbol from user input."""
|
||||
return typer.prompt("", default="SPY")
|
||||
ticker = typer.prompt("", default="SPY")
|
||||
return ticker.strip().upper()
|
||||
|
||||
|
||||
def get_analysis_date():
|
||||
|
|
@ -731,9 +706,113 @@ def extract_content_string(content):
|
|||
else:
|
||||
return str(content)
|
||||
|
||||
def run_analysis():
|
||||
# First get all user selections
|
||||
selections = get_user_selections()
|
||||
def get_user_selections_advanced():
|
||||
"""Get all user selections with advanced configuration options."""
|
||||
# Display ASCII art welcome message
|
||||
with open("./cli/static/welcome.txt", "r") as f:
|
||||
welcome_ascii = f.read()
|
||||
|
||||
# Create welcome box content
|
||||
welcome_content = f"{welcome_ascii}\n"
|
||||
welcome_content += "[bold green]TradingAgents: Multi-Agents LLM Financial Trading Framework - CLI (Advanced Mode)[/bold green]\n\n"
|
||||
welcome_content += "[bold]Workflow Steps:[/bold]\n"
|
||||
welcome_content += "I. Analyst Team → II. Research Team → III. Trader → IV. Risk Management → V. Portfolio Management\n\n"
|
||||
welcome_content += (
|
||||
"[dim]Built by [Tauric Research](https://github.com/TauricResearch)[/dim]"
|
||||
)
|
||||
|
||||
# Create and center the welcome box
|
||||
welcome_box = Panel(
|
||||
welcome_content,
|
||||
border_style="green",
|
||||
padding=(1, 2),
|
||||
title="Welcome to TradingAgents - Advanced Mode",
|
||||
subtitle="Multi-Agents LLM Financial Trading Framework",
|
||||
)
|
||||
console.print(Align.center(welcome_box))
|
||||
console.print() # Add a blank line after the welcome box
|
||||
|
||||
# Create a boxed questionnaire for each step
|
||||
def create_question_box(title, prompt, default=None):
|
||||
box_content = f"[bold]{title}[/bold]\n"
|
||||
box_content += f"[dim]{prompt}[/dim]"
|
||||
if default:
|
||||
box_content += f"\n[dim]Default: {default}[/dim]"
|
||||
return Panel(box_content, border_style="blue", padding=(1, 2))
|
||||
|
||||
# Step 1: Ticker symbol
|
||||
console.print(
|
||||
create_question_box(
|
||||
"Step 1: Ticker Symbol", "Enter the ticker symbol to analyze", "SPY"
|
||||
)
|
||||
)
|
||||
selected_ticker = get_ticker()
|
||||
|
||||
# Step 2: Analysis date
|
||||
default_date = datetime.datetime.now().strftime("%Y-%m-%d")
|
||||
console.print(
|
||||
create_question_box(
|
||||
"Step 2: Analysis Date",
|
||||
"Enter the analysis date (YYYY-MM-DD)",
|
||||
default_date,
|
||||
)
|
||||
)
|
||||
analysis_date = get_analysis_date()
|
||||
|
||||
# Step 3: Select analysts
|
||||
console.print(
|
||||
create_question_box(
|
||||
"Step 3: Analysts Team", "Select your LLM analyst agents for the analysis"
|
||||
)
|
||||
)
|
||||
selected_analysts = select_analysts()
|
||||
console.print(
|
||||
f"[green]Selected analysts:[/green] {', '.join(analyst.value for analyst in selected_analysts)}"
|
||||
)
|
||||
|
||||
# Step 4: Research depth
|
||||
console.print(
|
||||
create_question_box(
|
||||
"Step 4: Research Depth", "Select your research depth level"
|
||||
)
|
||||
)
|
||||
selected_research_depth = select_research_depth()
|
||||
|
||||
# Step 5: OpenAI backend
|
||||
console.print(
|
||||
create_question_box(
|
||||
"Step 5: LLM Provider", "Select which service to talk to"
|
||||
)
|
||||
)
|
||||
selected_llm_provider, backend_url = select_llm_provider()
|
||||
|
||||
# Step 6: Thinking agents
|
||||
console.print(
|
||||
create_question_box(
|
||||
"Step 6: Thinking Agents", "Select your thinking agents for analysis"
|
||||
)
|
||||
)
|
||||
selected_shallow_thinker = select_shallow_thinking_agent(selected_llm_provider)
|
||||
selected_deep_thinker = select_deep_thinking_agent(selected_llm_provider)
|
||||
|
||||
return {
|
||||
"ticker": selected_ticker,
|
||||
"analysis_date": analysis_date,
|
||||
"analysts": selected_analysts,
|
||||
"research_depth": selected_research_depth,
|
||||
"llm_provider": selected_llm_provider.lower(),
|
||||
"backend_url": backend_url,
|
||||
"shallow_thinker": selected_shallow_thinker,
|
||||
"deep_thinker": selected_deep_thinker,
|
||||
}
|
||||
|
||||
|
||||
def run_analysis(advanced_mode=False):
|
||||
# Get user selections based on mode
|
||||
if advanced_mode:
|
||||
selections = get_user_selections_advanced()
|
||||
else:
|
||||
selections = get_user_selections()
|
||||
|
||||
# Create config with selected research depth
|
||||
config = DEFAULT_CONFIG.copy()
|
||||
|
|
@ -1097,8 +1176,32 @@ def run_analysis():
|
|||
|
||||
|
||||
@app.command()
|
||||
def analyze():
|
||||
run_analysis()
|
||||
def analyze(
|
||||
advanced: bool = typer.Option(
|
||||
False,
|
||||
"--advanced",
|
||||
"-a",
|
||||
help="Use advanced configuration mode with full customization options"
|
||||
)
|
||||
):
|
||||
"""Run trading analysis with simplified or advanced configuration."""
|
||||
run_analysis(advanced_mode=advanced)
|
||||
|
||||
|
||||
@app.callback(invoke_without_command=True)
|
||||
def main(
|
||||
ctx: typer.Context,
|
||||
advanced: bool = typer.Option(
|
||||
False,
|
||||
"--advanced",
|
||||
"-a",
|
||||
help="Use advanced configuration mode with full customization options"
|
||||
)
|
||||
):
|
||||
"""TradingAgents CLI: Multi-Agents LLM Financial Trading Framework"""
|
||||
if ctx.invoked_subcommand is None:
|
||||
# Default behavior - run analysis
|
||||
run_analysis(advanced_mode=advanced)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Reference in New Issue