Skip to content

Commit

Permalink
0.9.58 update
Browse files Browse the repository at this point in the history
  • Loading branch information
zengbin93 committed Aug 29, 2024
1 parent d939417 commit 57c80b4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions czsc/traders/weight_backtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 57c80b4

Please sign in to comment.