From 8a22736f1ef1e1ffff20223539b220dca3774fa4 Mon Sep 17 00:00:00 2001 From: Eddie Hebert Date: Mon, 10 Feb 2014 14:42:49 -0500 Subject: [PATCH] MAINT: Allow sim_params to provide data frequency for the algorithm. In the case that data_frequency of the algorithm is None, allow the sim_params to provide the data_frequency. For less redundancy when setting up an algorithm. --- zipline/algorithm.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zipline/algorithm.py b/zipline/algorithm.py index 829d5f0b..ea44aa78 100644 --- a/zipline/algorithm.py +++ b/zipline/algorithm.py @@ -142,7 +142,11 @@ class TradingAlgorithm(object): self.sim_params = kwargs.pop('sim_params', None) if self.sim_params: - self.sim_params.data_frequency = self.data_frequency + if self.data_frequency is None: + self.data_frequency = self.sim_params.data_frequency + elif self.sim_params.data_frequency is None: + self.sim_params.data_frequency = self.data_frequency + self.perf_tracker = PerformanceTracker(self.sim_params) self.blotter = kwargs.pop('blotter', None)