Skip to content

Conversation

@anish-devgit
Copy link

Summary

Fixes #2053: FileFeatureStorage incorrectly lowercases instrument directory names, causing failures on case-sensitive file systems.

What I changed

  • Updated qlib/data/storage/file_storage.py to resolve instrument directories using the correct filesystem case when available.
  • Added a fallback to lowercase paths for backward compatibility.
  • Ensured new file creation preserves the original instrument case.
  • Added tests/storage_tests/test_issue_2053.py to validate behavior on case-sensitive systems.

How I tested

  • Added an isolated test (test_issue_2053.py) that reproduces the issue by creating an uppercase instrument directory.
  • Verified that FileFeatureStorage resolves paths correctly after the fix.
  • Note: Full test suite was not executed locally due to heavy optional dependencies; CI should validate integration.

Before / After

Before
FileFeatureStorage(instrument="AAPL").uri.../aapl/close.day.bin (fails if directory is AAPL)

After
FileFeatureStorage(instrument="AAPL").uri.../AAPL/close.day.bin

Fixes #2053

…age (microsoft#2053)

- Changed FileFeatureStorage.file_name to a property that checks for existing file paths.
- Preserves case sensitivity for new files and existing uppercase directories.
- Maintains backward compatibility for lowercase paths.
- Added verification test case.
@anish-devgit
Copy link
Author

@microsoft-github-policy-service agree

@SunsetWolf
Copy link
Collaborator

Hi @anish-devgit , Thank you so much for taking the time to contribute and for providing a thoughtful solution! We really appreciate your effort.

In this case, Qlib intentionally normalizes instrument names to lowercase to ensure consistent behavior across different platforms, especially Windows. Allowing multiple case variants in FileFeatureStorage would break that consistency and could introduce subtle cross-platform issues.

Thanks again for the contribution and for offering to submit a PR — we really value the discussion and grateful for your understanding.

@anish-devgit
Copy link
Author

Thanks a lot for the detailed explanation and for reviewing my PR 🙏
That makes sense — I understand the design decision around normalizing to lowercase for cross-platform consistency.

Appreciate the guidance and the kind feedback. Happy to contribute again in the future!

@SunsetWolf SunsetWolf closed this Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FileFeatureStorage lowercases the instrument directory name when building feature paths

2 participants