Skip to content

Commit 0ff3d6f

Browse files
committed
rich the docs
1 parent 6496bb0 commit 0ff3d6f

File tree

5 files changed

+158
-16
lines changed

5 files changed

+158
-16
lines changed

README.md

Lines changed: 118 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,137 @@
1-
QLibServer is the assorted server system for QLib, which utilizes QLib for basic calculations and provides extensive server system and cache mechanism. With QLibServer, the data provided for QLib can be managed in a centralized manner.
1+
`Qlib-Server` is the assorted server system for `Qlib`, which utilizes `Qlib` for basic calculations and provides extensive server system and cache mechanism. With `Qlib-Server`, the data provided for `Qlib` can be managed in a centralized manner.
22

3+
With `Qlib-Server`, you can use `Qlib` in `Online` mode. The `Online` mode is designed to solve the following problems:
4+
5+
* Manage the data in a centralized way. You don't have to manage data of different versions.
6+
* Reduce the amount of cache to be generated.
7+
* Make the data can be accessed in a remote way.
38

49

510
- [Framework of qlib-erver](#framework-of-qlib-server)
611
- [Quick start](#quick-start)
7-
- [Installation](#installation)
12+
- [Deployment](#deployment)
13+
- [One-click Deployment](#one-click-deployment)
14+
- [Step-by-Step Deployment](#step-by-step-deployment)
815
- [More About Qlib](#more-about-qlib)
16+
- [Contributing](#contributing)
17+
918

19+
# Framework of Qlib-Server
1020

11-
# Framework of qlib-server
21+
<div style="align: center">
22+
<img src="docs/_static/img/framework.png" />
23+
</div>
1224

25+
The `Client/Server` framework of `Qlib` is based on `WebSocket` considering its capability of **bidirectional communication** between client and server in **async** mode.
26+
27+
`Qlib-Server` is based on [Flash](http://flask.pocoo.org/), which is a micro-framework for Python and here [Flask-SocketIO](https://flask-socketio.readthedocs.io) is used for websocket connection.
1328

1429
# Quick start
1530

1631

1732
## Installation
1833

34+
### One-click Deployment
35+
36+
One-click deployment of `Qlib-Server` is supported, you can choose either of the following two methods for one-click deployment:
37+
38+
- Deployment with `docker-compose`
39+
- Deployment in `Azure`
40+
41+
#### One-click Deployment with `docker-compose`
42+
43+
Deploy `Qlib-Server` with `docker-compose` according to the following processes:
44+
45+
* Install `docker`, please refer to [Docker Installation](https://docs.docker.com/engine/install).
46+
* Install `docker-compose`, please refer to [Docker-compose Installation](https://docs.docker.com/compose/install/).
47+
- Run the following command to deploy `Qlib-Server`:
48+
49+
```bash
50+
git clone https://github.com/microsoft/qlib-server
51+
cd qlib-server
52+
sudo docker-compose -f docker_support/docker-compose.yaml --env-file docker_support/docker-compose.env build
53+
sudo docker-compose -f docker_support/docker-compose.yaml --env-file docker_support/docker-compose.env up -d
54+
# Use the following command to track the log
55+
sudo docker-compose -f docker_support/docker-compose.yaml logs -f
56+
```
57+
58+
One-click Deployment in `Azure`
59+
--------------------------------------------
60+
61+
Firstly, You need to have an `Azure` account to deploy `Qlib-Server` in `Azure`. Then you can deploy `Qlib-Server` in `Azure` according to the following processes:
62+
63+
* Install `azure-cli`, please refer to [install-azure-cli](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest).
64+
65+
* Add the `Azure` account to the configuration file `azure_conf.yaml`
66+
67+
```yaml
68+
sub_id: Your Subscription ID
69+
username: azure user name
70+
password: azure password
71+
# The resource group where the VM is located
72+
resource_group: Resource group name
73+
```
74+
* Execute the deployment script
75+
Run the following command:
76+
77+
```bash
78+
79+
git clone https://github.com/microsoft/qlib-server
80+
cd qlib-server/scripts
81+
python azure_manager.py create_qlib_cs_vm \
82+
--qlib_server_name test_server01 \
83+
--qlib_client_names test_client01 \
84+
--admin_username test_user \
85+
--ssh_key_value ~/.ssh/id_rsa.pub \
86+
--size standard_NV6_Promo\
87+
--conf_path azure_conf.yaml
88+
```
89+
90+
To know more about one-click Deployment, please refer to [Qlib-Server One-click Deplyment](https://qlib-server.readthedocs.io/en/latest/build.html#one-click-deployment).
91+
92+
### Step-by-step Deployment
93+
94+
To know more about step-by-step Deployment, please refer to [Qlib-Server Step-by-step Deplyment]https://qlib-server.readthedocs.io/en/latest/build.html#step-by-step-deployment).
95+
96+
97+
## Using `Qlib` in `Online` Mode
98+
99+
In the [Qlib Document](https://qlib.readthedocs.io/en/latest), the `Offline` mode has been introduced.
100+
101+
With `Qlib-Server`, you can use `Qlib` in `Online` mode, please initialize `Qlib` with the following code:
102+
103+
```python
104+
import qlib
105+
ONLINE_CONFIG = {
106+
# data provider config
107+
"calendar_provider": {"class": "LocalCalendarProvider", "kwargs": {"remote": True}},
108+
"instrument_provider": "ClientInstrumentProvider",
109+
"feature_provider": {"class": "LocalFeatureProvider", "kwargs": {"remote": True}},
110+
"expression_provider": "LocalExpressionProvider",
111+
"dataset_provider": "ClientDatasetProvider",
112+
"provider": "ClientProvider",
113+
# config it in user's own code
114+
"provider_uri": "127.0.0.1:/",
115+
# cache
116+
# Using parameter 'remote' to announce the client is using server_cache, and the writing access will be disabled.
117+
"expression_cache": None,
118+
"dataset_cache": None,
119+
"calendar_cache": None,
120+
"mount_path": "/data/stock_data/qlib_data",
121+
"auto_mount": True, # The nfs is already mounted on our server[auto_mount: False].
122+
"flask_server": "127.0.0.1",
123+
"flask_port": 9710,
124+
"region": "cn",
125+
}
126+
127+
qlib.init(**client_config)
128+
ins = D.list_instruments(D.instrumetns("all"), as_list=True)
129+
130+
```
131+
132+
For more details, please refer to [Qlib-Server Client](https://qlib-server.readthedocs.io/en/latest/client.html).
19133

20-
# More About qlib-server
134+
# More About Qlib-Server
21135

22136

23137
# Contributing

docs/build.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.. _build:
22
==============================
3-
``Qlib-Server`` Building
3+
``Qlib-Server`` Deployment
44
==============================
55

66
Introduction
@@ -27,7 +27,7 @@ Deploy ``Qlib-Server`` with docker-compose according to the following processes:
2727

2828
- Install ``docker``, please refer to `Docker Installation <https://docs.docker.com/engine/install>`_.
2929
- Install ``docker-compose``, please refer to `Docker-compose Installation <https://docs.docker.com/compose/install/>`_.
30-
- Run the following command to deploy `Qlib-Server`:
30+
- Run the following command to deploy ``Qlib-Server``:
3131

3232
.. code-block:: bash
3333

docs/client.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Using ``Qlib`` in ``Online`` Mode
55

66
Introduction
77
================
8-
In the `Qlib document <https://qlib.readthedocs.io/en/latest>`_, the ``Offline`` mode has been introduced. In addition to ``offline`` mode, users can use ``Qlib`` in ``Online`` mode.
8+
In the `Qlib Document <https://qlib.readthedocs.io/en/latest>`_, the ``Offline`` mode has been introduced. In addition to ``offline`` mode, users can use ``Qlib`` in ``Online`` mode.
99

1010
The ``Online`` mode is designed to solve the following problems:
1111

docs/index.rst

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,36 @@
55

66
.. _user_guide:
77

8+
Document Structure
89
====================
910

11+
12+
.. toctree::
13+
:hidden:
14+
15+
Home <self>
16+
17+
.. toctree::
18+
:maxdepth: 3
19+
:caption: INTRODUCTION:
20+
21+
Qlib-Server <server.rst>
22+
23+
24+
.. toctree::
25+
:maxdepth: 3
26+
:caption: BUILDING:
27+
28+
Qlib-Server Deployment <build.rst>
29+
30+
.. toctree::
31+
:maxdepth: 3
32+
:caption: USAGE:
33+
34+
Qlib Online Mode <client.rst>
35+
1036
.. toctree::
1137
:maxdepth: 3
38+
:caption: CHANGELOG:
1239

13-
server
14-
build
15-
client
16-
changelog
40+
Changelog <changelog.rst>

docs/server.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
.. _server:
2-
=================================
3-
``Qlib Client/Server`` Framework
4-
=================================
2+
===========================================
3+
``Qlib-Server``: Quant Library Data Server
4+
===========================================
55
.. currentmodule:: qlib_server
66

77
Introduction
88
==================
9+
``Qlib-Server`` is the assorted server system for ``Qlib``, which utilizes ``Qlib`` for basic calculations and provides extensive server system and cache mechanism. With ``Qlib-Server``, the data provided for ``Qlib`` can be managed in a centralized manner.
910

10-
The ``Client/Server`` framework of ``Qlib`` is based on ``WebSocket`` considering its capability of **bidirectional communication** between client and server in **async** mode.
1111

1212
Framework
1313
==================
1414

1515
.. image:: ./_static/img/framework.png
16-
:alt: Framework
16+
:align: center
17+
18+
19+
The ``Client/Server`` framework of ``Qlib`` is based on ``WebSocket`` considering its capability of **bidirectional communication** between client and server in **async** mode.
20+
1721

1822

1923
``Qlib-Server`` is based on `Flash <http://flask.pocoo.org/>`_, which is a micro-framework for Python and here `Flask-SocketIO <https://flask-socketio.readthedocs.io>`_ is used for websocket connection.

0 commit comments

Comments
 (0)