public void modify ( long orderId , long size ) { Order order = orders . get ( orderId ) ; if ( order == null ) { return ; } OrderBook book = order . getOrderBook ( ) ; long newSize = Math . max ( 0 , size ) ; boolean bbo = book . update ( order . getSide ( ) , order . getPrice ( ) , newSize - order . getRemainingQuantity ( ) ) ; if ( newSize == 0 ) { orders . remove ( orderId ) ; } else { order . setRemainingQuantity ( newSize ) ; } listener . update ( book , bbo ) ; }
Modify an order in an order book . The order will retain its time priority . If the new size is zero the order is deleted from the order book .