microsoft / microsoft/qlib

ValueError: freq format is not supported when using D.calendar with freq='day'

Open
#2,028 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

❓ Questions and Help

Hi, I am encountering an error when trying to build a stock pool using the released CN data (investment_data releases).

from pathlib import Path
from qlib.config import REG_CN
import qlib
from qlib.data import D

ROOT_DIR = Path(__file__).resolve().parents[1]
PROVIDER_URI = str(ROOT_DIR / "qlib_bin")
print(f"Using qlib data dir: {PROVIDER_URI}")

qlib.init(
    provider_uri=PROVIDER_URI,
    region=REG_CN,
)
start_date = "2012-01-01"
end_date = "2024-12-31"

trade_calendar = D.calendar(start_time=start_date, end_time=end_date, freq="day")

stock_instruments = D.instruments("all")
stock_list = D.list_instruments(
    instruments=stock_instruments, start_time=start_date, end_time=end_date
)

Error Message

ValueError: freq format is not supported, the freq should be like (n)month/mon, (n)week/w, (n)day/d, (n)minute/min

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 the qlib.data D.calendar entry point and reproduce the provided example using the released CN data, focusing on the freq="day" argument. Trace where the frequency format is validated and compare it with the formats accepted by the calendar API. Done means the reported calendar call has defined, tested behavior for the supplied input.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
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.