BUG: Improve check for orders for zero shares

The check to filter out orders for zero shares wasn't truncated the
number of shares to an integer before checking, so if a fractional
amount less than 1 was being passed in, it wasn't being filtered out
even though it should have been. This is now fixed.
This commit is contained in:
Jonathan Kamens
2013-05-29 12:46:24 -04:00
parent 6c6b45659b
commit 48a7ce5310
+4 -1
View File
@@ -86,6 +86,9 @@ class Blotter(object):
StopLimit order: order(sid, amount, limit_price, stop_price)
"""
# Fractional shares are not supported.
amount = int(amount)
# just validates amount and passes rest on to TransactionSimulator
# Tell the user if they try to buy 0 shares of something.
if amount == 0:
@@ -99,7 +102,7 @@ class Blotter(object):
order = Order(**{
'dt': self.current_dt,
'sid': sid,
'amount': int(amount),
'amount': amount,
'filled': 0,
'stop': stop_price,
'limit': limit_price,