From 97e4e5e94dfb74959d620022232457a3d19cf42f Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Mon, 29 Sep 2014 10:51:27 -0400 Subject: [PATCH] MAINT: In _create_generator only overwrite perf_tracker when it's None. --- zipline/algorithm.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/zipline/algorithm.py b/zipline/algorithm.py index 0e2e67f5..125af57f 100644 --- a/zipline/algorithm.py +++ b/zipline/algorithm.py @@ -330,8 +330,11 @@ class TradingAlgorithm(object): processed by the zipline, and False for those that should be skipped. """ - # Instantiate perf_tracker - self.perf_tracker = PerformanceTracker(sim_params) + if self.perf_tracker is None: + # HACK: When running with the `run` method, we set perf_tracker to + # None so that it will be overwritten here. + self.perf_tracker = PerformanceTracker(sim_params) + self.portfolio_needs_update = True self.data_gen = self._create_data_generator(source_filter, sim_params)