Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions orderbook/orderlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ def append_order(self, order):
def remove_order(self, order):
self.volume -= order.quantity
self.length -= 1
if len(self) == 0: # if there are no more Orders, stop/return
return

# Remove an Order from the OrderList. First grab next / prev order
# from the Order we are removing. Then relink everything. Finally
Expand All @@ -76,6 +74,8 @@ def remove_order(self, order):
elif prev_order != None: # There is no next order
prev_order.next_order = None
self.tail_order = prev_order # The previous order becomes the last order in the OrderList after this Order is removed
else: # No order in the list
self.tail_order = self.head_order = None

def move_to_tail(self, order):
"""After updating the quantity of an existing Order, move it to the tail of the OrderList
Expand Down