Skip to content

Commit

Permalink
Improve the style of documentation (microsoft#1132)
Browse files Browse the repository at this point in the history
This commit improves the documentation (rst files) only in the
following three ways:

* Aligned section headers with their underline/overline punctuation characters

* Deleted all trailling whitespaces in rst files

* Deleted a few trailling newlines at the end of the rst files

Co-authored-by: Bingyao Liu <Bingyao.Liu@sofund.com>
  • Loading branch information
bingyao and Bingyao Liu authored Jul 7, 2022
1 parent e62684e commit 1dededa
Show file tree
Hide file tree
Showing 29 changed files with 400 additions and 411 deletions.
56 changes: 28 additions & 28 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,88 +1,88 @@
Changelog
====================
=========
Here you can see the full list of changes between each QLib release.

Version 0.1.0
--------------------
-------------
This is the initial release of QLib library.

Version 0.1.1
--------------------
-------------
Performance optimize. Add more features and operators.

Version 0.1.2
--------------------
- Support operator syntax. Now ``High() - Low()`` is equivalent to ``Sub(High(), Low())``.
-------------
- Support operator syntax. Now ``High() - Low()`` is equivalent to ``Sub(High(), Low())``.
- Add more technical indicators.

Version 0.1.3
--------------------
-------------
Bug fix and add instruments filtering mechanism.

Version 0.2.0
--------------------
-------------
- Redesign ``LocalProvider`` database format for performance improvement.
- Support load features as string fields.
- Add scripts for database construction.
- More operators and technical indicators.

Version 0.2.1
--------------------
-------------
- Support registering user-defined ``Provider``.
- Support use operators in string format, e.g. ``['Ref($close, 1)']`` is valid field format.
- Support dynamic fields in ``$some_field`` format. And existing fields like ``Close()`` may be deprecated in the future.

Version 0.2.2
--------------------
-------------
- Add ``disk_cache`` for reusing features (enabled by default).
- Add ``qlib.contrib`` for experimental model construction and evaluation.


Version 0.2.3
--------------------
-------------
- Add ``backtest`` module
- Decoupling the Strategy, Account, Position, Exchange from the backtest module

Version 0.2.4
--------------------
-------------
- Add ``profit attribution`` module
- Add ``rick_control`` and ``cost_control`` strategies

Version 0.3.0
--------------------
-------------
- Add ``estimator`` module

Version 0.3.1
--------------------
-------------
- Add ``filter`` module

Version 0.3.2
--------------------
-------------
- Add real price trading, if the ``factor`` field in the data set is incomplete, use ``adj_price`` trading
- Refactor ``handler`` ``launcher`` ``trainer`` code
- Support ``backtest`` configuration parameters in the configuration file
- Fix bug in position ``amount`` is 0
- Fix bug of ``filter`` module

Version 0.3.3
-------------------
-------------
- Fix bug of ``filter`` module

Version 0.3.4
--------------------
-------------
- Support for ``finetune model``
- Refactor ``fetcher`` code

Version 0.3.5
--------------------
-------------
- Support multi-label training, you can provide multiple label in ``handler``. (But LightGBM doesn't support due to the algorithm itself)
- Refactor ``handler`` code, dataset.py is no longer used, and you can deploy your own labels and features in ``feature_label_config``
- Handler only offer DataFrame. Also, ``trainer`` and model.py only receive DataFrame
- Change ``split_rolling_data``, we roll the data on market calendar now, not on normal date
- Move some date config from ``handler`` to ``trainer``

Version 0.4.0
--------------------
-------------
- Add `data` package that holds all data-related codes
- Reform the data provider structure
- Create a server for data centralized management `qlib-server<https://amc-msra.visualstudio.com/trading-algo/_git/qlib-server>`_
Expand All @@ -100,7 +100,7 @@ Version 0.4.0


Version 0.4.1
--------------------
-------------
- Add support Windows
- Fix ``instruments`` type bug
- Fix ``features`` is empty bug(It will cause failure in updating)
Expand All @@ -112,19 +112,19 @@ Version 0.4.1


Version 0.4.2
--------------------
-------------
- Refactor DataHandler
- Add ``Alpha360`` DataHandler


Version 0.4.3
--------------------
-------------
- Implementing Online Inference and Trading Framework
- Refactoring The interfaces of backtest and strategy module.


Version 0.4.4
--------------------
-------------
- Optimize cache generation performance
- Add report module
- Fix bug when using ``ServerDatasetCache`` offline.
Expand All @@ -138,30 +138,30 @@ Version 0.4.4


Version 0.4.5
--------------------
-------------
- Add multi-kernel implementation for both client and server.
- Support a new way to load data from client which skips dataset cache.
- Change the default dataset method from single kernel implementation to multi kernel implementation.
- Accelerate the high frequency data reading by optimizing the relative modules.
- Support a new method to write config file by using dict.

Version 0.4.6
--------------------
-------------
- Some bugs are fixed
- The default config in `Version 0.4.5` is not friendly to daily frequency data.
- Backtest error in TopkWeightStrategy when `WithInteract=True`.


Version 0.5.0
--------------------
-------------
- First opensource version
- Refine the docs, code
- Add baselines
- public data crawler


Version 0.8.0
--------------------
-------------
- The backtest is greatly refactored.
- Nested decision execution framework is supported
- There are lots of changes for daily trading, it is hard to list all of them. But a few important changes could be noticed
Expand All @@ -175,5 +175,5 @@ Version 0.8.0


Other Versions
----------------------------------
--------------
Please refer to `Github release Notes <https://github.com/microsoft/qlib/releases>`_
12 changes: 6 additions & 6 deletions docs/FAQ/FAQ.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Qlib FAQ
############

Qlib Frequently Asked Questions
================================
===============================
.. contents::
:depth: 1
:local:
Expand All @@ -13,7 +13,7 @@ Qlib Frequently Asked Questions


1. RuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase...
------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------

.. code-block:: console
Expand Down Expand Up @@ -52,7 +52,7 @@ This is caused by the limitation of multiprocessing under windows OS. Please ref
2. qlib.data.cache.QlibCacheException: It sees the key(...) of the redis lock has existed in your redis db now.
-----------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------

It sees the key of the redis lock has existed in your redis db now. You can use the following command to clear your redis keys and rerun your commands

Expand All @@ -72,7 +72,7 @@ If the issue is not resolved, use ``keys *`` to find if multiple keys exist. If
Also, feel free to post a new issue in our GitHub repository. We always check each issue carefully and try our best to solve them.

3. ModuleNotFoundError: No module named 'qlib.data._libs.rolling'
------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------

.. code-block:: python
Expand Down Expand Up @@ -101,7 +101,7 @@ Also, feel free to post a new issue in our GitHub repository. We always check ea
4. BadNamespaceError: / is not a connected namespace
------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------
.. code-block:: python
Expand All @@ -125,7 +125,7 @@ Also, feel free to post a new issue in our GitHub repository. We always check ea
5. TypeError: send() got an unexpected keyword argument 'binary'
------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------
.. code-block:: python
Expand Down
6 changes: 3 additions & 3 deletions docs/advanced/PIT.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
.. _pit:

===========================
============================
(P)oint-(I)n-(T)ime Database
===========================
============================
.. currentmodule:: qlib


Introduction
------------
Point-in-time data is a very important consideration when performing any sort of historical market analysis.
Point-in-time data is a very important consideration when performing any sort of historical market analysis.

For example, let’s say we are backtesting a trading strategy and we are using the past five years of historical data as our input.
Our model is assumed to trade once a day, at the market close, and we’ll say we are calculating the trading signal for 1 January 2020 in our backtest. At that point, we should only have data for 1 January 2020, 31 December 2019, 30 December 2019 etc.
Expand Down
22 changes: 11 additions & 11 deletions docs/advanced/alpha.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.. _alpha:

===========================
Building Formulaic Alphas
===========================
=========================
Building Formulaic Alphas
=========================
.. currentmodule:: qlib

Introduction
===================
============

In quantitative trading practice, designing novel factors that can explain and predict future asset returns are of vital importance to the profitability of a strategy. Such factors are usually called alpha factors, or alphas in short.

Expand All @@ -15,28 +15,28 @@ A formulaic alpha, as the name suggests, is a kind of alpha that can be presente


Building Formulaic Alphas in ``Qlib``
======================================
=====================================

In ``Qlib``, users can easily build formulaic alphas.

Example
-----------------
-------

`MACD`, short for moving average convergence/divergence, is a formulaic alpha used in technical analysis of stock prices. It is designed to reveal changes in the strength, direction, momentum, and duration of a trend in a stock's price.

`MACD` can be presented as the following formula:

.. math::
.. math::
MACD = 2\times (DIF-DEA)
.. note::

`DIF` means Differential value, which is 12-period EMA minus 26-period EMA.

.. math::
DIF = \frac{EMA(CLOSE, 12) - EMA(CLOSE, 26)}{CLOSE}
DIF = \frac{EMA(CLOSE, 12) - EMA(CLOSE, 26)}{CLOSE}
`DEA`means a 9-period EMA of the DIF.

Expand Down Expand Up @@ -65,7 +65,7 @@ Users can use ``Data Handler`` to build formulaic alphas `MACD` in qlib:
>> print(df)
feature label
MACD LABEL
datetime instrument
datetime instrument
2010-01-04 SH600000 -0.011547 -0.019672
SH600004 0.002745 -0.014721
SH600006 0.010133 0.002911
Expand All @@ -79,7 +79,7 @@ Users can use ``Data Handler`` to build formulaic alphas `MACD` in qlib:
SZ300315 -0.030557 0.012455
Reference
===========
=========

To learn more about ``Data Loader``, please refer to `Data Loader <../component/data.html#data-loader>`_

Expand Down
20 changes: 10 additions & 10 deletions docs/advanced/serial.rst
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
.. _serial:

=================================
=============
Serialization
=================================
=============
.. currentmodule:: qlib

Introduction
===================
``Qlib`` supports dumping the state of ``DataHandler``, ``DataSet``, ``Processor`` and ``Model``, etc. into a disk and reloading them.
============
``Qlib`` supports dumping the state of ``DataHandler``, ``DataSet``, ``Processor`` and ``Model``, etc. into a disk and reloading them.

Serializable Class
========================
==================

``Qlib`` provides a base class ``qlib.utils.serial.Serializable``, whose state can be dumped into or loaded from disk in `pickle` format.
``Qlib`` provides a base class ``qlib.utils.serial.Serializable``, whose state can be dumped into or loaded from disk in `pickle` format.
When users dump the state of a ``Serializable`` instance, the attributes of the instance whose name **does not** start with `_` will be saved on the disk.
However, users can use ``config`` method or override ``default_dump_all`` attribute to prevent this feature.

Users can also override ``pickle_backend`` attribute to choose a pickle backend. The supported value is "pickle" (default and common) and "dill" (dump more things such as function, more information in `here <https://pypi.org/project/dill/>`_).

Example
==========================
``Qlib``'s serializable class includes ``DataHandler``, ``DataSet``, ``Processor`` and ``Model``, etc., which are subclass of ``qlib.utils.serial.Serializable``.
=======
``Qlib``'s serializable class includes ``DataHandler``, ``DataSet``, ``Processor`` and ``Model``, etc., which are subclass of ``qlib.utils.serial.Serializable``.
Specifically, ``qlib.data.dataset.DatasetH`` is one of them. Users can serialize ``DatasetH`` as follows.

.. code-block:: Python
Expand All @@ -33,13 +33,13 @@ Specifically, ``qlib.data.dataset.DatasetH`` is one of them. Users can serialize
dataset = pickle.load(file_dataset)
.. note::
Only state of ``DatasetH`` should be saved on the disk, such as some `mean` and `variance` used for data normalization, etc.
Only state of ``DatasetH`` should be saved on the disk, such as some `mean` and `variance` used for data normalization, etc.

After reloading the ``DatasetH``, users need to reinitialize it. It means that users can reset some states of ``DatasetH`` or ``QlibDataHandler`` such as `instruments`, `start_time`, `end_time` and `segments`, etc., and generate new data according to the states (data is not state and should not be saved on the disk).

A more detailed example is in this `link <https://github.com/microsoft/qlib/tree/main/examples/highfreq>`_.


API
===================
===
Please refer to `Serializable API <../reference/api.html#module-qlib.utils.serial.Serializable>`_.
Loading

0 comments on commit 1dededa

Please sign in to comment.