This is a fork of Microsoft Qlib with some bug fixes and new features. Thanks for the Microsoft Qlib team for their great work.
I'm currently using qlib to resarch and execute some factor strategies on my own. However, some features I need are not avaliable in the original qlib also there are some bugs. So I forked the original qlib and added some features I need. I hope this fork can help some people who are also using qlib. I will try to merge some non-debateable features/bugfix to the original qlib. But will keep some features that might be controversial in the fork only.
Feature | Description | Status |
---|---|---|
Cross Sectional Factor | Add cross-sectional factors such as cross-sectional ranking; average etc | Done (Linux only) |
Orthogonalization preprocesser | Add preprocessers to do Schimit and Symetric Orthogonalization | Done |
Support non-adjusted data | Add support for non-adjusted data | Done |
Enhanced plotting I | Use rangebreak to allow Datetime axis in plottings | Merged |
Enhanced plotting II | Add support for plotting factor returns | Done |
Enhanced plotting III | 1) Custom benchmark; 2) stratifying fix; 3) Colorbar enhancement | Merging |
Topk backtest engine I | Allow sell in limit-up case and allow buy in limit-down case | Merged |
Topk backtest engine II | Sell names which are removed from instrument population (expired, delisted, removed from index etc) | Done |
Ops Today |
Return Calendar days since BASE_DAY(1970-01-01) | Done |
Customize float data precision | Allow customize the precision of dumped data (to float64) | Done |
- Done: The feature is implemented in this fork but will not be merged to the original qlib. Either because it is rejected by the original qlib team or because it is not suitable for the original qlib.
- Merged: The feature is merged to the original qlib.
- Merging: PR opened to the original qlib but not accepted yet.
- Developing: The feature is under development.
This quick start guide tries to demonstrate
- It's very easy to build a complete Quant research workflow and try your ideas with Qlib.
- Though with public data and simple models, machine learning technologies work very well in practical Quant investment.
Here is a quick demo shows how to install Qlib
, and run LightGBM with qrun
.
This table demonstrates the supported Python version of Qlib
:
install with pip | install from source | plot | |
---|---|---|---|
Python 3.7 | ❌ | ✔️ | ✔️ |
Python 3.8 | ❌ | ✔️ | ✔️ |
Python 3.9 | ❌ | ✔️ | ✔️ |
Note:
- Conda is suggested for managing your Python environment.
- Please pay attention that installing cython in Python 3.6 will raise some error when installing
Qlib
from source. If users use Python 3.6 on their machines, it is recommended to upgrade Python to version 3.7 or useconda
's Python to installQlib
from source. Qlib
Requirestables
package,hdf5
in tables does not support python3.9.- This fork is not available on
pip
.
Current the fork is not available in pip or conda
Users can install the latest forked version Qlib
by the source code according to the following steps:
-
Before installing
Qlib
from source, users need to install some dependencies:pip install numpy pip install --upgrade cython
-
Clone the repository and install
Qlib
as follows.git clone https://github.com/qianyun210603/qlib.git && cd qlib pip install .
Note: You can install Qlib with
python setup.py install
as well. But it is not the recommended approach. It will skippip
and cause obscure problems. For example, only the commandpip install .
can overwrite the stable version installed bypip install pyqlib
, while the commandpython setup.py install
can't.
Tips: If you fail to install Qlib
or run the examples in your environment, comparing your steps and the CI workflow may help you find the problem.
Please refer the readme and documentation of the original qlib.
The forked version inherits the licence of the original qlib. See LICENSE for details.