mirror of
https://github.com/wassname/catalyst.git
synced 2026-08-07 11:20:19 +08:00
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:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user