How spacerexxx/tradingagents-webui works
TradingAgents WebUI is an A-share-focused multi-agent investment research product, exposed through a React interface, FastAPI API, and a CLI that reuses the engine. The main workflow accepts a ticker and analysis settings, runs analyst research and quality checks, then forecasting, bull/bear debate, trading, risk review, and a portfolio decision; progress and reports are returned to the user. The README documents history, diagnostics, provider configuration, prompts, quotes, PDF export, and token/cost statistics. Engine-to-backend links are based on the documented architecture; unsampled route and service internals are not asserted.
Main entry points: trading_graph.py TradingAgents graph · main.py FastAPI app · App.tsx React WebUI · analysis.py Analysis endpoints
Components 25
User interfaces
- React WebUI
frontend/src/App.tsx - API client
frontend/src/api/client.ts - Analysis stream
frontend/src/hooks/useAnalysisStream.ts - CLI
cli/main.py
API services
- FastAPI app
backend/main.py - Analysis endpoints
backend/routes/analysis.py - History and utility endpoints
backend/routes/history.py - Run orchestration
backend/services/runner.py - Active run registry
backend/services/registry.py
Research engine
- TradingAgents graph
tradingagents/graph/trading_graph.py - Analyst team
tradingagents/graph/analyst_team.py - Quality gate
tradingagents/agents/quality_gate.py - Short-term forecast
tradingagents/agents/forecasters/short_term_forecaster.py - Bull-bear research
tradingagents/agents/managers/research_manager.py - Trading plan
tradingagents/agents/trader/trader.py - Risk debate
tradingagents/agents/risk_mgmt/aggressive_debator.py - Portfolio decision
tradingagents/agents/managers/portfolio_manager.py
Data and models
- Market data sources
tradingagents/dataflows/a_share_sources/router.py - Model clients
tradingagents/llm_clients/factory.py
Reports and history
- History and persistence
backend/services/history.py - SQLite history index
tradingagents/storage/sqlite_history.py - Saved analysis reports
Other components
- Research user
- LLM providers
- Financial data services
Connections 28
- Research user → React WebUI: submits analysis
- React WebUI → API client: requests API
- API client → FastAPI app: REST calls
- React WebUI → Analysis stream: tracks run
- Analysis stream → FastAPI app: receives progress
- Research user → CLI: runs research
- CLI → TradingAgents graph: invokes graph
- FastAPI app → Analysis endpoints: dispatches routes
- Analysis endpoints → Run orchestration: starts run
- Analysis endpoints → Active run registry: tracks run
- Run orchestration → TradingAgents graph: runs analysis
- TradingAgents graph → Analyst team: dispatches team
- Analyst team → Market data sources: requests research data
- Market data sources → Financial data services: fetches market data
- TradingAgents graph → Quality gate: checks analyst evidence
- TradingAgents graph → Short-term forecast: runs forecast
- TradingAgents graph → Bull-bear research: runs debate
- TradingAgents graph → Trading plan: creates plan
- TradingAgents graph → Risk debate: reviews risk
- TradingAgents graph → Portfolio decision: requests decision
- Analyst team → Model clients: requests model output
- Model clients → LLM providers: calls model
- Portfolio decision → Model clients: requests decision output
- Run orchestration → Saved analysis reports: saves run report
- History and utility endpoints → History and persistence: serves history
- History and persistence → SQLite history index: reads and writes index
- History and persistence → Saved analysis reports: loads reports
- FastAPI app → History and utility endpoints: dispatches routes