PromptForge
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:

  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