microsoft / microsoft/qlib

$CHANGE is calculated based on close instead of adj_close in the YahooCollector

Open
#1,563 3 comments 0 reactions 1 assignee View on GitHub

@SunsetWolf is already working on this.

Since Oct 24, 2023.

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

Description

🐛 Bug Description

$CHANGE is calculated based on close instead of adj_close in the YahooCollector

To Reproduce

Steps to reproduce the behavior:

  1. Download the data from Yahoo Finance. Using 301303.SZ as an example only because the dataset is small.
  2. Notice the following data in the downloaded csv (removed unnecessary columns for demonstration purpose)
    Date,Close,Adj Close 2023-06-05,23.120001,22.893938 2023-06-06,22.500000,22.280001 2023-06-07,22.240000,22.240000
  3. Normalize the downloaded csv file using data_collector.yahoo.collector.YahooNormalizeCN1d.
  4. Check the normalized data. The change on 2023-06-06 is -0.026816608996539815 which is correct and the change on 2023-06-07 is -0.011555555555555652 which is wrong.

Expected Behavior

The change on 2023-06-07 should be 22.240000/22.280001 - 1. = -0.0017953769391662044.

Screenshot

Environment

Linux x86_64
Python version: 3.8.16
Qlib version: 0.9.1

Additional Notes

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.