Closed JoelJaeschke closed 6 years ago
This may be an issue with my python implementation - likely the rebalancing messes up the tree structure. So this is in fact a problem of HFT-Orderbook
, not your code. The quickest fix would be use the c implementation, since that has been fully tested.
I see, thanks for your time, going to switch to C then :D
I have hooked up the book to a level2 websocket stream from GDAX. Processing the initial snapshot works just as expected, but once I hit live orders, I always get the following error after a varying number of trades:
File "/home/joel/work/python/lob.py", line 144, in process self.add(order) File "/home/joel/work/python/lob.py", line 218, in add self.asks.insert(limit_level) File "/home/joel/work/python/lob.py", line 522, in insert current_node.right_child.balance_grandpa() File "/home/joel/work/python/lob.py", line 394, in balance_grandpa raise NotImplementedError
My orders are in the following format:
('dd57b02494f0d971ba04b81e0eaa8e3d79e2818c1d76a52d5374be357560f310', False, 9252.64, 0.00113473, 1524558443.6000874)
I am hashing the price as a string with sha256 in order to get a uid for the trade. I am running two processes, and the orderbook gets orders from a queue. So far, debugging has not shown any errors on my side, and I just want to make sure I am not missing something.My code can be found here: https://gist.github.com/Huhnmonster/192d1ea6236e0be46be15f3e2dc50a71