mirror of
https://github.com/wassname/catalyst.git
synced 2026-10-29 13:00:42 +08:00
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:
1 parent
25659f9672
commit
95b379d567
1 file changed
+1
-1
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user