Incorrect Sortino ratio and downside deviation
We are calculating the sortino ratio and downside deviation incorrectly.
The sortino ratio uses the downside deviation, which is where the problems are.
Problem 1: Using the average algo return as the downside cutoff threshold. The downside threshold has to be the same for all algos or the results can't be compared in a meaningful way.
Consider these two return streams A. [-0.5, -0.5, -1, -1, -1], mean return = -0.8 B. [1, 2, 3, -0.5, -1], mean return = 0.9
In this case, A would have 0.8 added to all the values and B would have 0.9 subtracted from all of them. In fact, as the downside risk is calculated now, subtracting the mean makes A's downside deviation zero.
Problem 2: Both the frequency and magnitude of downside variance need to be considered, but we throw away the positive returns and calculate the standard deviation of the remaining values. This doesn't capture the frequency portion, the values should be replaced with zeros.
Also, a regular standard deviation is not used for the target downside deviation in the denominator. The magnitude of the downside deviation is significant so we don't want to demean downside deviations, which stdev does.
In the example above, even with a standardized downside cutoff, B would get a higher downside risk value than A, even though B clearly has less downside risk.
This paper by Red Rock Capital discusses the issue (I believe they actually came up with the sortino ratio) http://www.redrockcapital.com/Sortino__A__Sharper__Ratio_Red_Rock_Capital.pdf
@humdings Can we apply the same fix as pyfolio here?
A better way would probably be to start using pyfolio for these calculations.