microsoft / microsoft/qlib

[Bug] SZSE trading calendar fetch failed for years 2000-2004 in data_collector/utils.py

Open
#2,088 2 comments 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

Description:

I encountered a JSONDecodeError when running the data collector script to initialize CN data. After debugging, I found that the _get_calendar_from_month function in qlib/scripts/data_collector/utils.py fails to retrieve trading calendar data from the Shenzhen Stock Exchange (SZSE) API for the years 2000 to 2004.
It seems the SZSE official API no longer returns valid data for these historical dates, while data from 2005 onwards works fine.

To Reproduce:

Run the data collector script that triggers get_calendar_list("ALL").
The script calls _get_calendar_from_month for historical months.
The process crashes when requesting data for months between 2000 and 2004.
Evidence / API Analysis:
I verified the specific API endpoints used by the collector:
❌ Failed Request (Year 2004):
URL: https://www.szse.cn/api/report/exchange/onepersistenthour/monthList?month=2004-01
Result: Returns invalid data (or empty response), causing JSONDecodeError.
✅ Successful Request (Year 2005):
URL: https://www.szse.cn/api/report/exchange/onepersistenthour/monthList?month=2005-01
Result: Returns valid JSON data properly.

Image

log

Image

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 in qlib/scripts/data_collector/utils.py at _get_calendar_from_month and trace how get_calendar_list("ALL") handles the SZSE response. Reproduce the failure with calendar requests for 2000–2004, comparing them with a working 2005 request. Done means the data collector can initialize CN data without a JSONDecodeError for the affected historical months.

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.