mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-30 22:18:31 +08:00
MAINT: Use numpy for risk period returns.
Following the lead of the RiskMetricsBatch conversion to use more pandas and numpy. Bringing the iterative and batch versions closer together as we work towards folding them into one.
This commit is contained in:
@@ -591,13 +591,8 @@ algorithm_returns ({algo_count}) in range {start} : {end}"
|
||||
)
|
||||
|
||||
def calculate_period_returns(self, returns):
|
||||
period_returns = 1.0
|
||||
|
||||
for r in returns:
|
||||
period_returns *= (1.0 + r)
|
||||
|
||||
period_returns -= 1.0
|
||||
return period_returns
|
||||
returns = np.array(returns)
|
||||
return (1. + returns).prod() - 1
|
||||
|
||||
def update_current_max(self):
|
||||
if len(self.compounded_log_returns) == 0:
|
||||
|
||||
Reference in New Issue
Block a user