Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong annualization of Sortino Ratio? #61

Closed
gabrieleiacono opened this issue Nov 9, 2017 · 5 comments
Closed

Wrong annualization of Sortino Ratio? #61

gabrieleiacono opened this issue Nov 9, 2017 · 5 comments

Comments

@gabrieleiacono
Copy link

The Sortino Ratio is annualized in stats.py as follows:
return sortino * ann_factor

where ann_factor is
ann_factor = annualization_factor(period, annualization)

I believe you actually meant to return
return sortino * np.sqrt(ann_factor)

just like you did with the Sharpe Ratio.

@twiecki
Copy link
Contributor

twiecki commented Nov 9, 2017

Good catch, want to do a PR?

gabrieleiacono added a commit to gabrieleiacono/empyrical that referenced this issue Nov 10, 2017
@rsheftel
Copy link
Contributor

rsheftel commented Jan 26, 2018

The math is actually correct in the existing version. The confusion is because of where the ann_factor multiplication occurs. The reason it is correct is because the calculation of the downside risk with the downside_risk function returns an annualized value, it does the * np.sqrt() in that function. The calculation of the numerator of returns in the sortino_ratio() function does not annualize:

mu = nanmean(adj_returns, axis=0) so the code annualizes at the end at the return value.
return sortino * ann_factor

Agree this is confusing, so I submitted a pull request that just moves the * ann_factor to the line that calculates the returns so the math is more obvious:

mu = nanmean(adj_returns, axis=0) * ann_factor

@twiecki
Copy link
Contributor

twiecki commented Jan 27, 2018

@rsheftel Thanks, very glad you point this out before we merged it.

@twiecki
Copy link
Contributor

twiecki commented Jan 29, 2018

Closed by #74.

@twiecki twiecki closed this as completed Jan 29, 2018
@gabrieleiacono
Copy link
Author

I'm terribly sorry, thank you @riabaldevia for finding my mistake. It is much better now, after PR #74.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants