Skip to content

Commit 1c102ec

Browse files
committed
update 1min docs
1 parent 1e2e023 commit 1c102ec

File tree

4 files changed

+50
-12
lines changed

4 files changed

+50
-12
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,12 @@ Also, users can install the latest dev version ``Qlib`` by the source code accor
121121
## Data Preparation
122122
Load and prepare data by running the following code:
123123
```bash
124+
# get 1d data
124125
python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn
126+
127+
# get 1min data
128+
python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data_1min --region cn --interval 1min
129+
125130
```
126131
127132
This dataset is created by public data collected by [crawler scripts](scripts/data_collector/), which have been released in

docs/component/data.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,12 @@ Qlib Format Dataset
4848

4949
.. code-block:: bash
5050
51+
# download 1d
5152
python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn
5253
54+
# download 1min
55+
python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/qlib_cn_1min --region cn --interval 1min
56+
5357
In addition to China-Stock data, ``Qlib`` also includes a US-Stock dataset, which can be downloaded with the following command:
5458

5559
.. code-block:: bash

qlib/tests/data.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ def _unzip(file_path: Path, target_dir: Path, delete_old: bool = True):
8686

8787
@staticmethod
8888
def _delete_qlib_data(file_dir: Path):
89-
logger.info(f"delete {file_dir}")
9089
rm_dirs = []
9190
for _name in ["features", "calendars", "instruments", "features_cache", "dataset_cache"]:
9291
_p = file_dir.joinpath(_name)
@@ -133,7 +132,11 @@ def qlib_data(
133132
134133
Examples
135134
---------
135+
# get 1d data
136136
python get_data.py qlib_data --name qlib_data --target_dir ~/.qlib/qlib_data/cn_data --interval 1d --region cn
137+
138+
# get 1min data
139+
python get_data.py qlib_data --name qlib_data --target_dir ~/.qlib/qlib_data/cn_data_1min --interval 1min --region cn
137140
-------
138141
139142
"""

scripts/data_collector/yahoo/README.md

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pip install -r requirements.txt
2121

2222
### CN Data
2323

24-
#### 1d
24+
#### 1d from yahoo
2525

2626
```bash
2727

@@ -33,18 +33,26 @@ python collector.py normalize_data --source_dir ~/.qlib/stock_data/source/cn_1d
3333

3434
# dump data
3535
cd qlib/scripts
36-
python dump_bin.py dump_all --csv_path ~/.qlib/stock_data/source/cn_1d_nor --qlib_dir ~/.qlib/stock_data/source/qlib_cn_1d --freq day --exclude_fields date,adjclose,dividends,splits,symbol
36+
python dump_bin.py dump_all --csv_path ~/.qlib/stock_data/source/cn_1d_nor --qlib_dir ~/.qlib/qlib_data/qlib_cn_1d --freq day --exclude_fields date,adjclose,dividends,splits,symbol
3737

38-
# using
38+
```
39+
40+
### 1d from qlib
41+
```bash
42+
python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/qlib_cn_1d --region cn
43+
```
44+
45+
### using data
46+
47+
```python
3948
import qlib
4049
from qlib.data import D
4150

42-
qlib.init(provider_uri="~/.qlib/stock_data/source/qlib_cn_1d", region="CN")
51+
qlib.init(provider_uri="~/.qlib/qlib_data/qlib_cn_1d", region="CN")
4352
df = D.features(D.instruments("all"), ["$close"], freq="day")
44-
4553
```
4654

47-
#### 1min
55+
#### 1min from yahoo
4856

4957
```bash
5058

@@ -56,20 +64,28 @@ python collector.py normalize_data --source_dir ~/.qlib/stock_data/source/cn_1mi
5664

5765
# dump data
5866
cd qlib/scripts
59-
python dump_bin.py dump_all --csv_path ~/.qlib/stock_data/source/cn_1min_nor --qlib_dir ~/.qlib/stock_data/source/qlib_cn_1min --freq 1min --exclude_fields date,adjclose,dividends,splits,symbol
67+
python dump_bin.py dump_all --csv_path ~/.qlib/stock_data/source/cn_1min_nor --qlib_dir ~/.qlib/qlib_data/qlib_cn_1min --freq 1min --exclude_fields date,adjclose,dividends,splits,symbol
68+
```
6069

61-
# using
70+
### 1min from qlib
71+
```bash
72+
python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/qlib_cn_1min --interval 1min --region cn
73+
```
74+
75+
### using data
76+
77+
```python
6278
import qlib
6379
from qlib.data import D
6480

65-
qlib.init(provider_uri="~/.qlib/stock_data/source/qlib_cn_1min", region="CN")
81+
qlib.init(provider_uri="~/.qlib/qlib_data/qlib_cn_1min", region="CN")
6682
df = D.features(D.instruments("all"), ["$close"], freq="1min")
6783

6884
```
6985

7086
### US Data
7187

72-
#### 1d
88+
#### 1d from yahoo
7389

7490
```bash
7591

@@ -82,12 +98,22 @@ python collector.py normalize_data --source_dir ~/.qlib/stock_data/source/us_1d
8298
# dump data
8399
cd qlib/scripts
84100
python dump_bin.py dump_all --csv_path ~/.qlib/stock_data/source/cn_1d_nor --qlib_dir ~/.qlib/stock_data/source/qlib_us_1d --freq day --exclude_fields date,adjclose,dividends,splits,symbol
101+
```
102+
103+
#### 1d from qlib
104+
105+
```bash
106+
python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/qlib_us_1d --region us
107+
```
108+
109+
### using data
85110

111+
```python
86112
# using
87113
import qlib
88114
from qlib.data import D
89115

90-
qlib.init(provider_uri="~/.qlib/stock_data/source/qlib_us_1d", region="US")
116+
qlib.init(provider_uri="~/.qlib/qlib_data/qlib_us_1d", region="US")
91117
df = D.features(D.instruments("all"), ["$close"], freq="day")
92118

93119
```

0 commit comments

Comments
 (0)