Qlib
Microsoft's open-source quantitative research platform that covers data processing, machine-learning model training and backtesting in one workflow, driven by config files or Python code.
Explore machine-learning ideas for markets end to end, from datasets to model training to backtest reports, in one open framework.
Who it is for
Researchers, students and advanced Python users who want to experiment with ML-based strategies and evaluate them with backtests, for research and education.
Strengths
- Covers the research pipeline: data infrastructure, supervised models such as LightGBM, XGBoost, LSTM and Transformer, then backtesting and reporting.
- Ships Alpha158 and Alpha360 datasets for the US and China markets.
- The qrun tool runs a whole workflow from a config file, and a modular Python API lets you build your own.
- Installs from PyPI with pip install pyqlib.
Good to know
- A research and modelling platform, not a trading bot: it does not describe live broker connections.
- The README says the official dataset is temporarily disabled and points to a community data source; Yahoo-derived data may not be perfect, so prepare your own quality data.
- The README lists Python 3.8 to 3.12, and notes that some example scripts may fail and some baselines need specific Python versions.
- Unreleased changes on the main branch restrict loading saved artifacts; check the migration guide before upgrading from source.
- Any backtest is illustrative and never a promise of returns.
Custom bots are coming soon
We are preparing a service to build bots on tools like this one. Follow our Telegram channel to know when it opens.
Real-life uses
Test a machine-learning stock-ranking idea from data to backtest report
Load a US equity dataset, train a gradient-boosting model to rank stocks, and run a backtest with trading costs in one config-driven workflow, then compare it with a simple index benchmark. This is a research exercise, illustrative only, never a promise of returns.
Compare it with others
PyPortfolioOpt vs Riskfolio-Lib vs skfolio: which Python portfolio optimization library to start with
Three free, open-source Python libraries for portfolio optimization compared from checked sources: methods, risk models, validation tools, level and who each one suits.
PyBroker vs LumiBot vs bt: free Python frameworks for backtesting strategies
Three free Python frameworks compared: PyBroker for machine-learning strategies with walk-forward tests, LumiBot for going from backtest to paper trading and a broker, and bt for portfolio allocation and rebalancing. Licences, level and who each suits.
QuantConnect vs NautilusTrader vs Zipline Reloaded: which backtesting engine to learn?
A cloud lab with data included, a fast open-source engine and a respected classic compared: cost, licence, level, markets and who each backtesting platform suits.
Quick answers
How much does Qlib cost?
Free and open source (MIT). Prices change, so check the official website before you decide.
Is Qlib open source?
Yes. License: MIT.
Who is Qlib for?
Researchers, students and advanced Python users who want to experiment with ML-based strategies and evaluate them with backtests, for research and education.
What is Qlib written in?
Qlib is written in Python.
What should I know before using Qlib?
A research and modelling platform, not a trading bot: it does not describe live broker connections. The README says the official dataset is temporarily disabled and points to a community data source; Yahoo-derived data may not be perfect, so prepare your own quality data. The README lists Python 3.8 to 3.12, and notes that some example scripts may fail and some baselines need specific Python versions. Unreleased changes on the main branch restrict loading saved artifacts; check the migration guide before upgrading from source. Any backtest is illustrative and never a promise of returns.
Want a bot like this when custom bots open? Get notified · All comparisons · Guides
Sources
Every fact on this page comes from these sources, checked on 2026-11-28. If something has changed, the source wins.
- https://raw.githubusercontent.com/microsoft/qlib/main/README.md: purpose, features, datasets, models, qrun, install command, Python versions 3.8 to 3.12, data notes
- https://api.github.com/repos/microsoft/qlib: MIT, about 50,600 stars, last push 2026-11-04, not archived
Alternatives in Backtesting
FinRL
Open-source Python framework for learning and experimenting with reinforcement-learning trading agents on stock, crypto and portfolio environments.
NautilusTrader
High-performance algorithmic trading platform (Rust core, used from Python) that runs the same strategy code in backtests and live.
Riskfolio-Lib
Python library for portfolio optimization built on CVXPY and Pandas, with mean-risk, risk parity, hierarchical clustering and Black-Litterman models plus reports and charts.
skfolio
Python library for portfolio optimization and risk management built on scikit-learn, with cross-validation tools to test portfolio models on walk-forward and purged splits.