microsoft / microsoft/qlib

AttributeError: 'int' object has no attribute 'lower'

Open
#1,256 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

if instrument without string prefix,python treat as int,and code below throw errorAttributeError: 'int' object has no attribute 'lower' :

# file_storage.py", line 280
self.file_name = f"{instrument.lower()}/{field.lower()}.{freq.lower()}.bin"

qlib getData prefix string:
SH600010
but my custom data:
600010

so qlib instrument need a string preifx,or it is a bug?

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 at file_storage.py around line 280 and reproduce the error with the unprefixed instrument value 600010, comparing it with the documented-style value SH600010. Trace how instrument values reach the filename construction and determine the expected behavior for numeric or unprefixed instruments. Done means the chosen behavior is implemented and verified with a regression test, if the repository has a relevant test location.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.