Hi javadhemati,

1) In our demo the orders are grouped by price levels. So deleting a precise single order implies check its price, we assume is X, and act on that level of the order book. This could result in:
- a "DELETE" command for the key X (the "qty" field is not present) if the order was the only one present at that price level
- otherwise an "UPDATE" command for the key X with "qty" field appropriately reduced by the amount of the order;
But please consider that you might want to organize your book not grouped by price levels but list every single order explicitly.
In this case the key field for the COMMAND mode is not the price but will be an "order id " unique assigned to each order. The deletion of a precise order now is simply a "DELETE" command with the key field containing the id of the order.

2) In this case are valid all the considerations made in the previous point. But consider that in order to clear all levels for better prices, the Adapter implementation needs to keep an ordered data structure, and generate an update of type "DELETE" for every order to be deleted.

3) An operation of this type is shown in the demo, and can be easily achieved with Lightstreamer. Please check out the endOfDay method of DataAdapter; in this case we simulate the end of a trading day and we want to delete all existing orders.


The trick is carried out by a call to smartClearSnapshot method of ItemEventListener interface. Our demo is organized with two Items for each stock, one for each side of the book and so are just need two calls of smartClearSnapshot.

Please let me know if you need any further clarifications.

Regards,
Giuseppe