@@ -18,29 +18,87 @@ pip install -r requirements.txt
1818
1919## Collector Data
2020
21- ### Download data and Normalize data
21+
22+ ### CN Data
23+
24+ #### 1d
25+
2226``` bash
23- python collector.py collector_data --source_dir ~ /.qlib/stock_data/source --region CN --start 2020-11-01 --end 2020-11-10 --delay 0.1 --interval 1d --normalize_dir ~ /.qlib/stock_data/normalize
27+
28+ # download from yahoo finance
29+ python collector.py download_data --source_dir ~ /.qlib/stock_data/source/cn_1d --region CN --start 2020-11-01 --end 2020-11-10 --delay 0.1 --interval 1d
30+
31+ # normalize
32+ python collector.py normalize_data --source_dir ~ /.qlib/stock_data/source/cn_1d --normalize_dir ~ /.qlib/stock_data/source/cn_1d_nor --region CN --interval 1d
33+
34+ # dump data
35+ 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
37+
38+ # using
39+ import qlib
40+ from qlib.data import D
41+
42+ qlib.init(provider_uri=" ~/.qlib/stock_data/source/qlib_cn_1d" , region=" CN" )
43+ df = D.features(D.instruments(" all" ), [" $close " ], freq=" day" )
44+
2445```
2546
26- ### Download Data
47+ #### 1min
2748
2849``` bash
29- python collector.py download_data --source_dir ~ /.qlib/stock_data/source --region CN --start 2020-11-01 --end 2020-11-10 --delay 0.1 --interval 1d
50+
51+ # download from yahoo finance
52+ python collector.py download_data --source_dir ~ /.qlib/stock_data/source/cn_1min --region CN --start 2020-11-01 --end 2020-11-10 --delay 0.1 --interval 1min
53+
54+ # normalize
55+ python collector.py normalize_data --source_dir ~ /.qlib/stock_data/source/cn_1min --normalize_dir ~ /.qlib/stock_data/source/cn_1min_nor --region CN --interval 1min
56+
57+ # dump data
58+ 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
60+
61+ # using
62+ import qlib
63+ from qlib.data import D
64+
65+ qlib.init(provider_uri=" ~/.qlib/stock_data/source/qlib_cn_1min" , region=" CN" )
66+ df = D.features(D.instruments(" all" ), [" $close " ], freq=" 1min" )
67+
3068```
3169
32- ### Normalize Data
70+ ### US Data
71+
72+ #### 1d
3373
3474``` bash
35- python collector.py normalize_data --source_dir ~ /.qlib/stock_data/source --normalize_dir ~ /.qlib/stock_data/normalize --region CN
75+
76+ # download from yahoo finance
77+ python collector.py download_data --source_dir ~ /.qlib/stock_data/source/us_1d --region US --start 2020-11-01 --end 2020-11-10 --delay 0.1 --interval 1d
78+
79+ # normalize
80+ python collector.py normalize_data --source_dir ~ /.qlib/stock_data/source/us_1d --normalize_dir ~ /.qlib/stock_data/source/us_1d_nor --region US --interval 1d
81+
82+ # dump data
83+ cd qlib/scripts
84+ 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
85+
86+ # using
87+ import qlib
88+ from qlib.data import D
89+
90+ qlib.init(provider_uri=" ~/.qlib/stock_data/source/qlib_us_1d" , region=" US" )
91+ df = D.features(D.instruments(" all" ), [" $close " ], freq=" day" )
92+
3693```
3794
95+
3896### Help
3997``` bash
4098pythono collector.py collector_data --help
4199```
42100
43101## Parameters
44102
45- - interval: 1m or 1d
103+ - interval: 1min or 1d
46104- region: CN or US
0 commit comments