From a63d4bca282843864bbc5a6e8968fe41efea1690 Mon Sep 17 00:00:00 2001 From: Thomas Wiecki Date: Thu, 20 Dec 2012 11:58:23 -0500 Subject: [PATCH] ENH: sid and field filter kwargs can also be strings or ints. --- zipline/transforms/utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/zipline/transforms/utils.py b/zipline/transforms/utils.py index 117fe8c8..4e3f72d1 100644 --- a/zipline/transforms/utils.py +++ b/zipline/transforms/utils.py @@ -380,6 +380,12 @@ class BatchTransform(EventWindow): self.clean_nans = clean_nans self.sids = sids + if isinstance(self.sids, (str, int)): + self.sids = [self.sids] + + self.field_names = fields + if isinstance(self.field_names, str): + self.field_names = [self.field_names] self.refresh_period = refresh_period self.window_length = window_length @@ -392,8 +398,6 @@ class BatchTransform(EventWindow): self.updated = False self.cached = None - self.field_names = fields - def handle_data(self, data, *args, **kwargs): """ New method to handle a data frame as sent to the algorithm's