How baipengyan/tradingagents works
TradingAgents is a multi-agent financial research and decision-support framework, entered through a CLI or Python API. Its principal workflow gathers market, company, news, and sentiment evidence; produces analyst reports; debates bullish and bearish cases; forms a research plan; debates risk; and renders a final portfolio decision. The graph, agent, data-provider, and LLM-client paths are supported by the tree and sampled source. Some subsystem connections are shown only where the README or excerpts establish them; unsampled details are omitted.
Main entry points: interface.py Dataflow interface · setup.py Graph setup · analysts Analyst team · trading_graph.py Trading graph
Components 25
User entry
- Interactive CLI
cli/main.py - Python API example
main.py
Trading workflow
- Trading graph
tradingagents/graph/trading_graph.py - Graph setup
tradingagents/graph/setup.py - Decision reporting
tradingagents/reporting.py - Decision memory
tradingagents/agents/utils/memory.py
Research agents
- Analyst team
tradingagents/agents/analysts - Market analysis
tradingagents/agents/analysts/market_analyst.py - Fundamentals analysis
tradingagents/agents/analysts/fundamentals_analyst.py - News analysis
tradingagents/agents/analysts/news_analyst.py - Sentiment analysis
tradingagents/agents/analysts/sentiment_analyst.py - Bull-bear debate
tradingagents/agents/researchers - Research plan
tradingagents/agents/managers/research_manager.py - Trade proposal
tradingagents/agents/trader/trader.py - Risk debate
tradingagents/agents/risk_mgmt - Portfolio decision
tradingagents/agents/managers/portfolio_manager.py
Data sources
- Dataflow interface
tradingagents/dataflows/interface.py - Market data vendors
tradingagents/dataflows - News and sentiment
tradingagents/dataflows - Macro and prediction
tradingagents/dataflows
Models and state
- LLM provider factory
tradingagents/llm_clients/factory.py - Provider clients
tradingagents/llm_clients - Graph checkpointing
tradingagents/graph/checkpointer.py
Other components
- Trader or researcher
- LLM providers
Connections 27
- Trader or researcher → Interactive CLI: configures run
- Trader or researcher → Python API example: starts analysis
- Interactive CLI → Trading graph: runs analysis
- Python API example → Trading graph: propagates ticker
- Trading graph → Graph setup: builds workflow
- Graph setup → Analyst team: dispatches analysis
- Analyst team → Market analysis: includes
- Analyst team → Fundamentals analysis: includes
- Analyst team → News analysis: includes
- Analyst team → Sentiment analysis: includes
- Graph setup → Bull-bear debate: dispatches debate
- Bull-bear debate → Research plan: informs plan
- Graph setup → Trade proposal: dispatches proposal
- Graph setup → Risk debate: dispatches risk debate
- Graph setup → Portfolio decision: dispatches decision
- Portfolio decision → Decision reporting: provides decision
- Trading graph → Decision memory: uses reflections
- Market analysis → Dataflow interface: requests evidence
- Fundamentals analysis → Dataflow interface: requests evidence
- News analysis → Dataflow interface: requests evidence
- Sentiment analysis → Dataflow interface: requests evidence
- Dataflow interface → Market data vendors: routes market queries
- Dataflow interface → News and sentiment: routes news queries
- Dataflow interface → Macro and prediction: routes macro queries
- LLM provider factory → Provider clients: creates client
- Provider clients → LLM providers: sends prompts
- Trading graph → Graph checkpointing: saves workflow state