An autonomous multi-agent trading system where AI traders with different investment philosophies compete in the Indian stock market. Watch Warren (value investing), George (macro trading), Ray (systematic approach), and Cathie (crypto ETFs) make real-time trading decisions using LLMs and MCP servers.
- Multiple AI Trading Agents: Four distinct trading personalities powered by different LLM models
- Real-time Market Data: Integration with Groww API for Indian market prices (INR ₹)
- MCP Architecture: Uses Model Context Protocol for modular tool integration
- Live Dashboard: Gradio-based UI showing portfolio values, holdings, and transaction logs
- Research Integration: AI agents can search the web and analyze market sentiment
- Push Notifications: Get alerts via Pushover for important trading events
- Persistent Storage: SQLite database for accounts, transactions, and logs
| Trader | Philosophy | Model | Strategy |
|---|---|---|---|
| Warren 📊 | Value Investing | GPT-4.1 Mini / GPT-4o Mini | Long-term, fundamental analysis, intrinsic value |
| George 🎯 | Macro Trading | DeepSeek V3 / GPT-4o Mini | Aggressive, contrarian, geopolitical events |
| Ray ⚖️ | Systematic | Gemini 2.5 Flash / GPT-4o Mini | Risk parity, diversification, macro indicators |
| Cathie 🚀 | Innovation | Grok 3 Mini / GPT-4o Mini | Disruptive tech, crypto ETFs, high volatility |
┌─────────────────────────────────────────────────────────┐
│ Trading Floor │
│ (Orchestrates multiple trader agents every N minutes) │
└────────────┬────────────────────────────────────────────┘
│
├─────► Warren Agent ──┐
├─────► George Agent ──┤
├─────► Ray Agent ─────┼──► MCP Servers
└─────► Cathie Agent ── ┘ │
│
┌──────────────────────────┴──────────────────┐
│ │
┌───────▼ ────────┐ ┌──────────────┐ ┌─────────────┐
│ Accounts Server │ │ Market Server│ │ Push Server │
│ (Tools for │ │ (Groww API) │ │ (Pushover) │
│ Trading) │ │ │ │ │
└────────┬────────┘ └──────────────┘ └─────────────┘
│
▼
┌────── ──────────┐
│ SQLite DB │
│ - Account │
│ - Transactions│
│ - Logs │
└─────── ─────────┘
- Python 3.10+
uv(fast Python package installer)- Node.js (for MCP servers)
- API Keys:
- OpenRouter API Key (for LLM models)
- Groww API Token (for Indian market data)
- Brave API Key (for web search)
- Pushover credentials (optional, for notifications)
- Clone the repository
git clone https://github.com/azmatsiddique/AI_ed.git
cd AI_ed- Install dependencies
uv pip install -r requirements.txt- Install MCP server dependencies
npm install -g @modelcontextprotocol/server-brave-search
npm install -g mcp-memory-libsql- Create
.envfile
cp .env.example .env- Configure environment variables
# LLM API Keys
OPENROUTER_API_KEY=your_openrouter_key_here
# Market Data (Groww)
GROWW_API_TOKEN=your_groww_token_here
GROWW_BASE_URL=https://api.groww.in
# Research Tools
BRAVE_API_KEY=your_brave_api_key_here
# Notifications (Optional)
PUSHOVER_USER=your_pushover_user
PUSHOVER_TOKEN=your_pushover_token
# Trading Configuration
RUN_EVERY_N_MINUTES=60
RUN_EVEN_WHEN_MARKET_IS_CLOSED=false
USE_MANY_MODELS=false # Set to true to use different models for each traderuv run scripts/reset.pyThis creates accounts for all four traders with starting balance of ₹100,000 each.
uv run -m src.services.trading_floorThis starts the autonomous trading loop. Agents will trade every N minutes (default: 60).
uv run -m src.ui.appOpen your browser to view the live dashboard with real-time updates.
Test individual trader:
from src.agents.trader import Trader
import asyncio
trader = Trader("Warren", "Patience", "gpt-4o-mini")
asyncio.run(trader.run())Test account operations:
from src.core.models import Account
account = Account.get("warren")
print(account.report()).
├── src/
│ ├── core/ # Core business logic
│ │ ├── models.py # Account and Transaction models
│ │ ├── database.py # SQLite operations
│ │ └── market.py # Groww market data adapter
│ ├── agents/ # AI agent components
│ │ ├── trader.py # Trader agent logic
│ │ ├── templates.py # Prompt templates
│ │ └── mcp_config.py # MCP server configuration
│ ├── services/ # Service layer
│ │ ├── account_service.py # Account management
│ │ └── trading_floor.py # Trading orchestration
│ ├── mcp_servers/ # MCP server implementations
│ │ ├── accounts_server.py # Account tools MCP server
│ │ ├── accounts_client.py # Account MCP client
│ │ ├── market_server.py # Market data MCP server
│ │ └── push_server.py # Push notifications
│ ├── ui/ # User interface
│ │ ├── app.py # Gradio dashboard
│ │ └── utils.py # UI utilities
│ └── utils/ # Shared utilities
│ ├── formatting.py # Formatting helpers (fmt_inr)
│ └── tracers.py # Logging and tracing
├── scripts/ # Standalone scripts
│ ├── reset.py # Initialize/reset accounts
│ └── run_trader.py # Manual trader testing
├── tests/ # Test files (future)
├── .env
├── .gitignore
├── README.md
├── requirements.txt
└── pyproject.toml # Project configuration
Modify in .env:
RUN_EVERY_N_MINUTES=60 # Run traders every hourBy default, traders only operate during Indian market hours (9:15 AM - 3:30 PM IST, Mon-Fri). To run 24/7:
RUN_EVEN_WHEN_MARKET_IS_CLOSED=trueUse different LLM models for each trader:
USE_MANY_MODELS=trueModels used:
- Warren: GPT-4.1 Mini
- George: DeepSeek Chat V3
- Ray: Gemini 2.5 Flash Preview
- Cathie: Grok 3 Mini
- Portfolio Value Chart: Historical performance tracking
- Holdings Table: Current stock positions
- Transaction Log: Recent buy/sell activities with rationales
- Live Logs: Real-time agent activity (traces, API calls, decisions)
- P&L Display: Profit/Loss with visual indicators (▲/▼)
- Add trader configuration in
reset.py:
new_trader_strategy = """
Your trading strategy here...
"""- Update trader lists in
trading_floor.py:
names = ["Warren", "George", "Ray", "Cathie", "NewTrader"]
lastnames = ["Patience", "Bold", "Systematic", "Crypto", "YourStyle"]- Reset accounts:
uv run reset.py- Define tool in appropriate server file (e.g.,
accounts_server.py)
@mcp.tool()
async def your_tool(param: str) -> str:
# Implementation
return result- Tool automatically available to agents via MCP protocol
- Never commit
.envfile - Contains sensitive API keys - Database file -
accounts.dbcontains financial data, keep secure - API Rate Limits - Be mindful of Groww/Brave API limits
- Paper Trading - This system uses simulated trading with fake money
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT License - See LICENSE file for details
- Built with Anthropic Agents SDK
- Uses Model Context Protocol (MCP)
- Market data via Groww API
- UI powered by Gradio
- Issues: GitHub Issues
- Discussions: GitHub Discussions
This is an educational project for learning about AI agents and trading systems. This software:
- Uses simulated/paper trading only
- Is NOT financial advice
- Should NOT be used with real money without extensive modification and testing
- Is provided AS-IS without warranties
The authors are not responsible for any financial losses incurred from using or modifying this code.
Happy Trading! 📈💰
Made with ❤️ for the AI and FinTech community
