An automated investment tool integrating Futu Securities API with local LLM (Ollama) for intelligent portfolio management.
- AI-Powered Analysis: Leverage local LLM for financial report and news sentiment analysis
- Automated Trading: Execute trades based on AI insights and predefined rules
- Risk Management: Position limits, stop-loss protection, and portfolio balancing
- Dual Mode Support: Paper trading (simulation) and real trading modes
- News Monitoring: RSS feed integration for market news tracking
- Python 3.9+
- Futu OpenD: Download and install from Futu OpenAPI
- Ollama: Install from ollama.ai
- AI Model: 根据你的硬件选择
# 笔记本用户(推荐) ollama pull qwen2.5:7b # 服务器用户 ollama pull qwen2.5:14b # 更多选择请参考 MODEL_GUIDE.md
-
Clone the repository:
git clone <repository-url> cd Quant_Alpha
-
Create virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Configure environment variables:
cp .env.example .env # Edit .env with your configuration
- SIMULATION: Paper trading with virtual portfolio (recommended for testing)
- REAL: Live trading with real money (use with caution)
Edit .env file:
TRADING_MODE=SIMULATION # Change to REAL for live tradingChoose the right model for your hardware:
# 笔记本用户(推荐)
MODEL_PRESET=balanced # qwen2.5:7b, 4GB RAM
# 服务器用户
MODEL_PRESET=performance # qwen2.5:14b, 8GB RAM
# 低配置设备
MODEL_PRESET=lightweight # qwen2.5:3b, 2GB RAM📖 详细的模型选择指南: MODEL_GUIDE.md
🔧 快速切换工具:
python scripts/switch_model.py --list # 查看所有配置
python scripts/switch_model.py --set balanced # 切换配置Add stock codes to monitor (HK market format):
WATCHLIST=00700,09988,01299,03690Adjust risk parameters in .env:
MAX_POSITION_SIZE: Maximum position size per stock (default: 15%)INITIAL_POSITION: Initial position size for new buys (default: 5%)STOP_LOSS: Stop loss threshold (default: 20%)
全新赛博朋克风格交易界面,灵感来自 nof1.ai,为您的量化交易提供酷炫的可视化体验:
# 一键启动 Alpha Arena
./start_alpha_arena.sh
# 或直接运行 Flask 后访问
python app.py然后访问: http://localhost:9999/arena
Alpha Arena 特点:
- 🎮 赛博朋克终端风格设计
- 📈 实时价格滚动条
- 💹 交互式账户价值图表
- 🔥 动态交易历史展示
- 🤖 AI 模型状态监控
- ⚡ 流畅的动画效果
- 🌈 荧光主题配色
- 📊 多维度性能排行榜
详见 ALPHA_ARENA_GUIDE.md 查看完整使用说明。
专业级管理界面,基于 CoreUI Bootstrap Admin Template(12.1k stars)开发:
# 启动 CoreUI 界面
./start_web_coreui.sh
# 或直接运行
python app.py然后访问: http://localhost:9999
CoreUI界面特点:
- ✨ 现代化专业设计
- 📊 实时行情数据显示
- 💰 富途模拟账户集成
- 📰 自动财经新闻聚合
- ⚡ 流畅的交互体验
- 📱 完美响应式布局
- 🎨 基于Bootstrap 5
- 🚀 Flask后端API
详见 COREUI_GUIDE.md 查看完整使用说明。
- Launch FutuOpenD application
- Login with your Futu account
- Enable API access in settings
python main.pyThe system will:
- Connect to Futu OpenD and Ollama
- Run daily analysis after market close (16:30 HKT)
- Generate weekly reports (Monday 09:00)
- Log all decisions and trades
You can trigger manual analysis by modifying main.py or creating a CLI interface.
├── config/ # Configuration management
├── core/ # Trading logic and AI analysis
├── data/ # Data collection (Futu API, news)
├── utils/ # Logging and notifications
└── main.py # Application entry point
- Position Limits: Prevents over-concentration in single stocks
- Stop Loss: Automatic exit on excessive losses
- AI Score Thresholds: Only trades high-confidence signals
- Audit Logging: Complete transaction history
- Confirmation Prompts: Manual approval for real trading mode
This software is for educational and research purposes. Trading stocks involves substantial risk of loss.
- Always test in SIMULATION mode first
- Never invest more than you can afford to lose
- Past performance does not guarantee future results
- The AI analysis is not financial advice
- Monitor the system regularly
- Ensure FutuOpenD is running and logged in
- Check
FUTU_IPandFUTU_PORTin.env - Verify API access is enabled in FutuOpenD settings
- Verify Ollama is running:
ollama list - Check model is downloaded:
ollama pull qwen2.5:14b - Test connection:
curl http://localhost:11434/api/tags
- Check logs in
logs/directory - Verify sufficient buying power
- Ensure market is open during trading hours
MIT License - See LICENSE file for details
Contributions welcome! Please open issues or submit pull requests.