AI-Powered Quantitative Trading Platform
Transform natural language into sophisticated trading strategies with real-time backtesting and interactive visualization
AgentQuant is a cutting-edge AI-assisted quantitative trading platform that revolutionizes how traders and developers approach strategy development. By combining advanced language models with sophisticated tooling infrastructure, it transforms natural language trading ideas into executable, backtestable strategies with comprehensive performance analytics.
๐ Ready to try AgentQuant? Join our waitlist for early access to the platform!
- ๐ค AI-Powered Strategy Generation: Convert natural language into sophisticated trading logic
- ๐ Real-Time Market Data: Live data feeds with intelligent caching and preprocessing
- ๐ฌ Advanced Backtesting: Isolated execution environments with comprehensive metrics
- ๐ Interactive Visualization: Beautiful charts, KPIs, and trade analysis
- ๐ Streaming Progress: Real-time feedback during strategy development
- ๐ ๏ธ Extensible Architecture: Modular design with pluggable components
- ๐ Production Ready: Docker-based deployment with Kubernetes support
graph TB
subgraph "Frontend Layer"
UI[Web App<br/>Next.js + React]
UI --> |Chat Interface| API[API Routes]
end
subgraph "AI Layer"
AGENT[AI Agent<br/>LangChain + NAT + Qwen]
AGENT --> |Tool Calls| MCP[MCP Server]
end
subgraph "Data & Execution Layer"
MCP --> |Market Data| REDIS[(Redis Cache)]
MCP --> |Code Execution| K8S[Kubernetes<br/>Execution Sandbox]
K8S --> |Results| REDIS
end
subgraph "External Services"
MARKET[Market Data<br/>Yahoo Finance]
LLM[LLM Services<br/>OpenAI/Qwen]
end
API --> AGENT
AGENT --> LLM
MCP --> MARKET
classDef frontend fill:#667eea,stroke:#764ba2,stroke-width:3px,color:#fff
classDef ai fill:#f093fb,stroke:#f5576c,stroke-width:3px,color:#fff
classDef data fill:#4facfe,stroke:#00f2fe,stroke-width:3px,color:#fff
classDef external fill:#43e97b,stroke:#38f9d7,stroke-width:3px,color:#fff
class UI,API frontend
class AGENT,MCP ai
class REDIS,K8S data
class MARKET,LLM external
| Component | Technology | Purpose |
|---|---|---|
| Frontend | Next.js 15, React 19, TypeScript | Modern web interface with streaming UI |
| AI Agent | LangChain, NVIDIA NAT, Python 3.12 | Natural language processing and tool orchestration |
| Tooling Service | FastAPI, MCP Protocol | Unified API for market data and execution |
| Execution | Kubernetes, Docker | Isolated backtesting environments |
| Data Store | Redis 7 | High-performance caching and state management |
| Charts | Lightweight Charts, Recharts | Professional financial visualizations |
| Styling | Tailwind CSS, Radix UI | Modern, accessible design system |
sequenceDiagram
participant User
participant Web as Web
participant Agent as Agent
participant Tools as Tooling Service
participant Store as Data Store
participant Runner as Execution Sandbox
User->>Web: Submit strategy request
Web->>Agent: Send request (streaming)
Agent->>Tools: Register task / preview parameters
Agent->>Tools: Fetch market data (cached)
Agent->>Tools: Generate and run backtest
Tools->>Runner: Execute strategy in isolation
Runner->>Store: Read/write data
Tools-->>Agent: Return metrics and outputs
Agent-->>Web: Summarize results and visuals
Note over User,Web: Frontend Layer
Note over Agent,Tools: AI & Service Layer
Note over Store,Runner: Data & Execution Layer
| Requirement | Version | Notes |
|---|---|---|
| Node.js | 18+ | With pnpm package manager |
| Python | 3.12+ | With uv package manager |
| Docker | Latest | & Docker Compose |
| Kubernetes | Latest | For code execution sandbox |
| Redis | 7+ | (Included in Docker setup) |
| LLM API Keys | - | For both generic and coder models |
# Clone the repository
git clone https://github.com/nlpquant/AgentQuant.git
cd AgentQuant
# Set up environment variables
cd deploy
export LLM_GENERIC_MODEL_NAME='qwen3-plus'
export LLM_CODER_MODEL_NAME='qwen3-coder-plus'
export LLM_GENERIC_MODEL_API_ENDPOINT='your-api-endpoint'
export LLM_CODER_MODEL_API_ENDPOINT='your-api-endpoint'
export LLM_GENERIC_MODEL_API_KEY='your-api-key'
export LLM_CODER_MODEL_API_KEY='your-api-key'
# Start all services
docker-compose up -d
# Check service health
docker-compose ps# Install dependencies
pnpm install
# Start Redis
docker run --rm -p 6379:6379 redis:7-alpine
# Start Kubernetes cluster (required for code execution)
cd deploy
docker-compose up kind -d
# Wait for cluster to be ready
docker-compose exec kind sh -c "kubectl wait --for=condition=Ready nodes --all --timeout=300s"
# Verify cluster is running
docker-compose exec kind sh -c "kubectl get nodes"
# Start Tooling Service (in new terminal)
cd apps/mcp-server
uv venv --python 3.12 --seed .venv
source .venv/bin/activate
uv sync
uv run uvicorn mcp_server.main:api --reload --port 8080
# Start AI Agent (in new terminal)
cd apps/agent
uv venv --python 3.12 --seed .venv
source .venv/bin/activate
uv sync
export LLM_GENERIC_MODEL_API_KEY='your-api-key-here'
export LLM_CODER_MODEL_API_KEY='your-api-key-here'
uv run nat serve --config_file configs/config.yaml
# Start Web App (in new terminal)
cd apps/web
pnpm dev
# Optional: Start development tools (in new terminal)
cd deploy
# Start Redis Insight for database visualization
docker-compose up redis-insight -d
# Start MCP Inspector for tool debugging
docker-compose up mcp-inspector -d| Service | URL | Description |
|---|---|---|
| Web Application | http://localhost:3000 | Main user interface |
| Agent API | http://localhost:8000/docs | AI Agent API documentation |
| Tooling Service | http://localhost:8080/docs | MCP Server API documentation |
| Redis Insight | http://localhost:5540 | Database visualization (dev only) |
| MCP Inspector | http://localhost:6274 | Tool debugging (dev only) |
๐ก Development Tools: Redis Insight and MCP Inspector are available via Docker Compose for debugging and monitoring during development.
"Create a moving average crossover strategy for AAPL with 20-day and 50-day periods,
backtest it for the last 2 years, and show me the performance metrics"
"Build an RSI mean reversion strategy for SPY with:
- RSI oversold at 30, overbought at 70
- Bollinger Bands for entry confirmation
- 2% stop loss, 4% take profit
- Backtest on 5-minute data for the last 3 months"
"Create a pairs trading strategy between INTC and AMD using:
- 60-day rolling correlation
- Z-score entry/exit signals
- Risk management with position sizing
- Show me the equity curve and drawdown analysis"
- Natural Language Understanding: Interprets complex trading requirements
- Multi-Step Planning: Breaks down complex strategies into executable steps
- Tool Orchestration: Seamlessly coordinates data fetching, analysis, and execution
- Streaming Feedback: Real-time progress updates during strategy development
- Error Recovery: Intelligent handling of failures with retry mechanisms
- Real-Time Data: Live market feeds via Yahoo Finance API
- Historical Data: Comprehensive historical datasets with multiple timeframes
- Technical Indicators: 50+ built-in indicators (RSI, MACD, Bollinger Bands, etc.)
- Data Caching: Intelligent Redis-based caching for performance
- Data Validation: Automatic data quality checks and preprocessing
- Isolated Execution: Secure, sandboxed code execution environments
- Multiple Timeframes: Support for tick, minute, hourly, daily data
- Realistic Simulation: Slippage, commissions, and market impact modeling
- Performance Metrics: 20+ comprehensive performance indicators
- Risk Analysis: Drawdown, Sharpe ratio, maximum adverse excursion
- Interactive Charts: Professional candlestick charts with technical overlays
- Performance Dashboards: Real-time KPI monitoring and analysis
- Trade Analysis: Detailed trade-by-trade breakdown with entry/exit points
- Signal Visualization: Clear buy/sell signal overlays on price charts
- Export Capabilities: PDF reports and CSV data export
AgentQuant/
โโโ apps/
โ โโโ web/ # Next.js frontend application
โ โโโ agent/ # AI agent service (Python)
โ โโโ mcp-server/ # Tooling service (FastAPI)
โโโ deploy/ # Docker and Kubernetes configurations
โโโ assets/ # Static assets (images, demos)
โโโ LICENSE # AGPL-3.0 license
pnpm build # Build all applications
pnpm dev # Start all services in development mode
pnpm lint # Run linting across all packages
pnpm format # Format code with Prettier
pnpm test # Run test suites# Web Application
cd apps/web && pnpm dev
# Tooling Service
cd apps/mcp-server && uv run uvicorn mcp_server.main:api --reload --port 8080
# AI Agent
cd apps/agent && uv run nat serve --config_file configs/config.yaml| Feature Type | Location | Description |
|---|---|---|
| Technical Indicators | apps/mcp-server/mcp_server/ |
Add new trading indicators |
| UI Components | apps/web/components/ |
Create React components |
| Agent Tools | apps/agent/src/agent/ |
Extend AI capabilities |
| API Endpoints | apps/mcp-server/mcp_server/ |
Add new API routes |
| Environment | Use Case | Description |
|---|---|---|
| Docker Compose | Development & Production | Single-server deployment for all use cases |
| Kind Cluster | Development | Local Kubernetes cluster for testing |
| Variable | Description | Required |
|---|---|---|
LLM_GENERIC_MODEL_NAME |
Model name for general tasks | โ |
LLM_CODER_MODEL_NAME |
Model name for code generation | โ |
LLM_GENERIC_MODEL_API_ENDPOINT |
API endpoint for generic model | โ |
LLM_CODER_MODEL_API_ENDPOINT |
API endpoint for coder model | โ |
LLM_GENERIC_MODEL_API_KEY |
API key for generic model | โ |
LLM_CODER_MODEL_API_KEY |
API key for coder model | โ |
REDIS_URL |
Redis connection string | โ |
K8S_CONFIG_FILE |
Kubernetes config path | Optional |
| Endpoint | Method | Description |
|---|---|---|
/api/chat |
POST | Submit strategy requests |
/api/data/[storageKey] |
GET | Retrieve market data |
/api/result/[taskId] |
GET | Get backtest results |
/health |
GET | Service health check |
| Tool | Description |
|---|---|
task_register |
Register new strategy tasks |
quick_preview |
Preview strategy parameters |
yh_query_save |
Fetch and cache market data |
code_generator |
Generate trading strategy code |
code_executor |
Execute backtest code |
We welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and add tests
- Run the test suite:
pnpm test - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) - see the LICENSE file for details.
- LangChain for AI orchestration framework
- NVIDIA NAT for agent infrastructure
- Alibaba Qwen for performant Large Language Model
- FastAPI for high-performance API framework
- Next.js for modern React framework
- Lightweight Charts for financial visualizations
- Redis for high-performance caching
- ๐ Official Website: nlpquant.ai - Join our waitlist for early access
- ๐ Documentation: Wiki
- ๐ Bug Reports: Issues
- ๐ฌ Discussions: GitHub Discussions
- ๐ง Email: [email protected]
Built with โค๏ธ by the NLPQuant Team
Website โข GitHub โข Documentation

