MAINT: Slice into returns containers instead of using .valid()

The slicing syntax is more explicit about declaring:
'get all returns up until the current dt'.

Also, protects against NaNs that occur before the current dt
being silently ignored.
i.e. the *_returns_cont series *should* have values from start
to current dt, but the .valid() call was occluding a bug where
it wasn't.
This commit is contained in:
Eddie Hebert
2013-05-08 11:29:35 -04:00
parent 16c488e5bc
commit ad06acd49d
+2 -2
View File
@@ -615,10 +615,10 @@ class RiskMetricsIterative(RiskMetricsBase):
def update(self, dt, algorithm_returns, benchmark_returns):
self.algorithm_returns_cont[dt] = algorithm_returns
self.algorithm_returns = self.algorithm_returns_cont.valid()
self.algorithm_returns = self.algorithm_returns_cont[:dt]
self.benchmark_returns_cont[dt] = benchmark_returns
self.benchmark_returns = self.benchmark_returns_cont.valid()
self.benchmark_returns = self.benchmark_returns_cont[:dt]
self.num_trading_days = len(self.algorithm_returns)