From 98f063464ebb0c2f28623bb17c2e0ccb54652d4a Mon Sep 17 00:00:00 2001 From: Eddie Hebert Date: Tue, 9 Oct 2012 12:59:54 -0400 Subject: [PATCH] Adds extra constraint of year to check for day inequality. The .day member of datetime only gives the number of the day of the year, which is insufficient when checking for < than. However in this use, we may just want to check for an 'not equals' --- zipline/finance/slippage.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zipline/finance/slippage.py b/zipline/finance/slippage.py index 161d304c..ae70d484 100644 --- a/zipline/finance/slippage.py +++ b/zipline/finance/slippage.py @@ -83,7 +83,9 @@ class VolumeShareSlippage(object): if(order.dt < event.dt): # orders are only good on the day they are issued - if order.dt.day < event.dt.day: + + if (order.dt.year, order.dt.day) < \ + (event.dt.year, event.dt.day): continue open_amount = order.amount - order.filled