Cell 10 in notebook "mean reverstion code" has this code
#pnl on a unit capital is really just the daily returns
df['prices_difference']= df.prices - df.prices.shift(1)
df['daily_returns'] = df.prices_difference /df.prices.shift(1)
df['pnl'] = df.positions.shift(1) * df.daily_returns
df['cumpnl'] = df.pnl.cumsum()
This is wrong ...arithmetic returns are not addictive, log returns are.. df['cumpnl'] = df.pnl.cumsum() should be df['cumpnl'] = (1+df['pnl']).cumprod()