Skip to content

Qlib’s region system parameterized #2054

@maxilirator

Description

@maxilirator

🌟 Feature Description

Make qlib’s region system fully parameterized so users can register and switch to non-us/cn markets (e.g., Nordics) without modifying core code. Region metadata (calendars, instruments, feature folders, filters) should be resolved dynamically from config/initialization parameters.

Motivation

Application scenario: Running qlib on Swedish equities via a custom qlib_ext_se package—today we must patch qlib internals because many components assume only us or cn.
Related works: qlib’s qlib_ext examples show how to add data packs, but they still depend on region-specific switches inside qlib.
Other info: We have local data under /data/xsto with its own calendars/instruments. We can initialize qlib_ext_se, but key subsystems (e.g., config.C["region"], filters, default provider URIs) only recognize the built-in regions, so we end up hacking global constants.

Alternatives

Maintain a fork that overrides region-specific modules, but this diverges from upstream and complicates upgrades. Another approach is to masquerade as us or cn, but that pollutes calendars/instrument sets and defeats the purpose of regional metadata.

Additional Notes

A more flexible region system could expose hooks or registration APIs for external packages: declare region name, calendar file paths, instrument configs, and default providers. That would let communities publish regional data packs that “just work” with qlib.init(region="se", provider_uri=...).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions