qlib/scripts
Fivele-Li 47bd13295b
Fix Yahoo daily data format inconsistent (#1517)
* Fix FutureWarning: Passing unit-less datetime64 dtype to .astype is deprecated and will raise in a future version. Pass 'datetime64[ns]' instead

* align index format while end date contains current day data

* fix black

* fix black

* optimize code

* optimize code

* optimize code

* fix ci error

* check ci error

* fix ci error

* check ci error

* check ci error

* check ci error

* check ci error

* check ci error

* check ci error

* fix ci error

* fix ci error

* fix ci error

* fix ci error

* fix ci error

---------

Co-authored-by: Cadenza-Li <362237642@qq.com>
Co-authored-by: Linlang <Lv.Linlang@hotmail.com>
2024-06-21 11:22:23 +08:00
..
data_collector Fix Yahoo daily data format inconsistent (#1517) 2024-06-21 11:22:23 +08:00
README.md Qlib data doc (#1207) 2022-07-22 09:24:58 +08:00
check_dump_bin.py Adjust rolling api (#1594) 2023-07-14 12:16:12 +08:00
collect_info.py fix setup error 2021-01-18 19:37:24 +08:00
dump_bin.py download orderbook data (#1754) 2024-03-07 14:41:21 +08:00
dump_pit.py Update dump_pit.py (#1759) 2024-05-10 14:42:41 +08:00
get_data.py US stock code supports Windows 2021-01-26 16:06:38 +08:00

README.md

Download Qlib Data

Download CN Data

# daily data
python get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn

# 1min  data (Optional for running non-high-frequency strategies)
python get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data_1min --region cn --interval 1min

Download US Data

python get_data.py qlib_data --target_dir ~/.qlib/qlib_data/us_data --region us

Download CN Simple Data

python get_data.py qlib_data --name qlib_data_simple --target_dir ~/.qlib/qlib_data/cn_data --region cn

Help

python get_data.py qlib_data --help

Using in Qlib

For more information: https://qlib.readthedocs.io/en/latest/start/initialization.html

US data

Need to download data first: Download US Data

import qlib
from qlib.config import REG_US
provider_uri = "~/.qlib/qlib_data/us_data"  # target_dir
qlib.init(provider_uri=provider_uri, region=REG_US)

CN data

Need to download data first: Download CN Data

import qlib
from qlib.constant import REG_CN

provider_uri = "~/.qlib/qlib_data/cn_data"  # target_dir
qlib.init(provider_uri=provider_uri, region=REG_CN)

Use Crowd Sourced Data

The is also a crowd sourced version of qlib data: https://github.com/chenditc/investment_data/releases

wget https://github.com/chenditc/investment_data/releases/download/20220720/qlib_bin.tar.gz
tar -zxvf qlib_bin.tar.gz -C ~/.qlib/qlib_data/cn_data --strip-components=2