Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modifyOrder on price throws an error #3

Open
wiwat-tharateeraparb opened this issue Jun 24, 2017 · 0 comments
Open

modifyOrder on price throws an error #3

wiwat-tharateeraparb opened this issue Jun 24, 2017 · 0 comments

Comments

@wiwat-tharateeraparb
Copy link

wiwat-tharateeraparb commented Jun 24, 2017

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
@wiwat-tharateeraparb wiwat-tharateeraparb changed the title modifyOrder modifyOrder on price throws an error Jun 24, 2017
wiwat-tharateeraparb added a commit to wiwat-tharateeraparb/PyLOB that referenced this issue Oct 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant