mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-06 05:14:38 +08:00
MAINT: blotter shouldn't allow orders of more than 1e+11 shares
This commit is contained in:
@@ -52,6 +52,7 @@ class Blotter(object):
|
||||
# event.
|
||||
self.new_orders = []
|
||||
self.current_dt = None
|
||||
self.max_shares = int(1e+11)
|
||||
|
||||
def __repr__(self):
|
||||
return """
|
||||
@@ -98,6 +99,11 @@ class Blotter(object):
|
||||
log.debug(zero_message)
|
||||
# Don't bother placing orders for 0 shares.
|
||||
return
|
||||
elif amount > self.max_shares:
|
||||
# Arbitrary limit of 100 billion (US) shares will never be
|
||||
# exceeded except by a buggy algorithm.
|
||||
raise OverflowError('Can\'t order more than %d shares' %
|
||||
self.max_shares)
|
||||
|
||||
order = Order(**{
|
||||
'dt': self.current_dt,
|
||||
|
||||
Reference in New Issue
Block a user