Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added rolling_sharpe, rolling sortino, and rolling_volatility
- Loading branch information
1 parent
3dda309
commit 7156af7
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is incorrect because it calculates the downside for the entire series of returns, not just for the rolling period. A correct calculation would be something like this:
downside = returns.rolling(rolling_period).apply(lambda x: (x[x < 0]**2).sum())/rolling_period
This will be slower than other approaches, but I wanted to provide a simple example to illustrate the issue.