You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 <[email protected]>
Copy file name to clipboardExpand all lines: docs/advanced/PIT.rst
+3-3
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
1
.. _pit:
2
2
3
-
===========================
3
+
============================
4
4
(P)oint-(I)n-(T)ime Database
5
-
===========================
5
+
============================
6
6
.. currentmodule:: qlib
7
7
8
8
9
9
Introduction
10
10
------------
11
-
Point-in-time data is a very important consideration when performing any sort of historical market analysis.
11
+
Point-in-time data is a very important consideration when performing any sort of historical market analysis.
12
12
13
13
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.
14
14
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.
Copy file name to clipboardExpand all lines: docs/advanced/alpha.rst
+11-11
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
1
.. _alpha:
2
2
3
-
===========================
4
-
Building Formulaic Alphas
5
-
===========================
3
+
=========================
4
+
Building Formulaic Alphas
5
+
=========================
6
6
.. currentmodule:: qlib
7
7
8
8
Introduction
9
-
===================
9
+
============
10
10
11
11
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.
12
12
@@ -15,28 +15,28 @@ A formulaic alpha, as the name suggests, is a kind of alpha that can be presente
15
15
16
16
17
17
Building Formulaic Alphas in ``Qlib``
18
-
======================================
18
+
=====================================
19
19
20
20
In ``Qlib``, users can easily build formulaic alphas.
21
21
22
22
Example
23
-
-----------------
23
+
-------
24
24
25
25
`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.
26
26
27
27
`MACD` can be presented as the following formula:
28
28
29
-
.. math::
29
+
.. math::
30
30
31
31
MACD = 2\times (DIF-DEA)
32
32
33
33
.. note::
34
34
35
35
`DIF` means Differential value, which is 12-period EMA minus 26-period EMA.
``Qlib`` supports dumping the state of ``DataHandler``, ``DataSet``, ``Processor`` and ``Model``, etc. into a disk and reloading them.
9
+
============
10
+
``Qlib`` supports dumping the state of ``DataHandler``, ``DataSet``, ``Processor`` and ``Model``, etc. into a disk and reloading them.
11
11
12
12
Serializable Class
13
-
========================
13
+
==================
14
14
15
-
``Qlib`` provides a base class ``qlib.utils.serial.Serializable``, whose state can be dumped into or loaded from disk in `pickle` format.
15
+
``Qlib`` provides a base class ``qlib.utils.serial.Serializable``, whose state can be dumped into or loaded from disk in `pickle` format.
16
16
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.
17
17
However, users can use ``config`` method or override ``default_dump_all`` attribute to prevent this feature.
18
18
19
19
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/>`_).
20
20
21
21
Example
22
-
==========================
23
-
``Qlib``'s serializable class includes ``DataHandler``, ``DataSet``, ``Processor`` and ``Model``, etc., which are subclass of ``qlib.utils.serial.Serializable``.
22
+
=======
23
+
``Qlib``'s serializable class includes ``DataHandler``, ``DataSet``, ``Processor`` and ``Model``, etc., which are subclass of ``qlib.utils.serial.Serializable``.
24
24
Specifically, ``qlib.data.dataset.DatasetH`` is one of them. Users can serialize ``DatasetH`` as follows.
25
25
26
26
.. code-block:: Python
@@ -33,13 +33,13 @@ Specifically, ``qlib.data.dataset.DatasetH`` is one of them. Users can serialize
33
33
dataset = pickle.load(file_dataset)
34
34
35
35
.. note::
36
-
Only state of ``DatasetH`` should be saved on the disk, such as some `mean` and `variance` used for data normalization, etc.
36
+
Only state of ``DatasetH`` should be saved on the disk, such as some `mean` and `variance` used for data normalization, etc.
37
37
38
38
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).
39
39
40
40
A more detailed example is in this `link <https://github.com/microsoft/qlib/tree/main/examples/highfreq>`_.
41
41
42
42
43
43
API
44
-
===================
44
+
===
45
45
Please refer to `Serializable API <../reference/api.html#module-qlib.utils.serial.Serializable>`_.
0 commit comments