Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions python/configs/agent_cards/trading_agents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "TradingAgentsAdapter",
"url": "http://localhost:10002",
"description": "TradingAgents - Multi-agent trading analysis system with market, sentiment, news and fundamentals analysis",
"capabilities": {
"streaming": true,
"push_notifications": false
},
"metadata": {
"version": "1.0.0",
"author": "ValueCell Team",
"tags": ["trading", "analysis", "multi-agent", "stocks", "finance"],
"supported_tickers": ["AAPL", "GOOGL", "MSFT", "NVDA", "TSLA", "AMZN", "META", "NFLX", "SPY"],
"supported_analysts": ["market", "social", "news", "fundamentals"],
"supported_llm_providers": ["openai", "anthropic", "google", "ollama", "openrouter"]
}
}
161 changes: 161 additions & 0 deletions python/third_party/TradingAgents/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# TradingAgents Environment Configuration
# Copy this file to .env and fill in your actual values

# =============================================================================
# API KEYS (Required)
# =============================================================================

# OpenAI API Key - Required for LLM models and online data search
# Get your key from: https://platform.openai.com/api-keys
OPENAI_API_KEY=your_openai_api_key_here

# OpenAI Embeddings API Key - IMPORTANT for Memory Functionality
# This is needed when using non-OpenAI providers (OpenRouter, Anthropic, Google)
# because they don't support OpenAI's embeddings API
# If not set, the system will try to use OPENAI_API_KEY for embeddings
# Get your key from: https://platform.openai.com/api-keys
OPENAI_EMBEDDINGS_API_KEY=your_openai_embeddings_key_here

# Finnhub API Key - Required for financial news and insider trading data
# Get your free key from: https://finnhub.io/register
FINNHUB_API_KEY=your_finnhub_api_key_here

# =============================================================================
# OPTIONAL API KEYS (Only needed if using specific providers)
# ==============================================================================

# Anthropic API Key - Only needed if using Anthropic models
# Get your key from: https://console.anthropic.com/
ANTHROPIC_API_KEY=your_anthropic_api_key_here

# Google API Key - Only needed if using Google/Gemini models
# Get your key from: https://aistudio.google.com/app/apikey
GOOGLE_API_KEY=your_google_api_key_here

# =============================================================================
# DIRECTORY CONFIGURATION
# =============================================================================

# Results output directory
TRADINGAGENTS_RESULTS_DIR=./results

# Data directory - where your financial data files are stored
# This should point to your local data directory containing:
# - market_data/price_data/
# - fundamental_data/simfin_data_all/
# - reddit_data/
# - finnhub_data/
TRADINGAGENTS_DATA_DIR=./data

# =============================================================================
# LLM PROVIDER CONFIGURATION
# =============================================================================

# LLM Provider: openai, anthropic, google, ollama, openrouter
TRADINGAGENTS_LLM_PROVIDER=openai

# Backend URL for LLM API
TRADINGAGENTS_BACKEND_URL=https://api.openai.com/v1

# Deep thinking model (for complex reasoning tasks)
TRADINGAGENTS_DEEP_THINK_LLM=o4-mini

# Quick thinking model (for fast analysis tasks)
TRADINGAGENTS_QUICK_THINK_LLM=gpt-4o-mini

# =============================================================================
# ANALYSIS CONFIGURATION
# =============================================================================

# Maximum debate rounds between bull and bear researchers (1-5)
TRADINGAGENTS_MAX_DEBATE_ROUNDS=1

# Maximum risk discussion rounds between risk analysts (1-5)
TRADINGAGENTS_MAX_RISK_DISCUSS_ROUNDS=1

# Maximum recursion limit for agent interactions
TRADINGAGENTS_MAX_RECUR_LIMIT=100

# Use online tools for real-time data (true/false)
TRADINGAGENTS_ONLINE_TOOLS=true

# =============================================================================
# ALTERNATIVE LLM PROVIDER CONFIGURATIONS
# =============================================================================

# For Anthropic
# TRADINGAGENTS_LLM_PROVIDER=anthropic
# TRADINGAGENTS_BACKEND_URL=https://api.anthropic.com/
# TRADINGAGENTS_DEEP_THINK_LLM=claude-sonnet-4-0
# TRADINGAGENTS_QUICK_THINK_LLM=claude-3-5-haiku-latest

# For Google/Gemini
# TRADINGAGENTS_LLM_PROVIDER=google
# TRADINGAGENTS_BACKEND_URL=https://generativelanguage.googleapis.com/v1
# TRADINGAGENTS_DEEP_THINK_LLM=gemini-2.0-flash
# TRADINGAGENTS_QUICK_THINK_LLM=gemini-2.0-flash-lite

# For Ollama (local) - Supports both chat and embeddings locally
# TRADINGAGENTS_LLM_PROVIDER=ollama
# TRADINGAGENTS_BACKEND_URL=http://localhost:11434/v1
# TRADINGAGENTS_DEEP_THINK_LLM=llama3.1
# TRADINGAGENTS_QUICK_THINK_LLM=llama3.2
# Note: Make sure to pull the embedding model: ollama pull nomic-embed-text

# For OpenRouter - IMPORTANT: Requires separate embeddings API key
# TRADINGAGENTS_LLM_PROVIDER=openrouter
# TRADINGAGENTS_BACKEND_URL=https://openrouter.ai/api/v1
# TRADINGAGENTS_DEEP_THINK_LLM=deepseek/deepseek-chat-v3-0324:free
# TRADINGAGENTS_QUICK_THINK_LLM=meta-llama/llama-3.3-8b-instruct:free
#
# IMPORTANT NOTE FOR OPENROUTER USERS:
# OpenRouter does not support OpenAI's embeddings API, which is required for
# the memory functionality in TradingAgents. You MUST set both:
# OPENAI_API_KEY=sk-or-v1-your-openrouter-key-here (for chat models)
# OPENAI_EMBEDDINGS_API_KEY=sk-your-real-openai-key-here (for embeddings)

# For Azure OpenAI
# TRADINGAGENTS_LLM_PROVIDER=azure
# TRADINGAGENTS_BACKEND_URL=https://your-endpoint.openai.azure.com/
# TRADINGAGENTS_DEEP_THINK_LLM=gpt-4o-mini
# TRADINGAGENTS_QUICK_THINK_LLM=gpt-4o-mini
# AZURE_OPENAI_API_VERSION=2025-04-01-preview

# =============================================================================
# EMBEDDINGS API TROUBLESHOOTING
# =============================================================================

# Problem: Getting "AttributeError: 'str' object has no attribute 'data'" error?
# This happens when using providers that don't support embeddings API.

# Solution 1 - Use dedicated OpenAI key for embeddings (RECOMMENDED):
# OPENAI_API_KEY=sk-or-v1-your-openrouter-key-here
# OPENAI_EMBEDDINGS_API_KEY=sk-your-real-openai-key-here

# Solution 2 - Switch to Ollama for fully local processing:
# TRADINGAGENTS_LLM_PROVIDER=ollama
# TRADINGAGENTS_BACKEND_URL=http://localhost:11434/v1
# Then run: ollama pull llama3.1 && ollama pull nomic-embed-text

# Solution 3 - Accept limited memory functionality:
# If you don't set OPENAI_EMBEDDINGS_API_KEY, the system will use dummy
# embeddings and continue running, but memory features will be limited.

# Affected providers that need separate embeddings key:
# - OpenRouter (openrouter.ai)
# - Anthropic (api.anthropic.com)
# - Google/Gemini (generativelanguage.googleapis.com)

# Providers with built-in embeddings support:
# - OpenAI (api.openai.com) - uses same key for chat and embeddings
# - Ollama (localhost:11434) - local embeddings with nomic-embed-text

# =============================================================================
# USAGE INSTRUCTIONS
# =============================================================================
# 1. Copy this file to .env: cp .env.example .env
# 2. Fill in your actual API keys and configuration values
# 3. Make sure .env is in your .gitignore to keep your keys private
# 4. For OpenRouter users: Set both OPENAI_API_KEY and OPENAI_EMBEDDINGS_API_KEY
# 5. For Ollama users: Run 'ollama pull nomic-embed-text' for embeddings support
# 6. Run the application: python main.py or python -m cli.main
90 changes: 84 additions & 6 deletions python/third_party/TradingAgents/.gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,87 @@
env/
# Environment variables
.env
.env.local
.env.*.local

# Python
__pycache__/
*.py[cod]
*.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
*.manifest
*.spec

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# Environments
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# IDE
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
*.csv
src/
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Results and logs
results/
logs/
*.log

# Data directories
data/
dataflows/data_cache/
eval_results/
eval_data/
*.egg-info/
.env
2 changes: 1 addition & 1 deletion python/third_party/TradingAgents/.python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.10
3.12
1 change: 1 addition & 0 deletions python/third_party/TradingAgents/adapter/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# TradingAgents Adapter Package
Loading