How vivek1bharadwaj/trading-agents works
TradingAgents is a multi-agent financial research and trading framework, exposed through a CLI and reusable graph. The main workflow configures a dated instrument run, gathers market and contextual data, coordinates analyst reports and bullish/bearish research, then produces a trader proposal and portfolio decision; reports, memory, settlement and grid backtests support evaluation over time. The README documents social/news/macro analysis, risk debate and simulated execution. Some subsystem links are documented rather than confirmed in sampled implementation excerpts, so those are shown dashed with null evidence.
Main entry points: trading_graph.py Trading Graph · main.py CLI · vendors Market and News Vendors · analysts Analyst Team
Components 28
Run Entry
- CLI
cli/main.py - Run Orchestration
cli/run.py - Backtest CLI
cli/main.py - Portfolio Input
tradingagents/portfolio.py
Data Access
- Vendor Router
tradingagents/dataflows/router.py - Point-in-Time Rules
tradingagents/dataflows/date_window.py - Symbol Normalization
tradingagents/dataflows/symbols.py - Market and News Vendors
tradingagents/dataflows/vendors
Research and Decisions
- Analyst Team
tradingagents/agents/analysts - Prompt Context
tradingagents/agents/context.py - Bull Bear Debate
tradingagents/agents/researchers - Research Manager
tradingagents/agents/managers/research_manager.py - Risk Debate
tradingagents/agents/risk_mgmt - Trader
tradingagents/agents/trader/trader.py - Portfolio Manager
tradingagents/agents/managers/portfolio_manager.py - Social Screening
tradingagents/agents/post_screen.py
Run Services
- Trading Graph
tradingagents/graph/trading_graph.py - Workflow Setup
tradingagents/graph/setup.py - Analyst Dispatch
tradingagents/graph/analyst_execution.py - LLM Provider Clients
tradingagents/llm_clients - Decision Memory
tradingagents/memory/log.py - Reports
tradingagents/reporting.py - Run Checkpoints
tradingagents/graph/checkpointer.py
Evaluation
- Grid Backtest
tradingagents/backtest.py - Outcome Settlement
tradingagents/memory/settlement.py
Other components
- Analyst User
- Simulated Exchange
- LLM Services
Connections 29
- Analyst User → CLI: configures run
README.md - CLI → Run Orchestration: starts analysis
cli/main.py - CLI → Backtest CLI: requests backtest
cli/main.py - CLI → Portfolio Input: loads holdings
cli/main.py - Run Orchestration → Trading Graph: runs graph
- Backtest CLI → Grid Backtest: runs grid
cli/main.py - Grid Backtest → Trading Graph: runs dated cases
tradingagents/backtest.py - Trading Graph → Workflow Setup: builds workflow
tradingagents/graph/trading_graph.py - Workflow Setup → Analyst Dispatch: registers analysts
tradingagents/graph/setup.py - Analyst Dispatch → Analyst Team: dispatches analysts
- Analyst Team → Prompt Context: uses prompt context
- Analyst Team → Vendor Router: requests research data
- Vendor Router → Market and News Vendors: routes vendor calls
tradingagents/dataflows/router.py - Market and News Vendors → Point-in-Time Rules: applies date rules
tradingagents/dataflows/vendors/reddit.py - Market and News Vendors → Symbol Normalization: normalizes tickers
tradingagents/dataflows/vendors/reddit.py - Research Manager → Bull Bear Debate: coordinates debate
- Bull Bear Debate → Risk Debate: informs risk debate
- Risk Debate → Trader: informs trade plan
- Trader → Portfolio Manager: submits proposal
- Portfolio Manager → Simulated Exchange: sends approved order
README.md - Trading Graph → LLM Provider Clients: creates clients
tradingagents/graph/trading_graph.py - LLM Provider Clients → LLM Services: requests completions
- Trading Graph → Decision Memory: records decisions
tradingagents/graph/trading_graph.py - Trading Graph → Reports: writes report
tradingagents/graph/trading_graph.py - Trading Graph → Run Checkpoints: resumes runs
tradingagents/graph/trading_graph.py - Trading Graph → Social Screening: screens social posts
- Grid Backtest → Decision Memory: reads run outcomes
tradingagents/backtest.py - Outcome Settlement → Decision Memory: settles decisions
- Trading Graph → Outcome Settlement: tracks realized outcomes
tradingagents/graph/trading_graph.py