microsoft / microsoft/qlib

Error loading us data with yahoo collector.

Open
#1,953 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
48.7k
Forks
7.7k
PR merge metrics
No merged PRs in 30d

Description

🐛 Bug Description

Error loading us data with yahoo collector. It failed at the utils._get_eastmoney() method.

To Reproduce

python collector.py download_data --source_dir ~/.qlib/stock_data/source/us_data --start 2020-01-01 --end 2020-12-31 --delay 1 --interval 1d --region US

Root cause

It tries to use the following URL to fetch the stock catalog for us market http://4.push2delay.eastmoney.com/api/qt/clist/get?pn=1&pz=10000&fs=m:105,m:106,m:107&fields=f12

Though the page size is specified to 10000, it only returns max 100 items now. Then the following code just through request error.

https://github.com/microsoft/qlib/blob/ba8b6cc30f985065b7d5393888bb3f7a8937e861/scripts/data_collector/utils.py#L315C1-L316C46

        if len(_symbols) < 8000:
            raise ValueError("request error")

Environment

Note: User could run cd scripts && python collect_info.py all under project directory to get system information
and paste them here directly.

  • Qlib version: latest master
  • Python version: 3.12
  • OS (Windows, Linux, MacOS): Linux
  • Commit number (optional, please provide it if you are using the dev version):

Additional Notes

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with scripts/data_collector/utils.py at _get_eastmoney(), then run the reported collector.py download_data command for the US region and inspect the catalog response from the linked Eastmoney URL. The work is done when the US data download completes without the request error despite the response containing at most 100 symbols.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-engineering
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.