fix(strategy): 消除pandas pct_change弃用警告

- 添加 fill_method=None 参数避免 FutureWarning
- pandas 未来版本将移除默认 fill_method='pad' 行为
This commit is contained in:
2026-05-15 23:38:45 +08:00
parent 80c7fe0ba8
commit 07463f68e1

View File

@@ -417,7 +417,7 @@ class RotationStrategy(StrategyBase):
for idx_code in valid_codes:
etf_code = etf_code_map.get(idx_code, idx_code)
if etf_code in etf_data.columns:
returns_data[f'日收益率_{idx_code}'] = etf_data[etf_code].pct_change()
returns_data[f'日收益率_{idx_code}'] = etf_data[etf_code].pct_change(fill_method=None)
returns_df = pd.DataFrame(returns_data)
else:
# 回退到指数收盘价数据