Filters out orders in the future.

Enforcing filling open orders that exist on or before the current event.
This commit is contained in:
Eddie Hebert
2012-10-10 15:49:07 -04:00
parent c510cab915
commit 69a4e542ea
+6 -1
View File
@@ -70,6 +70,10 @@ class VolumeShareSlippage(object):
if event.sid in open_orders:
orders = open_orders[event.sid]
orders = sorted(orders, key=lambda o: o.dt)
# Only use orders for the current day or before
current_orders = filter(
lambda o: o.dt.toordinal() <= event.dt.toordinal(),
orders)
else:
return None
@@ -78,7 +82,8 @@ class VolumeShareSlippage(object):
simulated_amount = 0
simulated_impact = 0.0
direction = 1.0
for order in orders:
for order in current_orders:
open_amount = order.amount - order.filled