Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to download 1min demo china-stock data in CSV format #434

Closed
arisliang opened this issue May 23, 2021 · 6 comments · Fixed by #441
Closed

How to download 1min demo china-stock data in CSV format #434

arisliang opened this issue May 23, 2021 · 6 comments · Fixed by #441
Assignees
Labels
question Further information is requested

Comments

@arisliang
Copy link
Contributor

❓ Questions and Help

The document gives an example to download demo csv format in 1day freq at (https://qlib.readthedocs.io/en/latest/component/data.html#converting-csv-format-into-qlib-format):

python scripts/get_data.py csv_data_cn --target_dir ~/.qlib/csv_data/cn_data

So it's clear what 1 day freq csv format should look like. Is there similar demo example for 1min freq? So we know what is the correct 1min freq csv format?

@arisliang arisliang added the question Further information is requested label May 23, 2021
@zhupr
Copy link
Collaborator

zhupr commented May 25, 2021

@arisliang Hi,
1min and 1day in similar csv format:

symbol,date,close,low,volume,high,open,adjclose
sz000008,2021-05-20 09:30:00,2.259999990463257,2.25,0.0,2.259999990463257,2.25,
sz000008,2021-05-20 09:31:00,2.259999990463257,2.25,44600.0,2.259999990463257,2.259999990463257,

You can download some of the data to view the 1min format, collection data reference: /~https://github.com/microsoft/qlib/tree/main/scripts/data_collector/yahoo

# --limit_nums: collection of 10 stocks
python scripts/data_collector/yahoo/collector.py download_data --source_dir ~/.qlib/stock_data/source/cn_1min --region CN --start 2021-05-20 --end 2021-05-23 --delay 0.1 --interval 1m
in --limit_nums 10

@you-n-g
Copy link
Collaborator

you-n-g commented May 26, 2021

@arisliang Did @zhupr solve your problem?

Would you mind sending a PR to improve the documents to help other users to find this feature and become one of the contributors of Qlib!
Looking forward to your PR 😄
Thanks.

@arisliang
Copy link
Contributor Author

arisliang commented May 26, 2021

Thanks for providing sample format for 1min. That's helpful.

The above script doesn't seem to download 1min though. It still downloads 1d data, e.g. sz000008.csv:

symbol,date,volume,open,low,high,close,adjclose
sz000008,2021-05-20,11737916,2.259999990463257,2.240000009536743,2.2699999809265137,2.25,2.25
sz000008,2021-05-21,9260808,2.25,2.240000009536743,2.2699999809265137,2.259999990463257,2.259999990463257

And the log:
(qlib) D:\src\lib\qlib\scripts\data_collector\yahoo>python collector.py download_data --source_dir ~/.qlib/stock_data/source/cn_1min --region CN --start 2021-05-20 --end 2021-05-23 --delay 0.1 --interval 1min --limit_nums 10
2021-05-26 18:11:54.603 | INFO | collector:get_instrument_list:194 - get HS stock symbos......
2021-05-26 18:12:10.835 | INFO | collector:get_instrument_list:196 - get 4115 symbols.
2021-05-26 18:12:11.467 | INFO | data_collector.base:collector_data:211 - start collector data......
2021-05-26 18:12:11.470 | INFO | data_collector.base:collector_data:216 - getting data: 1
100%|███████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:12<00:00, 1.22s/it]
[]
2021-05-26 18:12:23.696 | INFO | data_collector.base:_collector:204 - error symbol nums: 0
2021-05-26 18:12:23.700 | INFO | data_collector.base:_collector:205 - current get symbol nums: 10
2021-05-26 18:12:23.703 | INFO | data_collector.base:collector_data:218 - 1 finish.
2021-05-26 18:12:23.705 | INFO | data_collector.base:collector_data:225 - total 10, error: 0
2021-05-26 18:12:23.708 | WARNING | collector:download_index_data:253 - YahooCollectorCN1min 1d does not support: download_index_data

@zhupr zhupr linked a pull request May 26, 2021 that will close this issue
5 tasks
@you-n-g
Copy link
Collaborator

you-n-g commented May 26, 2021

@arisliang Did this PR solve your problem?

@arisliang
Copy link
Contributor Author

Yes, the PR fixes it. Thanks!

@arisliang
Copy link
Contributor Author

@you-n-g created a PR to link to this issue from documentation. #442

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants