Qlib: Microsoft's open-source AI quant investment platform
Microsoft's open-source AI-oriented quant investment platform strings data processing, model training, backtesting, and portfolio optimization into a single pipeline, with a high-performance data engine and 20-plus mainstream model benchmarks, running the full research-to-evaluation flow with one command.
Project facts
GitHub Ecosystem- License
- MIT
- Language
- Python
- Stars
- 48,828
- Data checked
- 2026-09-25
Snapshot figures reflect the check date and may change over time.
Quant research often gets bogged down by a fragmented toolchain—data, modeling, and backtesting each living in their own silo. Microsoft’s open-source Qlib pulls them into a single framework: an AI-oriented quant investment platform covering everything from factor construction and model training to portfolio optimization and order execution in one pipeline. GitHubDaily recommended it in May 2025.
Core features
- End-to-end coverage: a complete built-in machine-learning pipeline, with ready-made components for alpha mining, risk modeling, portfolio optimization, and order execution.
- Data engine: a custom compact binary storage format plus expression and dataset caching—the official benchmark builds a 14-factor dataset in just 7.4 seconds, notably faster than HDF5 or MySQL.
- Model benchmark library: includes 20-plus SOTA models such as LightGBM, LSTM, Transformer, GATs, HIST, and TRA, runnable directly on Alpha158 and Alpha360.
- Multi-paradigm framework: covers supervised-learning prediction, market dynamics adaptation (rolling retraining, DDG-DA), and reinforcement-learning order execution (PPO, TWAP).
- qrun workflow: driven by a YAML config, it automatically runs dataset construction, training, backtesting, and evaluation, producing charts like IC and grouped returns; it also integrates with Microsoft’s RD-Agent for automated factor mining.
Typical use cases
- Reproduce papers or baselines with public data in one step, comparing IC and backtest metrics on a level playing field.
- Plug your own factors or new models into the existing pipeline without building data and backtesting infrastructure from scratch.
- Model order execution and other sequential-decision problems with reinforcement learning for multi-level joint strategy optimization.
Quick start
After installing, pull China market data (the official dataset is temporarily unavailable, so this command scrapes from Yahoo instead), then run a built-in benchmark:
pip install pyqlib
python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn
cd examples && qrun benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml
Summary
This suits quant researchers, machine-learning researchers, and fintech teams running experiments like stock prediction and portfolio optimization. The project is MIT licensed and supports Python 3.8 through 3.12 on Linux/Windows/macOS; getting started requires no API key. Some caveats: the official dataset is offline for now due to data-security policy, so you’ll need a community data source or the repo’s own crawler (Yahoo data quality is limited); the batch script run_all_model.py only supports Linux; on Apple Silicon Macs you need to install libomp before compiling LightGBM; and a few models have extra constraints requiring older TensorFlow versions. Overall, it’s an end-to-end, well-reproducible, and fairly well-engineered open-source quant framework.