Best Bid-Offer Tracking
To process only the top of book changes (the best bid and the best offer), a user should subscribe to corresponding events and setup tracking options.
Handler has four book types: a regular order book, an implied order book, a consolidated order book and a market by order book. According to this handler have four events:
- RegularOrderBookTopOfTheBookUpdated
- ImpliedOrderBookTopOfTheBookUpdated
- ConsolidatedOrderBookTopOfTheBookUpdated
- MarketByOrderBookTopOfTheBookUpdated
Each of those events has the top bid and the top ask price levels.
The top of book changes could be tracked, using three parameters: price, quantity and a number of orders. To set up tracking options, the user should use BestBidOfferTrackingOptions property. BestBidOfferTrackingParameters could be aggregated with the bitwise OR operator. PriceThreshold, QuantityThreshold, and OrdersCountThreshold should be used to specify thresholds for each tracking parameter.
All thresholds are given in percentage.
Examples
The next example shows how to detect any changes in the top of the books.
handler.RegularOrderBookTopOfTheBookUpdated += Handler_RegularOrderBookTopOfTheBookUpdated;
handler.ImpliedOrderBookTopOfTheBookUpdated += Handler_ImpliedOrderBookTopOfTheBookUpdated;
handler.ConsolidatedOrderBookTopOfTheBookUpdated += Handler_ConsolidatedOrderBookTopOfTheBookUpdated;
handler.BestBidOfferTrackingOptions.PriceThreshold = 0;
handler.BestBidOfferTrackingOptions.QuantityThreshold = 0;
handler.BestBidOfferTrackingOptions.OrdersCountThreshold = 0;
handler.BestBidOfferTrackingOptions.BestBidOfferTrackingParameters = BestBidOfferTrackingParameters.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 += Handler_RegularOrderBookTopOfTheBookUpdated;
handler.ImpliedOrderBookTopOfTheBookUpdated += Handler_ImpliedOrderBookTopOfTheBookUpdated;
handler.ConsolidatedOrderBookTopOfTheBookUpdated += Handler_ConsolidatedOrderBookTopOfTheBookUpdated;
handler.BestBidOfferTrackingOptions.PriceThreshold = 10;
handler.BestBidOfferTrackingOptions.QuantityThreshold = 20;
handler.BestBidOfferTrackingOptions.OrdersCountThreshold = 0;
handler.BestBidOfferTrackingOptions.BestBidOfferTrackingParameters = BestBidOfferTrackingParameters.Price | BestBidOfferTrackingParameters.Quantity;