qlib
Qlib is an AI-oriented Quant investment platform that aims to use AI tech to empower Quant Research, from exploring ideas to implementing productions. Qlib supports diverse ML modeling paradigms, including supervised learning, market dynamics modeling, and RL, and is now equipped with https://github.com/microsoft/RD-Agent to automate R&D process.
File Explorer
Download Latest Version (.zip)- bug-report.md
- documentation.md
- feature-request.md
- question.md
- lint_title.yml
- release.yml
- stale.yml
- test_qlib_from_pip.yml
- test_qlib_from_source.yml
- test_qlib_from_source_slow.yml
- brew_install.sh
- PULL_REQUEST_TEMPLATE.md
- release-drafter.yml
- analysis_model_auto_correlation.png
- analysis_model_cumulative_return.png
- analysis_model_IC.png
- analysis_model_long_short.png
- analysis_model_monthly_IC.png
- analysis_model_NDQ.png
- cumulative_return_buy.png
- cumulative_return_buy_minus_sell.png
- cumulative_return_hold.png
- cumulative_return_sell.png
- rank_label_buy.png
- rank_label_hold.png
- rank_label_sell.png
- report.png
- risk_analysis_annualized_return.png
- risk_analysis_bar.png
- risk_analysis_information_ratio.png
- risk_analysis_max_drawdown.png
- risk_analysis_std.png
- score_ic.png
- 1.png
- 2.png
- 3.png
- white_bg_rec+word.png
- yel_bg_rec+word.png
- yellow_bg_rec+word .png
- yellow_bg_rec.png
- gitter_qr.png
- change doc.gif
- framework-abstract.jpg
- framework.png
- framework.svg
- online_serving.png
- QlibRL_framework.png
- rdagent_logo.png
- RL_framework.png
- Task-Gen-Recorder-Collector.svg
- topk_drop.png
- demo.sh
- alpha.rst
- PIT.rst
- serial.rst
- server.rst
- task_management.rst
- changelog.rst
- framework.rst
- guidance.rst
- overall.rst
- quickstart.rst
- toctree.rst
- data.rst
- highfreq.rst
- meta.rst
- model.rst
- online.rst
- recorder.rst
- report.rst
- strategy.rst
- workflow.rst
- code_standard_and_dev_guide.rst
- how_to_build_image.rst
- FAQ.rst
- client.rst
- online.rst
- tuner.rst
- introduction.rst
- quick.rst
- api.rst
- getdata.rst
- initialization.rst
- installation.rst
- integration.rst
- conf.py
- index.rst
- make.bat
- Makefile
- requirements.txt
- README.md
- requirements.txt
- workflow_config_adarnn_Alpha360.yaml
- README.md
- requirements.txt
- workflow_config_add_Alpha360.yaml
- README.md
- requirements.txt
- workflow_config_alstm_Alpha158.yaml
- workflow_config_alstm_Alpha360.yaml
- README.md
- requirements.txt
- workflow_config_catboost_Alpha158.yaml
- workflow_config_catboost_Alpha158_csi500.yaml
- workflow_config_catboost_Alpha360.yaml
- workflow_config_catboost_Alpha360_csi500.yaml
- README.md
- requirements.txt
- workflow_config_doubleensemble_Alpha158.yaml
- workflow_config_doubleensemble_Alpha158_csi500.yaml
- workflow_config_doubleensemble_Alpha360.yaml
- workflow_config_doubleensemble_Alpha360_csi500.yaml
- workflow_config_doubleensemble_early_stop_Alpha158.yaml
- README.md
- requirements.txt
- workflow_config_gats_Alpha158.yaml
- workflow_config_gats_Alpha360.yaml
- README.md
- workflow_config_gru.yaml
- workflow_config_gru2mlp.yaml
- workflow_config_mlp.yaml
- csi300_gru_ts.pkl
- model_gru_csi300.pkl
- README.md
- requirements.txt
- workflow_config_gru_Alpha158.yaml
- workflow_config_gru_Alpha360.yaml
- qlib_csi300_stock_index.npy
- README.md
- requirements.txt
- workflow_config_hist_Alpha360.yaml
- README.md
- requirements.txt
- workflow_config_igmtf_Alpha360.yaml
- README.md
- requirements.txt
- workflow_config_krnn_Alpha360.yaml
- features_resample_N.py
- features_sample.py
- multi_freq_handler.py
- README.md
- requirements.txt
- workflow_config_lightgbm_Alpha158.yaml
- workflow_config_lightgbm_Alpha158_csi500.yaml
- workflow_config_lightgbm_Alpha158_multi_freq.yaml
- workflow_config_lightgbm_Alpha360.yaml
- workflow_config_lightgbm_Alpha360_csi500.yaml
- workflow_config_lightgbm_configurable_dataset.yaml
- workflow_config_lightgbm_multi_freq.yaml
- requirements.txt
- workflow_config_linear_Alpha158.yaml
- workflow_config_linear_Alpha158_csi500.yaml
- workflow_config_linear_Alpha158_multi_pass_bt.yaml
- README.md
- requirements.txt
- workflow_config_localformer_Alpha158.yaml
- workflow_config_localformer_Alpha360.yaml
- csi300_lstm_ts.pkl
- model_lstm_csi300.pkl
- README.md
- requirements.txt
- workflow_config_lstm_Alpha158.yaml
- workflow_config_lstm_Alpha360.yaml
- README.md
- requirements.txt
- workflow_config_mlp_Alpha158.yaml
- workflow_config_mlp_Alpha158_csi500.yaml
- workflow_config_mlp_Alpha360.yaml
- workflow_config_mlp_Alpha360_csi500.yaml
- README.md
- requirements.txt
- workflow_config_sandwich_Alpha360.yaml
- README.md
- requirements.txt
- workflow_config_sfm_Alpha360.yaml
- README.md
- requirements.txt
- workflow_config_TabNet_Alpha158.yaml
- workflow_config_TabNet_Alpha360.yaml
- README.md
- requirements.txt
- workflow_config_tcn_Alpha158.yaml
- workflow_config_tcn_Alpha360.yaml
- README.md
- requirements.txt
- workflow.png
- workflow_config_tcts_Alpha360.yaml
- __init__.py
- base.py
- qlib_Alpha158.py
- __init__.py
- configs.py
- __init__.py
- hyperparam_opt.py
- tft_model.py
- utils.py
- README.md
- requirements.txt
- tft.py
- workflow_config_tft_Alpha158.yaml
- config_alstm.yaml
- config_alstm_tra.yaml
- config_alstm_tra_init.yaml
- config_transformer.yaml
- config_transformer_tra.yaml
- config_transformer_tra_init.yaml
- README.md
- dataset.py
- model.py
- example.py
- README.md
- Reports.ipynb
- requirements.txt
- run.sh
- workflow_config_tra_Alpha158.yaml
- workflow_config_tra_Alpha158_full.yaml
- workflow_config_tra_Alpha360.yaml
- README.md
- requirements.txt
- workflow_config_transformer_Alpha158.yaml
- workflow_config_transformer_Alpha360.yaml
- README.md
- requirements.txt
- workflow_config_xgboost_Alpha158.yaml
- workflow_config_xgboost_Alpha360.yaml
- README.md
- README.md
- rolling_benchmark.py
- workflow_config_lightgbm_Alpha158.yaml
- workflow_config_linear_Alpha158.yaml
- Makefile
- README.md
- requirements.txt
- vis_data.py
- workflow.py
- README.md
- data_cache_demo.py
- data_mem_resuse_demo.py
- README.md
- highfreq_handler.py
- highfreq_ops.py
- highfreq_processor.py
- README.md
- workflow.py
- workflow_config_High_Freq_Tree_Alpha158.yaml
- hyperparameter_158.py
- hyperparameter_360.py
- Readme.md
- requirements.txt
- feature.py
- requirements.txt
- task_manager_rolling.py
- README.md
- workflow.py
- online_management_simulate.py
- rolling_online_management.py
- update_online_pred.py
- create_dataset.py
- example.py
- README.md
- config_enhanced_indexing.yaml
- prepare_riskdata.py
- README.md
- simple_example.ipynb
- backtest_opds.yml
- backtest_ppo.yml
- backtest_twap.yml
- train_opds.yml
- train_ppo.yml
- gen_pickle_data.py
- gen_training_orders.py
- merge_orders.py
- pickle_data_config.yml
- README.md
- README.md
- rolling_handler.py
- workflow.py
- detailed_workflow.ipynb
- README.md
- run_all_model.py
- workflow_by_code.ipynb
- workflow_by_code.py
- __init__.py
- account.py
- backtest.py
- decision.py
- exchange.py
- executor.py
- high_performance_ds.py
- position.py
- profit_attribution.py
- report.py
- signal.py
- utils.py
- __init__.py
- data.py
- run.py
- __init__.py
- sepdf.py
- __init__.py
- data.py
- dataset.py
- handler.py
- highfreq_handler.py
- highfreq_processor.py
- highfreq_provider.py
- loader.py
- processor.py
- __init__.py
- alpha.py
- __init__.py
- dataset.py
- model.py
- net.py
- utils.py
- __init__.py
- __init__.py
- catboost_model.py
- double_ensemble.py
- gbdt.py
- highfreq_gdbt_model.py
- linear.py
- pytorch_adarnn.py
- pytorch_add.py
- pytorch_alstm.py
- pytorch_alstm_ts.py
- pytorch_gats.py
- pytorch_gats_ts.py
- pytorch_general_nn.py
- pytorch_gru.py
- pytorch_gru_ts.py
- pytorch_hist.py
- pytorch_igmtf.py
- pytorch_krnn.py
- pytorch_localformer.py
- pytorch_localformer_ts.py
- pytorch_lstm.py
- pytorch_lstm_ts.py
- pytorch_nn.py
- pytorch_sandwich.py
- pytorch_sfm.py
- pytorch_tabnet.py
- pytorch_tcn.py
- pytorch_tcn_ts.py
- pytorch_tcts.py
- pytorch_tra.py
- pytorch_transformer.py
- pytorch_transformer_ts.py
- pytorch_utils.py
- tcn.py
- xgboost.py
- __init__.py
- manager.py
- online_model.py
- operator.py
- user.py
- utils.py
- __init__.py
- high_freq.py
- __init__.py
- analysis_model_performance.py
- __init__.py
- cumulative_return.py
- parse_position.py
- rank_label.py
- report.py
- risk_analysis.py
- score_ic.py
- __init__.py
- ana.py
- base.py
- __init__.py
- graph.py
- utils.py
- __init__.py
- __main__.py
- base.py
- ddgda.py
- __init__.py
- base.py
- enhanced_indexing.py
- optimizer.py
- __init__.py
- cost_control.py
- order_generator.py
- rule_strategy.py
- signal_strategy.py
- __init__.py
- config.py
- launcher.py
- pipeline.py
- space.py
- tuner.py
- __init__.py
- record_temp.py
- __init__.py
- evaluate.py
- evaluate_portfolio.py
- torch.py
- __init__.py
- expanding.pyx
- rolling.pyx
- __init__.py
- handler.py
- loader.py
- processor.py
- storage.py
- utils.py
- weight.py
- __init__.py
- file_storage.py
- storage.py
- __init__.py
- base.py
- cache.py
- client.py
- data.py
- filter.py
- inst_processor.py
- ops.py
- pit.py
- __init__.py
- ensemble.py
- group.py
- __init__.py
- base.py
- __init__.py
- dataset.py
- model.py
- task.py
- __init__.py
- base.py
- poet.py
- shrink.py
- structured.py
- __init__.py
- base.py
- trainer.py
- utils.py
- __init__.py
- backtest.py
- naive_config_parser.py
- train_onpolicy.py
- utils.py
- __init__.py
- base.py
- integration.py
- native.py
- pickle_styled.py
- __init__.py
- interpreter.py
- network.py
- policy.py
- reward.py
- simulator_qlib.py
- simulator_simple.py
- state.py
- strategy.py
- utils.py
- __init__.py
- single_order.py
- __init__.py
- api.py
- callbacks.py
- trainer.py
- vessel.py
- __init__.py
- data_queue.py
- env_wrapper.py
- finite_env.py
- log.py
- __init__.py
- aux_info.py
- interpreter.py
- reward.py
- seed.py
- simulator.py
- __init__.py
- base.py
- __init__.py
- config.py
- data.py
- test_config_validation.py
- __init__.py
- data.py
- exceptions.py
- file.py
- index_data.py
- mod.py
- objm.py
- paral.py
- pickle_utils.py
- resam.py
- serial.py
- time.py
- __init__.py
- manager.py
- strategy.py
- update.py
- utils.py
- __init__.py
- collect.py
- gen.py
- manage.py
- utils.py
- __init__.py
- exp.py
- expm.py
- record_temp.py
- recorder.py
- utils.py
- __init__.py
- config.py
- constant.py
- log.py
- typehint.py
- collector.py
- README.md
- requirements.txt
- collector.py
- README.md
- requirements.txt
- collector.py
- README.md
- requirements.txt
- fill_cn_1min_data.py
- README.md
- requirements.txt
- future_trading_date_collector.py
- README.md
- requirements.txt
- README.md
- collector.py
- README.md
- requirement.txt
- collector.py
- README.md
- requirements.txt
- collector.py
- README.md
- requirements.txt
- collector.py
- README.md
- requirements.txt
- collector.py
- README.md
- requirements.txt
- base.py
- future_calendar_collector.py
- index.py
- README.md
- utils.py
- check_data_health.py
- check_dump_bin.py
- collect_info.py
- dump_bin.py
- dump_pit.py
- get_data.py
- README.md
- test_file_strategy.py
- test_high_freq_trading.py
- test_soft_topk_strategy.py
- test_soft_topk_strategy_cold_start.py
- README.md
- test_dataloader.py
- test_dataset.py
- test_handler.py
- test_handler_storage.py
- test_processor.py
- README.md
- test_datalayer.py
- README.md
- test_mlflow.py
- test_get_multi_proc.py
- test_index_data.py
- test_sepdf.py
- test_utils.py
- test_general_nn.py
- test_elem_operator.py
- test_special_ops.py
- test_data_queue.py
- test_finite_env.py
- test_logger.py
- test_qlib_simulator.py
- test_saoe_simple.py
- test_trainer.py
- test_update_pred.py
- test_storage.py
- conftest.py
- pytest.ini
- test_all_pipeline.py
- test_contrib_model.py
- test_contrib_workflow.py
- test_dump_data.py
- test_get_data.py
- test_pit.py
- test_register_ops.py
- test_structured_cov_estimator.py
- test_workflow.py
- .commitlintrc.js
- .deepsource.toml
- .dockerignore
- .gitignore
- .mypy.ini
- .pre-commit-config.yaml
- .pylintrc
- .readthedocs.yaml
- build_docker_image.sh
- CHANGELOG.md
- CHANGES.rst
- CODE_OF_CONDUCT.md
- Dockerfile
- LICENSE
- Makefile
- MANIFEST.in
- pyproject.toml
- README.md
- SECURITY.md
- setup.py
# Installation Guide
git clone https://github.com/microsoft/qlib
Downloads the entire project code from GitHub to your computer.
cd qlib
Moves into the project folder you just downloaded.
2. Official Install Script
Easy Recommended- Python 3 Python is required to use pip.
pip install pyqlib
Installs the package published on PyPI directly โ no need to clone the source.
pip install numpy
Installs the package published on PyPI directly โ no need to clone the source.
pip install --upgrade cython
Installs the package published on PyPI directly โ no need to clone the source.
pip install . # `pip install -e .[dev]` is recommended for development. check details in docs/developer/code_standard_and_dev_guide.rst
Installs the package published on PyPI directly โ no need to clone the source.
Pulled directly from this repo's README.
3. Docker
Easy- Git Needed to download the project code from GitHub.
- Docker Desktop Needed to build and run containers. Install it and keep it running in the background.
docker pull pyqlib/qlib_image_stable:stable
Type this command into your terminal and run it.
docker run -it --name <container name> -v <Mounted local directory>:/app pyqlib/qlib_image_stable:stable
Runs the built image as an actual container.
docker start -i -a <container name>
Type this command into your terminal and run it.
docker stop <container name>
Type this command into your terminal and run it.
docker rm <container name>
Type this command into your terminal and run it.
Pulled directly from this repo's README.
4. Python
Easypip install pyqlib
Installs the package published on PyPI directly โ no need to clone the source.
pip install numpy
Installs the package published on PyPI directly โ no need to clone the source.
pip install --upgrade cython
Installs the package published on PyPI directly โ no need to clone the source.
pip install . # `pip install -e .[dev]` is recommended for development. check details in docs/developer/code_standard_and_dev_guide.rst
Installs the package published on PyPI directly โ no need to clone the source.
python -m qlib.cli.data qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn
Runs the Python script (or module).
Pulled directly from this repo's README.
5. Make
Medium- Git Needed to download the project code from GitHub.
- Make Usually pre-installed on Linux/macOS. On Windows, install separately (e.g. via MSYS2 or WSL).
make html
Compiles the code based on the generated build configuration to produce an executable.
Pulled directly from this repo's README.
