mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-08 08:30:02 +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:
@@ -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