microsoft / microsoft/qlib

账户初始资金cash及最小成本min_cost面值与购买力存在差异

Open
#2,002 2 comments 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提供的雅虎财经数据,是经过首日收盘价缩放(股票上市第一天收盘价调整为1)的后复权数据。
在回测过程中,使用后复权价进行买卖,会导致账户初始资金cash及最小成本min_cost面值与购买力不一致的问题。

举例:
假设账户初始资金cash = 100000, 股票stock_1的真实收盘价为10,复权之后为100。
如果按照真实收盘价,可以购买10000股,而按照复权价只能购买到1000股。虽然在回测交易过程中,现金和股价都是用后复权价格进行交易,不会存在这个问题,但是账户初始现金没有经过复权因子处理,其面值和购买力显然存在偏差。

另外,最小交易成本min_cost是一个固定值,也会存在类似问题。如代码 trade_cost = max(trade_val * cost_ratio, self.min_cost)

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 by tracing how Yahoo Finance back-adjusted prices affect account initialization, especially cash and min_cost, then inspect the trade_cost calculation shown in the issue. Compare purchasing power under real and adjusted prices; done means initial cash and the minimum trading cost are consistent with the adjusted-price scale during backtests.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.