From faf856a7367f50260103ea4275afbafb9c3c5ad2 Mon Sep 17 00:00:00 2001 From: Eddie Hebert Date: Thu, 26 Feb 2015 13:31:04 -0500 Subject: [PATCH] MAINT: Print benchmark return value to assertion message. For when the attempted midnight fails, print more information about the returns for debugging. --- zipline/finance/performance/tracker.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/zipline/finance/performance/tracker.py b/zipline/finance/performance/tracker.py index 6134246b..b1f5a12e 100644 --- a/zipline/finance/performance/tracker.py +++ b/zipline/finance/performance/tracker.py @@ -319,10 +319,13 @@ class PerformanceTracker(object): midnight = event.dt if midnight not in self.all_benchmark_returns.index: - raise AssertionError(("Date %s not allocated in " - "all_benchmark_returns. Calendar " - "seems to mismatch with benchmark." - % midnight)) + raise AssertionError( + ("Date %s not allocated in all_benchmark_returns. " + "Calendar seems to mismatch with benchmark. " + "Benchmark container is=%s" % + (midnight, + self.all_benchmark_returns.index))) + self.all_benchmark_returns[midnight] = event.returns def check_upcoming_dividends(self, midnight_of_date_that_just_ended):