Skip to content

collector.py download_data goes to Chinese data source even though i specified --region US #1974

@AliMoeen

Description

@AliMoeen

❓ Questions and Help

When I run this command:

python scripts/data_collector/yahoo/collector.py download_data
--source_dir ~/.qlib/stock_data/source/us_data_2023
--start 2023-01-01
--end 2024-01-01
--interval 1d
--region US
--symbols MSFT,NVDA,TSLA

I get this error:

2025-07-27 12:03:24.147 | INFO     | collector:get_instrument_list:266 - get US stock symbols......
2025-07-27 12:03:25.655 | WARNING  | data_collector.utils:wrapper:558 - _get_eastmoney: 1 :request error
2025-07-27 12:03:29.903 | WARNING  | data_collector.utils:wrapper:558 - _get_eastmoney: 2 :request error
2025-07-27 12:03:34.117 | WARNING  | data_collector.utils:wrapper:558 - _get_eastmoney: 3 :request error
2025-07-27 12:03:39.877 | WARNING  | data_collector.utils:wrapper:558 - _get_eastmoney: 4 :request error
2025-07-27 12:03:44.943 | WARNING  | data_collector.utils:wrapper:558 - _get_eastmoney: 5 :request error
Traceback (most recent call last):
  File "C:\Projects.Personal\a2algo_qlib\scripts\data_collector\yahoo\collector.py", line 1021, in <module>
    fire.Fire(Run)
  File "C:\Projects.Personal\a2algo_qlib\.venv\Lib\site-packages\fire\core.py", line 135, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Projects.Personal\a2algo_qlib\.venv\Lib\site-packages\fire\core.py", line 468, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
                                ^^^^^^^^^^^^^^^^^^^^
  File "C:\Projects.Personal\a2algo_qlib\.venv\Lib\site-packages\fire\core.py", line 684, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Projects.Personal\a2algo_qlib\scripts\data_collector\yahoo\collector.py", line 802, in download_data
    super(Run, self).download_data(max_collector_count, delay, start, end, check_data_length, limit_nums)
  File "C:\Projects.Personal\a2algo_qlib\scripts\data_collector\base.py", line 402, in download_data
    _class(
  File "C:\Projects.Personal\a2algo_qlib\scripts\data_collector\yahoo\collector.py", line 86, in __init__
    super(YahooCollector, self).__init__(
  File "C:\Projects.Personal\a2algo_qlib\scripts\data_collector\base.py", line 80, in __init__
    self.instrument_list = sorted(set(self.get_instrument_list()))
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Projects.Personal\a2algo_qlib\scripts\data_collector\yahoo\collector.py", line 267, in get_instrument_list
    symbols = get_us_stock_symbols() + [
              ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Projects.Personal\a2algo_qlib\scripts\data_collector\utils.py", line 359, in get_us_stock_symbols
    _all_symbols = _get_eastmoney() + _get_nasdaq() + _get_nyse()
                   ^^^^^^^^^^^^^^^^
  File "C:\Projects.Personal\a2algo_qlib\scripts\data_collector\utils.py", line 554, in wrapper
    _result = func(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Projects.Personal\a2algo_qlib\scripts\data_collector\utils.py", line 316, in _get_eastmoney
    raise ValueError("request error")
ValueError: request error

My LLM suggests there is a bug in the QLib script.

Am I missing any setting?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions