diff --git a/strategies/rotation/engine.py b/strategies/rotation/engine.py index 82144fb..6d21de5 100644 --- a/strategies/rotation/engine.py +++ b/strategies/rotation/engine.py @@ -286,8 +286,10 @@ class RotationStrategy(BacktestStrategy): result["换手率"] = turnover_list result["轮动策略日收益率"] -= result["换手率"] * trade_cost - # 计算净值 + # 计算净值 - 强制起点为1.0 result["轮动策略净值"] = (1 + result["轮动策略日收益率"]).cumprod() + # 归一化:确保净值起点为1.0(消除第一行日收益率包含的前一天收益) + result["轮动策略净值"] = result["轮动策略净值"] / result["轮动策略净值"].iloc[0] # 各ETF单独净值 - 使用第一个有效价格作为基准 for code in self.valid_codes: @@ -317,6 +319,8 @@ class RotationStrategy(BacktestStrategy): result["基准日收益率"] = bench_ret.reindex(result.index, fill_value=0) result["基准净值"] = (1 + result["基准日收益率"]).cumprod() + # 归一化:确保基准净值起点为1.0 + result["基准净值"] = result["基准净值"] / result["基准净值"].iloc[0] self.backtest_result = result