From fd1bee9bf6f739f454b8fcf07b010b655e434b73 Mon Sep 17 00:00:00 2001 From: John Ricklefs Date: Thu, 17 Sep 2015 19:31:47 -0400 Subject: [PATCH] ENH: Don't trigger AssetDateBounds for orders of 0 shares. --- zipline/finance/controls.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zipline/finance/controls.py b/zipline/finance/controls.py index 8986c7be..f34444e0 100644 --- a/zipline/finance/controls.py +++ b/zipline/finance/controls.py @@ -297,6 +297,10 @@ class AssetDateBounds(TradingControl): Fail if the algo has passed this Asset's end_date, or before the Asset's start date. """ + # If the order is for 0 shares, then silently pass through. + if amount == 0: + return + normalized_algo_dt = pd.Timestamp(algo_datetime).normalize() # Fail if the algo is before this Asset's start_date