fix: 修复回测日期对齐问题,优化收益率计算

- 使用对齐后的index_close数据计算日收益率
- 添加日期对齐逻辑确保信号和收益率数据一致
- 修复pivot重复索引问题,使用pivot_table
- 修复tushare期货接口调用(futures_daily -> fut_daily)

回测结果:
- 最终净值: 0.9435
- 累计收益: -5.65%
- 信号日期: 2302天
This commit is contained in:
2026-05-12 00:12:46 +08:00
parent e56bd39400
commit a7a4a69153
3 changed files with 49 additions and 14 deletions

View File

@@ -104,13 +104,14 @@ class TushareSource:
original_proxy = self._clear_proxy()
try:
import tushare as ts
pro = self._get_pro_api()
df = pro.futures_daily(
# 使用 fut_daily 接口
df = pro.fut_daily(
ts_code=code,
start_date=start_date.replace("-", ""),
end_date=end_date.replace("-", ""),
exchange=''
end_date=end_date.replace("-", "")
)
if df is None or len(df) == 0: