Introduction
The Thesis Multi-Agent Trading System is an advanced algorithmic trading framework that leverages a collaborative ecosystem of specialized AI agents to make informed market decisions. Designed to move beyond simple indicator-based strategies, this system simulates a professional trading desk where multiple experts—technical analysts, fundamental researchers, sentiment specialists, and risk managers—debate and converge on a single execution strategy.
Built using LangChain, FastAPI, and React, the platform provides a complete end-to-end pipeline: from raw data ingestion and RAG-based knowledge retrieval to automated backtesting and real-time performance visualization.
Core Capabilities
1. Multi-Agent Orchestration
The system utilizes a "Committee of Agents" architecture. Each agent is governed by strict Pydantic schemas, ensuring that LLM outputs are structured, validated, and actionable.
- Technical Agent: Analyzes price action, RSI signals, MACD crossovers, and support/resistance levels.
- Sentiment Agent: Processes real-time news via RSS/NewsAPI and interprets market psychology (e.g., Fear & Greed Index).
- Fundamental Agent: Evaluates on-chain metrics, network health, and long-term valuation phases.
- Risk Agent: Acting as the final gatekeeper, it calculates optimal position sizing, ATR-based stop-losses, and take-profit targets.
2. Retrieval-Augmented Generation (RAG)
The system incorporates a domain-specific knowledge base. By indexing curated research papers, technical manuals, and market theories into a vector store, agents can ground their reasoning in established financial literature rather than relying solely on pre-trained LLM weights.
3. Automated Backtesting & Analytics
Validate strategies using the built-in backtesting engine. The system simulates historical trades, tracks equity curves, and generates comprehensive JSON reports containing:
- Total Return and Alpha vs. Buy-and-Hold.
- Sharpe Ratio and Maximum Drawdown.
- Detailed agent reasoning for every single trade.
4. Real-Time Dashboard
A modern web interface allows you to monitor the system's performance. The dashboard features:
- Equity Curve Visualization: Track portfolio growth vs. BTC benchmarks.
- Trade Logs: Deep-dive into specific trades to see the confidence levels and reasoning of each individual agent.
- Live Updates: WebSocket integration for real-time trade monitoring.
System Workflow
The system follows a structured "Phase-Based" analysis for every trading signal:
- Data Ingestion: Fetching latest prices, technical indicators, and news articles.
- Phase 1 (Analysis): Each specialized agent generates an independent recommendation (BUY/SELL/HOLD).
- Phase 2 (Conflict Check): A supervisor checks for disagreements between agents.
- Phase 3 (Debate): If agents disagree, a debate phase is triggered where agents refine their stance based on peer feedback.
- Phase 4 (Execution): A final consensus is reached, risk parameters are applied, and the trade is logged.
Quick Usage Preview
To interact with the system programmatically, the TradingOrchestrator serves as the primary entry point:
from orchestrator import TradingOrchestrator
# Initialize with your preferred LLM backend (e.g., Groq, Ollama)
orchestrator = TradingOrchestrator(backend="groq")
# Run a comprehensive market analysis
result = orchestrator.analyze(
query="Bitcoin is at $65,000. RSI is 70. News sentiment is bullish.",
enable_debate=True
)
# Access the final structured decision
print(f"Action: {result['final_decision']['recommendation']}")
print(f"Reasoning: {result['final_decision']['reasoning']}")
To view the results of a backtest run via the CLI:
python view_trades.py
Or launch the full visual experience:
# Start Backend
cd dashboard/backend && uvicorn main:app --reload
# Start Frontend
cd dashboard/frontend && npm run dev