AI Quantitative Factor Mining and Strategy Backtesting Framework Prompt
Uses LLM multi-agents for automated quantitative factor mining: a complete workflow design prompt covering data cleaning, factor construction, IC analysis, and strategy backtesting, adaptable to platforms like Qlib/RD-Agent.
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: 1. Generates factor hypotheses based on financial literature and market microstructure 2. Implements factors as Python expressions compatible with the data pipeline 3. Calculates factor values across the universe 4. Performs basic sanity checks (coverage, turnover, sector neutrality) ### Phase 3: Factor Evaluation Agent Design an agent that: 1. Computes IC (Information Coefficient) and IR (Information Ratio) 2. Runs quintile/decile portfolio analysis 3. Tests for factor decay and half-life 4. Checks correlation with existing factor zoo 5. Generates factor tear sheet with visualizations ### Phase 4: Strategy Assembly Agent Design an agent that: 1. Combines top-performing factors using ML models (XGBoost, LightGBM, neural nets) 2. Optimizes portfolio weights with constraints (sector limits, turnover caps) 3. Runs walk-forward backtesting with realistic transaction costs 4. Computes Sharpe, Sortino, max drawdown, Calmar ratio 5. 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: 1. Agent system prompt 2. Tool specifications (APIs, databases, compute) 3. Input/output schema 4. Evaluation criteria 5. 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
How to use this prompt
- 1Copy the complete prompt above.
- 2Replace the topic, subject, or style variables.
- 3Save effective changes to build your own version.


