dyn4mik3 / OrderBook

Matching Engine for Limit Order Book
Other
361 stars 116 forks source link

move_to_tail bug #16

Closed ChuaCheowHuan closed 4 years ago

ChuaCheowHuan commented 4 years ago

Hi, there is a non termination bug while traversing an orderlist (printing the orderbook) after modifying an order with a larger quantity. A minimum reproducible example is available in this gist.

The output from running the minimum reproducible example, a manual control C (keyboard interupt) has to be executed to terminate the program:

***Bids***
10@1/0 - 1
20@1/1 - 2
30@1/2 - 3

***Asks***

***Trades***

^CTraceback (most recent call last):
  File "test_modify_orders.py", line 39, in <module>
    print(order_book)
  File "/Users/hadron0/gitHubRepo/OrderBook/orderbook/orderbook.py", line 222, in __str__
    tempfile.write('%s' % value)
  File "/Users/hadron0/gitHubRepo/OrderBook/orderbook/orderlist.py", line 102, in __str__
    temp_file.write("%s\n" % str(order))
  File "/Users/hadron0/gitHubRepo/OrderBook/orderbook/order.py", line 39, in __str__
    self.trade_id, self.timestamp)
KeyboardInterrupt
ChuaCheowHuan commented 4 years ago

Resolved with merged PR #17.