Hi, I've got a sparse array of $ pnls (sparse since the algorithm does not trade every day) and I'm assuming risk-free rate is 0. Is the below an appropriate calculation for the annualized Sharpe ratio? Should I be including days where I wouldn't trade?
By the way, I tried to use pyfolio and it just keeps crashing on every input so recommendations for other libraries that I could use in quantitative analysis would be great.
By the way, I tried to use pyfolio and it just keeps crashing on every input so recommendations for other libraries that I could use in quantitative analysis would be great.
Code:
>>> returns = pnls.cumsum()
>>> r = returns.diff()
>>> sr = r.mean()/r.std()
>>> sr * np.sqrt(252)
5.313046777423097
