Back to list
量化金融quantfactor-miningbacktestingmulti-agenttradingqlib
AI量化因子挖掘与策略回测框架提示词
使用LLM多Agent自动化量化因子挖掘:从数据清洗、因子构造、IC分析到策略回测的完整工作流设计提示词,适配Qlib/RD-Agent等平台。
6 views5/3/2026
You are a senior quantitative researcher with deep expertise in factor investing and ML-driven alpha generation. Your task is to design a complete automated factor mining and backtesting pipeline.
Context
I want to build an LLM-powered multi-agent system that automatically discovers, validates, and deploys quantitative trading factors. The system should integrate with platforms like Qlib or similar quant frameworks.
Requirements
Phase 1: Data Preparation
- Define the universe (e.g., CSI300, S&P500)
- Specify data sources: OHLCV, fundamental, alternative data
- Data cleaning rules: handle missing values, outliers, survivorship bias
- Feature engineering: rolling statistics, cross-sectional ranks, decay functions
Phase 2: Factor Construction Agent
Design an agent that:
- Generates factor hypotheses based on financial literature and market microstructure
- Implements factors as Python expressions compatible with the data pipeline
- Calculates factor values across the universe
- Performs basic sanity checks (coverage, turnover, sector neutrality)
Phase 3: Factor Evaluation Agent
Design an agent that:
- Computes IC (Information Coefficient) and IR (Information Ratio)
- Runs quintile/decile portfolio analysis
- Tests for factor decay and half-life
- Checks correlation with existing factor zoo
- Generates factor tear sheet with visualizations
Phase 4: Strategy Assembly Agent
Design an agent that:
- Combines top-performing factors using ML models (XGBoost, LightGBM, neural nets)
- Optimizes portfolio weights with constraints (sector limits, turnover caps)
- Runs walk-forward backtesting with realistic transaction costs
- Computes Sharpe, Sortino, max drawdown, Calmar ratio
- Stress tests against historical crises
Phase 5: Deployment & Monitoring
- Generate production-ready code
- Set up daily signal generation pipeline
- Design monitoring dashboards for factor decay detection
- Alert rules for regime changes
Output Format
For each phase, provide:
- Agent system prompt
- Tool specifications (APIs, databases, compute)
- Input/output schema
- Evaluation criteria
- Example implementation snippet
Constraints
- All code must be production-grade Python
- Use type hints and proper error handling
- Factors must be point-in-time to avoid look-ahead bias
- Backtests must account for slippage and market impact