public void cancel ( long orderId , long size ) { Order order = orders . get ( orderId ) ; if ( order == null ) { return ; } long remainingQuantity = order . size ( ) ; if ( size >= remainingQuantity ) { return ; } if ( size > 0 ) { order . resize ( size ) ; } else { delete ( order ) ; orders . remove ( orderId ) ; } cancelListener . onNext ( new CancelOrder ( orderId , remainingQuantity - size , size ) ) ; }
Cancel a quantity of an order in this order book . The size refers to the new order size . If the new order size is set to zero the order is deleted from this order book .