Qlib is an AI-oriented quantitative investment platform that aims to realize the potential of AI technology in quantitative investment, empower research, and create value. It includes data processing, model training, and a complete machine learning workflow, and covers the full chain of quantitative investing: Alpha forecasting, risk modeling, portfolio optimization, and order execution.
For financial practitioners, the Qlib platform greatly reduces the threshold of using AI algorithms. It integrates more than a dozen examples of the use of AI algorithms in financial scenarios for reference, and provides a high-performance infrastructure and data and model management platform adapted to AI algorithms for the entire financial industry. For AI practitioners, Qlib provides a comprehensive framework for investment research, as well as multiple cross-market datasets and industry-leading benchmarks designed based on domain knowledge.
Qlib platform function modules:
install:
- pip install
pip install pyqlib
- Source code installation
1、Add dependency
pip install numpypip install --upgrade cython
2、Clone warehouse
##Have used pip install pyqlib install git clone https://github.com/microsoft/qlib.git && cd qlibpip install
##have never used pip install pyqlib install git clone https://github.com/microsoft/qlib.git && cd qlibpython setup.py install
initialization data:
1、Download data
python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn
2、initialize
import qlib# region in [REG_CN, REG_US]from qlib.config import REG_CNprovider_uri = "~/.qlib/qlib_data/cn_data" # target_dirqlib.init(provider_uri=provider_uri, region=REG_CN)
Example: Automatic quantification of research workflows
1、start
##Avoid running programs in directories that contain 'qlib'cd examples qrun benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml
Or use it in debug mode
python -m pdb qlib/workflow/cli.py examples/benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml
2、result
- day trading
- Graphic report analysis
operation examples/workflow_by_code.ipynb与jupyter notebook
For more detailed information about the features, please read the Features API for yourself.