mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-07 00:34:45 +08:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user