基于多智能体的量化交易系统架构。
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ 前端 (React) │────│ 后端 (Node.js) │────│ 数据库 (MongoDB)│
│ │ │ │ │ │
│ - Agent提交界面 │ │ - RESTful API │ │ - Agent存储 │
│ - 对比展示 │ │ - WebSocket服务 │ │ - 交易记录 │
│ - 实时图表 │ │ - 认证授权 │ │ - 用户数据 │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│
├─────────────────┐
│ │
┌─────────────────┐ ┌─────────────────┐
│ 交易引擎 │ │ 实时数据源 │
│ │ │ │
│ - 策略执行 │ │ - 市场数据API │
│ - 回测系统 │ │ - WebSocket连接 │
│ - 风险管理 │ │ - 数据清洗 │
└─────────────────┘ └─────────────────┘
- 用户注册和认证;Agent代码提交和验证;Agent配置和参数设置;版本控制和历史记录。
- 实时市场数据接入;策略信号生成和执行;风险控制和资金管理;交易记录和日志。
- 历史数据回测;多种评估指标;性能分析报告;参数优化建议。
- Agent间实时对比
- 收益率分析、风险指标计算、回撤分析、sharpe ratio等常见指标。
trading_agent/
├── frontend/ # React前端应用
├── backend/ # Node.js后端服务
├── trading-engine/ # 交易引擎 (Python)
├── database/ # 数据库脚本和配置
├── docker/ # Docker配置文件
├── docs/ # 项目文档
└── scripts/ # 部署和工具脚本
The platform consists of four core components:
-
Trading Engine (Python/PyTorch):
- Handles market event loops and signal generation.
- Implements PPO inference logic with state management.
- Manages order flow simulation and latency modeling.
-
API Gateway (Node.js):
- RESTful API for strategy management and configuration.
- WebSocket services for real-time frontend communication.
-
Data Infrastructure (Redis + MongoDB):
- Redis: Pub/Sub channel for tick data and trade signals.
- MongoDB: Persistence layer for trade logs and strategy performance metrics.
-
Visualization (React/TypeScript):
- Real-time dashboard for monitoring PnL curves and exposure.
- Language: Python 3.9, TypeScript, JavaScript
- Frameworks: PyTorch, Express.js, React 18
- Infrastructure: Docker, Docker Compose
- Middleware: Redis, MongoDB
- Docker & Docker Compose
- Python 3.9+ (For local debugging)
-
Clone the repository: git clone https://github.com/XiaomanChu/ai-quant-infrastructure.git cd ai-quant-infrastructure
-
Start services: docker-compose up -d
-
Access endpoints:
- Dashboard: http://localhost:3000
- API: http://localhost:5000