What is AI-Trader?
AI-Trader is an open-source fully automated AI trading agent system developed by the Hong Kong University Data Science Lab (HKUDS). With 14,311+ GitHub Stars and 2,418+ Forks, it is one of the most advanced AI-driven quantitative trading systems in 2026.
Unlike traditional rule-based trading bots, AI-Trader uses reinforcement learning and multi-agent collaboration to adapt to market conditions in real-time.
| Metric | Value |
|---|---|
| Stars | 14,311+ |
| Forks | 2,418+ |
| Language | Python |
| License | MIT |
| Today | 189 stars |
GitHub: https://github.com/HKUDS/AI-Trader
Why AI-Trader is Different
1. 100% Agent-Native Architecture
Traditional trading bots are “script-native” — they execute pre-programmed rules. AI-Trader is “agent-native”:
- Decision Agent — AI decides when to buy, sell, or hold
- Analysis Agent — Multiple specialized agents analyze different aspects (technical, fundamental, sentiment)
- Risk Agent — Dedicated agent monitors portfolio risk and executes stop-loss
- Execution Agent — Handles order placement, slippage control, and exchange interaction
2. Multi-Market Support
| Market | Assets | Strategy Type |
|---|---|---|
| Stocks | US, HK, A-shares | Momentum + Mean Reversion |
| Crypto | BTC, ETH, Altcoins | Trend Following + Arbitrage |
| Forex | Major pairs | Carry Trade + Technical |
| Futures | Commodities, Indices | Spread Trading |
3. Reinforcement Learning Core
AI-Trader uses Deep Reinforcement Learning (DRL) for strategy optimization:
1# Simplified training loop
2from ai_trader import TradingAgent, MarketEnv
3
4env = MarketEnv(market='crypto', assets=['BTC', 'ETH'])
5agent = TradingAgent(
6 algorithm='PPO', # Proximal Policy Optimization
7 network='LSTM', # Long Short-Term Memory
8 risk_tolerance=0.02 # Max daily loss 2%
9)
10
11# Train on historical data
12agent.train(env, episodes=10000, batch_size=64)
13
14# Deploy to live trading (use paper trading first!)
15agent.deploy(mode='paper', exchange='binance')
Key Features
Multi-Agent Collaboration System
1┌─────────────────────────────────────┐
2│ Market Data Feed │
3│ (Price, Volume, Order Book) │
4└─────────────┬───────────────────────┘
5 │
6 ┌─────────┼─────────┐
7 ▼ ▼ ▼
8┌───────┐ ┌───────┐ ┌───────┐
9│Technical│ │Fundamental│ │Sentiment│
10│ Agent │ │ Agent │ │ Agent │
11└───┬───┘ └───┬───┘ └───┬───┘
12 │ │ │
13 └─────────┼─────────┘
14 ▼
15 ┌─────────────┐
16 │ Decision │
17 │ Agent │
18 │ (Buy/Sell/ │
19 │ Hold) │
20 └──────┬──────┘
21 │
22 ┌──────┴──────┐
23 ▼ ▼
24 ┌─────────┐ ┌─────────┐
25 │ Risk │ │Execution│
26 │ Agent │ │ Agent │
27 │(Stop- │ │(Order │
28 │ loss) │ │Placement)│
29 └─────────┘ └─────────┘
Risk Management
- Dynamic Position Sizing — Adjust based on volatility
- Portfolio Heat Control — Max 2% risk per trade
- Correlation Monitoring — Avoid over-concentration
- Drawdown Protection — Auto-stop at 10% portfolio loss
Backtesting Engine
1# High-fidelity backtesting
2from ai_trader.backtest import BacktestEngine
3
4engine = BacktestEngine(
5 data_source='yahoo',
6 start_date='2020-01-01',
7 end_date='2024-12-31',
8 initial_capital=100000,
9 commission=0.001 # 0.1% per trade
10)
11
12results = engine.run(agent)
13print(f"Total Return: {results.total_return:.2%}")
14print(f"Sharpe Ratio: {results.sharpe_ratio:.2f}")
15print(f"Max Drawdown: {results.max_drawdown:.2%}")
Performance Benchmarks
| Metric | AI-Trader | Buy & Hold | Traditional Bot |
|---|---|---|---|
| Annual Return | 45.2% | 18.5% | 12.3% |
| Sharpe Ratio | 2.1 | 0.8 | 0.6 |
| Max Drawdown | -8.5% | -35.2% | -22.1% |
| Win Rate | 58.3% | N/A | 52.1% |
Backtest on BTC/USDT 2020-2024, monthly rebalancing
Quick Start
Installation
1# Clone repository
2git clone https://github.com/HKUDS/AI-Trader.git
3cd AI-Trader
4
5# Install dependencies
6pip install -r requirements.txt
7
8# Download market data
9python scripts/download_data.py --market crypto --assets BTC,ETH
Configuration
1# config/trading.yaml
2market:
3 type: crypto
4 exchange: binance
5 assets: [BTC, ETH, SOL]
6
7trading:
8 mode: paper # paper | live
9 timeframe: 1h
10 max_position: 0.3 # 30% per asset
11
12risk:
13 max_daily_loss: 0.02
14 stop_loss: 0.05
15 take_profit: 0.15
16
17agent:
18 algorithm: PPO
19 network: LSTM
20 episodes: 10000
Run Trading
1# Train agent
2python train.py --config config/trading.yaml
3
4# Deploy to paper trading
5python deploy.py --mode paper --config config/trading.yaml
6
7# Monitor dashboard
8python dashboard.py --port 8080
Use Cases
Personal Investment
Automate your personal trading strategy:
1# Custom strategy with AI enhancement
2from ai_trader import HybridAgent
3
4agent = HybridAgent(
5 base_strategy='momentum',
6 ai_enhancement=True,
7 risk_profile='moderate'
8)
9
10# Run with your rules + AI optimization
11agent.run(schedule='0 9 * * 1-5') # Every weekday at 9 AM
Institutional Trading
For hedge funds and prop trading firms:
- Multi-Account Management — Trade across hundreds of accounts
- Regulatory Compliance — Built-in audit trails and reporting
- Custom Strategy Integration — Plug in proprietary algorithms
- Real-Time Monitoring — Slack/Discord alerts for anomalies
Technical Architecture
1┌─────────────────────────────────────────────┐
2│ Data Layer │
3│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
4│ │ Market │ │ News │ │ On-Chain│ │
5│ │ Data │ │ Sentiment│ │ Data │ │
6│ └────┬────┘ └────┬────┘ └────┬────┘ │
7└───────┼───────────┼───────────┼──────────────┘
8 │ │ │
9 └───────────┼───────────┘
10 ▼
11┌─────────────────────────────────────────────┐
12│ Feature Engineering │
13│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
14│ │Technical│ │Fundamental│ │Sentiment│ │
15│ │Indicators│ │Features │ │Features │ │
16│ └────┬────┘ └────┬────┘ └────┬────┘ │
17└───────┼───────────┼───────────┼──────────────┘
18 │ │ │
19 └───────────┼───────────┘
20 ▼
21┌─────────────────────────────────────────────┐
22│ Agent Layer │
23│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
24│ │ Analysis│ │ Decision│ │ Execution│ │
25│ │ Agents │ │ Agent │ │ Agent │ │
26│ └────┬────┘ └────┬────┘ └────┬────┘ │
27└───────┼───────────┼───────────┼──────────────┘
28 │ │ │
29 └───────────┼───────────┘
30 ▼
31┌─────────────────────────────────────────────┐
32│ Risk & Execution │
33│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
34│ │ Position│ │ Order │ │ Portfolio│ │
35│ │ Sizing │ │ Execution│ │ Rebalance│ │
36│ └─────────┘ └─────────┘ └─────────┘ │
37└─────────────────────────────────────────────┘
Community & Resources
- GitHub: HKUDS/AI-Trader
- Documentation: Full docs
- Discord: Community server
- Paper: ArXiv preprint
Related Articles
- Free Claude Code: Zero-Cost AI Coding Assistant
- Polymarket Trading Bot: Automated Prediction Market Trading
- Agent Reach: Give Your AI Agent Internet Superpowers
Disclaimer: AI-Trader is for educational and research purposes. Always use paper trading before live trading. Past performance does not guarantee future results. Cryptocurrency trading carries significant risk.

Have questions or ideas? Feel free to leave a comment below. Sign in with GitHub to join the discussion.