BUG: Fix misalignment of downside series calc when using exact dates.

An oddity that was exposed while working on making the return series
passed to the risk module more exact, the series comparison between
the returns and mean returns was unbalanced, because the mean returns
were not masked down to the downside data points; however, in most,
if not all cases this was papered over by the call to `.valid()`
This commit is contained in:
Eddie Hebert
2014-03-25 15:32:45 -04:00
parent 25659f9672
commit 95b379d567
+1 -1
View File
@@ -107,7 +107,7 @@ def sharpe_ratio(algorithm_volatility, algorithm_return, treasury_return):
def downside_risk(algorithm_returns, mean_returns, normalization_factor):
rets = algorithm_returns
mar = mean_returns
downside_diff = (rets[rets < mar] - mar).valid()
downside_diff = (rets[rets < mar] - mar[rets < mar])
return np.std(downside_diff) * math.sqrt(normalization_factor)