diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md new file mode 100644 index 0000000000..0ba45684ee --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -0,0 +1,40 @@ +--- +name: "\U0001F41B Bug Report" +about: Submit a bug report to help us improve Qlib +labels: bug + +--- + +## πŸ› Bug Description + + + +## To Reproduce + +Steps to reproduce the behavior: + +1. +1. +1. + + +## Expected Behavior + + + +## Screenshot + + + +## Environment + +**Note**: One could run `python scripts/collect_info.py` under the `qlib` directory to get the following information. + + - Qlib version: + - Python version: + - OS (`Windows`, `Linux`, `MacOS`): + - Commit number (optional, please provide it if you are using the dev version): + +## Additional Notes + + \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/documentation.md b/.github/ISSUE_TEMPLATE/documentation.md new file mode 100644 index 0000000000..96c70e5afa --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation.md @@ -0,0 +1,9 @@ +--- +name: "\U0001F4D6 Documentation" +about: Report an issue related to documentation + +--- + +## πŸ“– Documentation + + diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md new file mode 100644 index 0000000000..b5f90203d5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -0,0 +1,25 @@ +--- +name: "\U0001F31FFeature Request" +about: Request for a new Qlib feature +labels: enhancement + +--- + +## 🌟 Feature Description + + +## Motivation + +1. Application scenario +2. Related works (Papers, Github repos etc.): +3. Any other relevant and important information: + + + +## Alternatives + + + +## Additional Notes + + \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md new file mode 100644 index 0000000000..2d35dc9517 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.md @@ -0,0 +1,10 @@ +--- +name: "❓Questions & Help" +about: Have some questions? We can offer help. +labels: question + +--- + +## ❓ Questions and Help + +We sincerely suggest you to carefully read the [documentation](http://qlib.readthedocs.io/) of our library as well as the official [paper](https://arxiv.org/abs/2009.11189). After that, if you still feel puzzled, please describe the question clearly under this issue. \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000000..26701a9e24 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,24 @@ + + +## Description + + +## Motivation and Context + + + +## How Has This Been Tested? +- [ ] Pass the test by running: `pytest qlib/tests/test_all_pipeline.py` under upper directory of `qlib`. +- [ ] If you are adding a new feature, test on your own test scripts. + + + +## Screenshots of Test Results (if appropriate): +1. Pipeline test: +2. Your own tests: + +## Types of changes + +- [ ] Fix bugs +- [ ] Add new feature +- [ ] Update documentation diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000000..ec8ea5d69a --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,33 @@ +name-template: 'v$RESOLVED_VERSION 🌈' +tag-template: 'v$RESOLVED_VERSION' +categories: + - title: '🌟 Features' + labels: + - 'feature' + - 'enhancement' + - title: 'πŸ› Bug Fixes' + labels: + - 'fix' + - 'bugfix' + - 'bug' + - title: 'πŸ“š Documentation' + label: + - 'doc' + - 'documentation' +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. +version-resolver: + major: + labels: + - 'major' + minor: + labels: + - 'minor' + patch: + labels: + - 'patch' + default: patch +template: | + ## Changes + + $CHANGES \ No newline at end of file diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000000..9ce2e8fb4e --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,61 @@ +# This workflows will upload a Python Package using Twine when a release is created +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries + +name: Upload Python Package + +on: + release: + types: [created] + +jobs: + deploy_with_bdist_wheel: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest, macos-latest] + python-version: [3.6, 3.7, 3.8] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Build wheel on Windows + run: | + pip install numpy + pip install cython + python setup.py bdist_wheel + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + twine upload dist/* + + deploy_with_manylinux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Build wheel on Linux + uses: RalfG/python-wheels-manylinux-build@v0.3.1-manylinux2010_x86_64 + with: + python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38' + build-requirements: 'numpy cython' + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.7 + - name: Install dependencies + run: | + pip install twine + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + twine upload dist/pyqlib-*-manylinux*.whl \ No newline at end of file diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000000..90dbf7b797 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,19 @@ +name: Release Drafter + +on: + push: + # branches to consider in the event; optional, defaults to all + branches: + - master + +jobs: + update_release_draft: + runs-on: ubuntu-latest + steps: + # Drafts your next Release notes as Pull Requests are merged into "master" + - uses: release-drafter/release-drafter@v5.11.0 + with: + # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml + # config-name: my-config.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000000..20cbf326a0 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,60 @@ +name: Test + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest, ubuntu-16.04, ubuntu-18.04, macos-latest] + python-version: [3.6, 3.7, 3.8] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + pip install --upgrade cython + pip install numpy jupyter jupyter_contrib_nbextensions + python setup.py install + + - name: Install Lightgbm for MacOS + if: runner.os == 'macOS' + run: | + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" + brew install lightgbm + + - name: Install test dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + + - name: Unit tests with Pytest + run: | + cd tests + pytest . --durations=0 + + - name: Test data downloads and examples + run: | + python scripts/get_data.py qlib_data_cn --target_dir ~/.qlib/qlib_data/cn_data + # cd examples + # estimator -c estimator/estimator_config.yaml + # jupyter nbconvert --execute estimator/analyze_from_estimator.ipynb --to html \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5c8ce5e3a9..0af365d7b0 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,5 @@ mlruns/ tags +.pytest_cache/ +.vscode/ diff --git a/README.md b/README.md index 7aca385d57..45ccea1c6d 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,15 @@ - +[![Python Versions](https://img.shields.io/pypi/pyversions/pyqlib.svg?logo=python&logoColor=white)](https://pypi.org/project/pyqlib/#files) +[![Platform](https://img.shields.io/badge/platform-linux%20%7C%20windows%20%7C%20macos-lightgrey)](https://pypi.org/project/pyqlib/#files) +[![PypI Versions](https://img.shields.io/pypi/v/pyqlib)](https://pypi.org/project/pyqlib/#files) +[![Documentation Status](https://readthedocs.org/projects/qlib/badge/?version=latest)](https://qlib.readthedocs.io/en/latest/?badge=latest) +![Upload Python Package](https://github.com/microsoft/qlib/workflows/Upload%20Python%20Package/badge.svg) +[![License](https://img.shields.io/pypi/l/pyqlib)](LICENSE) [![Join the chat at https://gitter.im/Microsoft/qlib](https://badges.gitter.im/Microsoft/qlib.svg)](https://gitter.im/Microsoft/qlib?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -
- -
+ +

+ +

Qlib is an AI-oriented quantitative investment platform, which aims to realize the potential, empower the research, and create the value of AI technologies in quantitative investment. @@ -56,7 +62,13 @@ This quick start guide tries to demonstrate ## Installation -Users can easily intsall ``Qlib`` according to the following steps: +Users can easily install ``Qlib`` by pip according to the following command + +```bash + pip install pyqlib +``` + +Also, Users can install ``Qlib`` by the source code according to the following steps: * Before installing ``Qlib`` from source, users need to install some dependencies: @@ -83,7 +95,7 @@ This dataset is created by public data collected by [crawler scripts](scripts/da the same repository. Users could create the same dataset with it. -*Please pay **ATTENTION** that the data is collected from [Yahoo Finance](https://finance.yahoo.com/lookup) and the data might not be perfect. We recommend users to prepare their own data if they have high-quality dataset. For more information, users can refer to the [related document](https://qlib.readthedocs.io/en/latest/component/data.html#converting-csv-format-into-qlib-format)* +*Please pay **ATTENTION** that the data is collected from [Yahoo Finance](https://finance.yahoo.com/lookup) and the data might not be perfect. We recommend users to prepare their own data if they have high-quality dataset. For more information, users can refer to the [related document](https://qlib.readthedocs.io/en/latest/component/data.html#converting-csv-format-into-qlib-format)*.