microsoft / microsoft/qlib

因子计算多头收益率时疑似有误

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

Nobody has claimed this yet.

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

Description

如题,qlib.contrib.eva.alpha.py中的calc_long_short_return函数返回了两个结果,分别为(r_long - r_short) / 2和r_avg,看计算过程应该分别是多空收益率和所有股票的等权收益率。

但在qlib.workflow.record_temp.py中SigAnaRecord._generate()在调用calc_long_short_return()函数时将返回结果分别命名为long_short_r和long_avg_r,并在下方输出时直接将long_avg_r作为多头组合收益率。

这会导致最终看到的多头收益率其实是所有样本股等权的平均收益率。

怀疑是自己哪里没理解到位,求答疑。

qlib.workflow.record_temp.py SigAnaRecord._generate()中的片段:
image
qlib.contrib.eva.alpha.py中的calc_long_short_return中的片段:
image

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

Read qlib.contrib.eva.alpha.py, focusing on calc_long_short_return, then compare its two return values with the variable names and output handling in qlib.workflow.record_temp.py's SigAnaRecord._generate(). Confirm which value represents the long-only return and which represents the long-short return; done means the reported metrics and their names match those definitions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
fintech-quant
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.