diff --git a/czsc/traders/weight_backtest.py b/czsc/traders/weight_backtest.py index 677a1724b..040a92ebf 100644 --- a/czsc/traders/weight_backtest.py +++ b/czsc/traders/weight_backtest.py @@ -567,6 +567,12 @@ def backtest(self, n_jobs=1): short_rate = dfw[dfw["weight"] < 0].shape[0] / dfw.shape[0] stats.update({"多头占比": round(long_rate, 4), "空头占比": round(short_rate, 4)}) + alpha = self.alpha.copy() + stats["与基准相关性"] = round(alpha["策略"].corr(alpha["基准"]), 4) + alpha_short = alpha[alpha["基准"] < 0].copy() + stats['与基准空头相关性'] = round(alpha_short["策略"].corr(alpha_short["基准"]), 4) + stats['品种数量'] = len(symbols) + res["绩效评价"] = stats return res