Skip to content

Commit 85f36a4

Browse files
authored
Feat/adapt core tradingagents (#14)
1 parent a6eb62b commit 85f36a4

20 files changed

Lines changed: 3457 additions & 2324 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "TradingAgentsAdapter",
3+
"url": "http://localhost:10002",
4+
"description": "TradingAgents - Multi-agent trading analysis system with market, sentiment, news and fundamentals analysis",
5+
"capabilities": {
6+
"streaming": true,
7+
"push_notifications": false
8+
},
9+
"metadata": {
10+
"version": "1.0.0",
11+
"author": "ValueCell Team",
12+
"tags": ["trading", "analysis", "multi-agent", "stocks", "finance"],
13+
"supported_tickers": ["AAPL", "GOOGL", "MSFT", "NVDA", "TSLA", "AMZN", "META", "NFLX", "SPY"],
14+
"supported_analysts": ["market", "social", "news", "fundamentals"],
15+
"supported_llm_providers": ["openai", "anthropic", "google", "ollama", "openrouter"]
16+
}
17+
}
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
# TradingAgents Environment Configuration
2+
# Copy this file to .env and fill in your actual values
3+
4+
# =============================================================================
5+
# API KEYS (Required)
6+
# =============================================================================
7+
8+
# OpenAI API Key - Required for LLM models and online data search
9+
# Get your key from: https://platform.openai.com/api-keys
10+
OPENAI_API_KEY=your_openai_api_key_here
11+
12+
# OpenAI Embeddings API Key - IMPORTANT for Memory Functionality
13+
# This is needed when using non-OpenAI providers (OpenRouter, Anthropic, Google)
14+
# because they don't support OpenAI's embeddings API
15+
# If not set, the system will try to use OPENAI_API_KEY for embeddings
16+
# Get your key from: https://platform.openai.com/api-keys
17+
OPENAI_EMBEDDINGS_API_KEY=your_openai_embeddings_key_here
18+
19+
# Finnhub API Key - Required for financial news and insider trading data
20+
# Get your free key from: https://finnhub.io/register
21+
FINNHUB_API_KEY=your_finnhub_api_key_here
22+
23+
# =============================================================================
24+
# OPTIONAL API KEYS (Only needed if using specific providers)
25+
# ==============================================================================
26+
27+
# Anthropic API Key - Only needed if using Anthropic models
28+
# Get your key from: https://console.anthropic.com/
29+
ANTHROPIC_API_KEY=your_anthropic_api_key_here
30+
31+
# Google API Key - Only needed if using Google/Gemini models
32+
# Get your key from: https://aistudio.google.com/app/apikey
33+
GOOGLE_API_KEY=your_google_api_key_here
34+
35+
# =============================================================================
36+
# DIRECTORY CONFIGURATION
37+
# =============================================================================
38+
39+
# Results output directory
40+
TRADINGAGENTS_RESULTS_DIR=./results
41+
42+
# Data directory - where your financial data files are stored
43+
# This should point to your local data directory containing:
44+
# - market_data/price_data/
45+
# - fundamental_data/simfin_data_all/
46+
# - reddit_data/
47+
# - finnhub_data/
48+
TRADINGAGENTS_DATA_DIR=./data
49+
50+
# =============================================================================
51+
# LLM PROVIDER CONFIGURATION
52+
# =============================================================================
53+
54+
# LLM Provider: openai, anthropic, google, ollama, openrouter
55+
TRADINGAGENTS_LLM_PROVIDER=openai
56+
57+
# Backend URL for LLM API
58+
TRADINGAGENTS_BACKEND_URL=https://api.openai.com/v1
59+
60+
# Deep thinking model (for complex reasoning tasks)
61+
TRADINGAGENTS_DEEP_THINK_LLM=o4-mini
62+
63+
# Quick thinking model (for fast analysis tasks)
64+
TRADINGAGENTS_QUICK_THINK_LLM=gpt-4o-mini
65+
66+
# =============================================================================
67+
# ANALYSIS CONFIGURATION
68+
# =============================================================================
69+
70+
# Maximum debate rounds between bull and bear researchers (1-5)
71+
TRADINGAGENTS_MAX_DEBATE_ROUNDS=1
72+
73+
# Maximum risk discussion rounds between risk analysts (1-5)
74+
TRADINGAGENTS_MAX_RISK_DISCUSS_ROUNDS=1
75+
76+
# Maximum recursion limit for agent interactions
77+
TRADINGAGENTS_MAX_RECUR_LIMIT=100
78+
79+
# Use online tools for real-time data (true/false)
80+
TRADINGAGENTS_ONLINE_TOOLS=true
81+
82+
# =============================================================================
83+
# ALTERNATIVE LLM PROVIDER CONFIGURATIONS
84+
# =============================================================================
85+
86+
# For Anthropic
87+
# TRADINGAGENTS_LLM_PROVIDER=anthropic
88+
# TRADINGAGENTS_BACKEND_URL=https://api.anthropic.com/
89+
# TRADINGAGENTS_DEEP_THINK_LLM=claude-sonnet-4-0
90+
# TRADINGAGENTS_QUICK_THINK_LLM=claude-3-5-haiku-latest
91+
92+
# For Google/Gemini
93+
# TRADINGAGENTS_LLM_PROVIDER=google
94+
# TRADINGAGENTS_BACKEND_URL=https://generativelanguage.googleapis.com/v1
95+
# TRADINGAGENTS_DEEP_THINK_LLM=gemini-2.0-flash
96+
# TRADINGAGENTS_QUICK_THINK_LLM=gemini-2.0-flash-lite
97+
98+
# For Ollama (local) - Supports both chat and embeddings locally
99+
# TRADINGAGENTS_LLM_PROVIDER=ollama
100+
# TRADINGAGENTS_BACKEND_URL=http://localhost:11434/v1
101+
# TRADINGAGENTS_DEEP_THINK_LLM=llama3.1
102+
# TRADINGAGENTS_QUICK_THINK_LLM=llama3.2
103+
# Note: Make sure to pull the embedding model: ollama pull nomic-embed-text
104+
105+
# For OpenRouter - IMPORTANT: Requires separate embeddings API key
106+
# TRADINGAGENTS_LLM_PROVIDER=openrouter
107+
# TRADINGAGENTS_BACKEND_URL=https://openrouter.ai/api/v1
108+
# TRADINGAGENTS_DEEP_THINK_LLM=deepseek/deepseek-chat-v3-0324:free
109+
# TRADINGAGENTS_QUICK_THINK_LLM=meta-llama/llama-3.3-8b-instruct:free
110+
#
111+
# IMPORTANT NOTE FOR OPENROUTER USERS:
112+
# OpenRouter does not support OpenAI's embeddings API, which is required for
113+
# the memory functionality in TradingAgents. You MUST set both:
114+
# OPENAI_API_KEY=sk-or-v1-your-openrouter-key-here (for chat models)
115+
# OPENAI_EMBEDDINGS_API_KEY=sk-your-real-openai-key-here (for embeddings)
116+
117+
# For Azure OpenAI
118+
# TRADINGAGENTS_LLM_PROVIDER=azure
119+
# TRADINGAGENTS_BACKEND_URL=https://your-endpoint.openai.azure.com/
120+
# TRADINGAGENTS_DEEP_THINK_LLM=gpt-4o-mini
121+
# TRADINGAGENTS_QUICK_THINK_LLM=gpt-4o-mini
122+
# AZURE_OPENAI_API_VERSION=2025-04-01-preview
123+
124+
# =============================================================================
125+
# EMBEDDINGS API TROUBLESHOOTING
126+
# =============================================================================
127+
128+
# Problem: Getting "AttributeError: 'str' object has no attribute 'data'" error?
129+
# This happens when using providers that don't support embeddings API.
130+
131+
# Solution 1 - Use dedicated OpenAI key for embeddings (RECOMMENDED):
132+
# OPENAI_API_KEY=sk-or-v1-your-openrouter-key-here
133+
# OPENAI_EMBEDDINGS_API_KEY=sk-your-real-openai-key-here
134+
135+
# Solution 2 - Switch to Ollama for fully local processing:
136+
# TRADINGAGENTS_LLM_PROVIDER=ollama
137+
# TRADINGAGENTS_BACKEND_URL=http://localhost:11434/v1
138+
# Then run: ollama pull llama3.1 && ollama pull nomic-embed-text
139+
140+
# Solution 3 - Accept limited memory functionality:
141+
# If you don't set OPENAI_EMBEDDINGS_API_KEY, the system will use dummy
142+
# embeddings and continue running, but memory features will be limited.
143+
144+
# Affected providers that need separate embeddings key:
145+
# - OpenRouter (openrouter.ai)
146+
# - Anthropic (api.anthropic.com)
147+
# - Google/Gemini (generativelanguage.googleapis.com)
148+
149+
# Providers with built-in embeddings support:
150+
# - OpenAI (api.openai.com) - uses same key for chat and embeddings
151+
# - Ollama (localhost:11434) - local embeddings with nomic-embed-text
152+
153+
# =============================================================================
154+
# USAGE INSTRUCTIONS
155+
# =============================================================================
156+
# 1. Copy this file to .env: cp .env.example .env
157+
# 2. Fill in your actual API keys and configuration values
158+
# 3. Make sure .env is in your .gitignore to keep your keys private
159+
# 4. For OpenRouter users: Set both OPENAI_API_KEY and OPENAI_EMBEDDINGS_API_KEY
160+
# 5. For Ollama users: Run 'ollama pull nomic-embed-text' for embeddings support
161+
# 6. Run the application: python main.py or python -m cli.main

python/third_party/TradingAgents/.gitignore

Lines changed: 84 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,87 @@
1-
env/
1+
# Environment variables
2+
.env
3+
.env.local
4+
.env.*.local
5+
6+
# Python
27
__pycache__/
8+
*.py[cod]
9+
*.class
10+
*.so
11+
.Python
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
*.manifest
31+
*.spec
32+
33+
# Unit test / coverage reports
34+
htmlcov/
35+
.tox/
36+
.coverage
37+
.coverage.*
38+
.cache
39+
nosetests.xml
40+
coverage.xml
41+
*.cover
42+
.hypothesis/
43+
.pytest_cache/
44+
45+
# Jupyter Notebook
46+
.ipynb_checkpoints
47+
48+
# IPython
49+
profile_default/
50+
ipython_config.py
51+
52+
# pyenv
53+
.python-version
54+
55+
# Environments
56+
.venv
57+
env/
58+
venv/
59+
ENV/
60+
env.bak/
61+
venv.bak/
62+
63+
# IDE
64+
.vscode/
65+
.idea/
66+
*.swp
67+
*.swo
68+
*~
69+
70+
# OS
371
.DS_Store
4-
*.csv
5-
src/
72+
.DS_Store?
73+
._*
74+
.Spotlight-V100
75+
.Trashes
76+
ehthumbs.db
77+
Thumbs.db
78+
79+
# Results and logs
80+
results/
81+
logs/
82+
*.log
83+
84+
# Data directories
85+
data/
86+
dataflows/data_cache/
687
eval_results/
7-
eval_data/
8-
*.egg-info/
9-
.env
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.10
1+
3.12
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# TradingAgents Adapter Package

0 commit comments

Comments
 (0)