From 8621eb222324d30896576c7c69992431a9cc3508 Mon Sep 17 00:00:00 2001 From: Thomas Wiecki Date: Tue, 11 Dec 2012 12:12:32 -0500 Subject: [PATCH] Revert "STY: Removed drop_condition arguments." This reverts commit c7383f6275b3b145fadecd261c28e9344a8e4508. --- zipline/transforms/utils.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/zipline/transforms/utils.py b/zipline/transforms/utils.py index a5d47803..ea8b7612 100644 --- a/zipline/transforms/utils.py +++ b/zipline/transforms/utils.py @@ -241,7 +241,12 @@ class EventWindow(object): # Clear out any expired events. drop_condition changes depending # on whether or not we are running in market_aware mode. - while self.drop_condition(): + # + # oldest newest + # | | + # V V + while self.drop_condition(self.ticks[0].dt, self.ticks[-1].dt): + # popleft removes and returns the oldest tick in self.ticks popped = self.ticks.popleft() @@ -249,7 +254,7 @@ class EventWindow(object): # behavior for removing ticks. self.handle_remove(popped) - def out_of_market_window(self): + def out_of_market_window(self, oldest, newest): # Find number of unique days in window # Note that this assumes that each day we received an # event is a trading day. @@ -257,9 +262,8 @@ class EventWindow(object): return len(unique_dts) > self.window_length - def out_of_delta(self): - # newest - oldest - return (self.ticks[-1].dt - self.ticks[0].dt) >= self.delta + def out_of_delta(self, oldest, newest): + return (newest - oldest) >= self.delta # All event windows expect to receive events with datetime fields # that arrive in sorted order.