From 6c6b45659be6f4eb4875f7b0ea5637e995cc4813 Mon Sep 17 00:00:00 2001 From: Eddie Hebert Date: Thu, 23 May 2013 11:37:12 -0400 Subject: [PATCH] BUG: Fix bar data contains check when override is used. The override should be used to filter out symbols not in the universe, however it was returning false positives. To remove the false positives, after the contains check passes, ensure that the key exists in the _data member. --- zipline/protocol.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zipline/protocol.py b/zipline/protocol.py index 7c1660fc..818fa55a 100644 --- a/zipline/protocol.py +++ b/zipline/protocol.py @@ -140,7 +140,10 @@ class BarData(object): def __contains__(self, name): if self._contains_override: - return self._contains_override(name) + if self._contains_override(name): + return name in self._data + else: + return False else: return name in self._data