Orderbook logic/parsing code