microsoft / microsoft/qlib

About the setting of trunc_days

Open
#1,755 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

In the document, the function of the parameter trunc_days is to avoid future information leakage:
"The trading days to be truncated the data in this segment may need ‘days’ data days are based on the test_start. For example, if the label contains the information of 2 days in the near future, the prediction horizon 1 day. (e.g. the prediction target is Ref($close, -2)/Ref($close, -1) - 1) the days should be 2 + 1 == 3 days."
I know what it means, but I still confused about why such process is necessary? If we don't truncate the days, when the segment is {"train": 2008/1/3-2008/1/29, "test":2008/1/30-2008/3/4}, why the information leakage happens?

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 with the documentation that defines trunc_days and the train/test segment example, then trace how future-looking labels overlap the segment boundary. Clarify why the 2008/1/30 test start requires truncation and update the explanation so the leakage scenario and the expected day count are unambiguous.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation, fintech-quant
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.