From da0a5bbc3f4e1206eec2a4d5d74450c0d9b47f47 Mon Sep 17 00:00:00 2001 From: Eddie Hebert Date: Mon, 27 Apr 2015 14:47:27 -0400 Subject: [PATCH] MAINT: Remove dependence on intraday risk for benchmark returns. The intraday_risk_metrics is being removed since the values are not used; cumulative risk metrics with the last value updated to the latest close has been used for some time. Before the removal of intraday_risk_metrics, the position trackers passing of benchmark returns to the cumulative risk metrics needs to no longer depend on the calculations done by the intraday stats. So instead use the all_benchmark_returns stored in the tracker directly. --- zipline/finance/performance/tracker.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/zipline/finance/performance/tracker.py b/zipline/finance/performance/tracker.py index 15ab21a0..a60956e8 100644 --- a/zipline/finance/performance/tracker.py +++ b/zipline/finance/performance/tracker.py @@ -410,8 +410,14 @@ class PerformanceTracker(object): self.all_benchmark_returns[dt], account) - bench_since_open = \ - self.intraday_risk_metrics.benchmark_cumulative_returns[dt] + # Duplicate intraday_risk_metrics work of calculating the benchmark + # returns since open. + # intraday_risk_metrics is marked for removal. + # + # This redundant work is in anticipation of no longer being able to + # depend on the 'since open' calculations in intraday_risk_metrics. + bench_returns = self.all_benchmark_returns.loc[todays_date:dt] + bench_since_open = (1. + bench_returns).prod() - 1 self.cumulative_risk_metrics.update(todays_date, self.todays_performance.returns,