Skip to content

modifyOrder on price throws an error #3

@wiwat-tharateeraparb

Description

@wiwat-tharateeraparb

The modifyOrder() seems to have a bug when modifying price. Replicate with below commands:

from PyLOB import OrderBook
lob = OrderBook()
trades, orderInBook = lob.processOrder({'type':'limit','side':'bid','qty':100,'price':150,'tid':1},False,False)
print lob
lob.modifyOrder(1,{'side':'bid','qty':120,'price':150,'tid':1})
print lob
lob.modifyOrder(1,{'side':'bid','qty':120,'price':149,'tid':1})

Result:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "PyLOB/orderbook.py", line 211, in modifyOrder
    self.bids.updateOrder(orderUpdate)
  File "PyLOB/ordertree.py", line 66, in updateOrder
    self.insertOrder(orderUpdate)
  File "PyLOB/ordertree.py", line 48, in insertOrder
    self.removeOrderById(quote['idNum'])
  File "PyLOB/ordertree.py", line 76, in removeOrderById
    order.orderList.removeOrder(order)
  File "PyLOB/orderlist.py", line 50, in removeOrder
    if len(self) == 0:
ValueError: __len__() should return >= 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions