Handler Events | Table of Content | Logging |
Best Bid-Ask Tracking |
To process only the top of book changes (the best bid and the best offer), user should subscribe to corresponding events and setup tracking options.
Handler has three book types: a regular order book, an implied order book and a consolidated order book. According to this handler have three events:
The top of book changes could be tracked, using three parameters: price, quantity and a number of orders. To setup tracking options, user should use BestBidOfferTrackingOptions property. BestBidOfferTrackingParameters could be aggregated with bitwise OR operator. PriceThreshold, QuantityThreshold and OrdersCountThreshold should be used to specify thresholds for each tracking parameter. All thresholds are given in percentage.
The next example shows how to detect any changes of the top of the books.
handler.RegularOrderBookTopOfTheBookUpdated = new TopOfTheOrderBookUpdatedHandler(topOfTheBookUpdated); handler.ImpliedOrderBookTopOfTheBookUpdated = new TopOfTheOrderBookUpdatedHandler(topOfTheBookUpdated); handler.ConsolidatedOrderBookTopOfTheBookUpdated = new TopOfTheOrderBookUpdatedHandler(topOfTheBookUpdated); handler.BestBidOfferTrackingOptions.PriceThreshold = 0; handler.BestBidOfferTrackingOptions.QuantityThreshold = 0; handler.BestBidOfferTrackingOptions.OrdersCountThreshold = 0; handler.BestBidOfferTrackingOptions.BestBidOfferTrackingParameters = BestBidOfferTrackingParameter.All;
The next example shows how to detect changes, if the best bid or the best ask price are changed more than 10%, or quantity is changed more than 20%.
handler.RegularOrderBookTopOfTheBookUpdated = new TopOfTheOrderBookUpdatedHandler(topOfTheBookUpdated); handler.ImpliedOrderBookTopOfTheBookUpdated = new TopOfTheOrderBookUpdatedHandler(topOfTheBookUpdated); handler.ConsolidatedOrderBookTopOfTheBookUpdated = new TopOfTheOrderBookUpdatedHandler(topOfTheBookUpdated); handler.BestBidOfferTrackingOptions.PriceThreshold = 10; handler.BestBidOfferTrackingOptions.QuantityThreshold = 20; handler.BestBidOfferTrackingOptions.OrdersCountThreshold = 0; handler.BestBidOfferTrackingOptions.BestBidOfferTrackingParameters = BestBidOfferTrackingParameter.Price | BestBidOfferTrackingParameter.Quantity;