mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-30 19:23:51 +08:00
BUG: Ensure compounded_log_returns set on first dt.
This commit is contained in:
@@ -110,3 +110,9 @@ class TestRisk(unittest.TestCase):
|
||||
value,
|
||||
decimal=2,
|
||||
err_msg="Mismatch at %s" % (dt,))
|
||||
|
||||
def test_max_drawdown_calculated(self):
|
||||
# We don't track max_drawdown by day, so it doesn't make sense to
|
||||
# generate a full answer key for it. For now, ensure it's just
|
||||
# "not zero"
|
||||
self.assertNotEqual(self.cumulative_metrics_06.max_drawdown, 0.0)
|
||||
|
||||
@@ -406,7 +406,7 @@ algorithm_returns ({algo_count}) in range {start} : {end} on {dt}"
|
||||
compound = 0.0
|
||||
# BUG? Shouldn't this be set to log(1.0 + 0) ?
|
||||
|
||||
if len(self.compounded_log_returns[:self.latest_dt]) == 0:
|
||||
if np.isnan(self.compounded_log_returns[self.latest_dt]):
|
||||
self.compounded_log_returns[self.latest_dt] = compound
|
||||
else:
|
||||
self.compounded_log_returns[self.latest_dt] = \
|
||||
|
||||
Reference in New Issue
Block a user