Skip to content

downside calculation issue in rolling_sortino() #129

@kartiksubbarao

Description

@kartiksubbarao

The calculation of downside in rolling_sortino() 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.

Line of code referenced: 7156af7#r57724791

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions