microsoft / qlib

Qlib is an AI-oriented quantitative investment platform that aims to realize the potential, empower research, and create value using AI technologies in quantitative investment, from exploring ideas to implementing productions. Qlib supports diverse machine learning modeling paradigms. including supervised learning, market dynamics modeling, and RL.
https://qlib.readthedocs.io/en/latest/
MIT License
14.54k stars 2.53k forks source link

Update index_data.py for datatype conversion and alignment #1813

Closed taozhiwang closed 1 week ago

taozhiwang commented 1 week ago

Description

Hi,

Here I change index_data.py for converting time in datetime64 into the same precision with user data. This helps users avoid query failures due to precision issues.

Datetype detection is performed during initialization to avoid inconsistencies in the format of user data. This may have some impact on efficiency.

Changed files:

  1. index_data.py change __init__ under Index for the initial alignment test, also change _convert_type for detecting data type and convert precision
  2. test_index_data.py test above changes
  3. shrink.py pre-commit auto-correction

Motivation and Context

issue 1806

How Has This Been Tested?

Screenshots of Test Results (if appropriate):

  1. Pipeline test:

    image
  2. Your own tests:

    image

Types of changes

taozhiwang commented 1 week ago

@microsoft-github-policy-service agree

you-n-g commented 1 week ago

Thanks for your great efforts.