Correlation between strategy returns and benchmark returns (fwd returns vs returns)

the last cell of the chapter 8 notebook “02_vectorized_backtest.ipynb” calculates the strategy returns correlation with S&P 500 returns:

res = strategy.join(sp500).dropna()
res.corr()

the strategy returns are derived using forward returns:

fwd_returns = daily_returns.shift(-1)

long_returns = long_signals.mul(fwd_returns).mean(axis=1)
short_returns = short_signals.mul(-fwd_returns).mean(axis=1)
strategy = long_returns.add(short_returns).to_frame('Strategy')

however, the S&P 500 returns are same-day returns:

sp500 = web.DataReader('SP500', 'fred', '2014', '2018').pct_change()

shouldn’t we compare strategy forward returns to benchmark forward returns in order to see how correlated the model performance (next day or fwd ret) was to actual return of the benchmark (next day/fwd ret)?

What you are saying sounds right; I’ll take a look while revising for the 3rd ed and update accordingly if necessary.