OnixS C++ CME Market Data Handler  2.56.0.0
Customizing Book Changes/Updates Notifications

Tracking the Best Bids and Asks Only

By default, Handler fires Book Changed and Book Updated events each time it receives incremental updates for a particular book from the remote system. In certain cases, there's a necessity to reduce amount of events generated by Handler. In particular, quite often only top of book is point of intersect. For this reason, Handler allows to get notified only about changes and/or updates into the best bids and asks.

To take advantage of such facility use overloads which accept instance of OnixS::CME::MarketData::DirectBestBidAskTrackingOptions structure for direct books (OnixS::CME::MarketData::ImpliedBestBidAskTrackingOptions structure for implied and consolidated books respectively) while registering listeners for a Book Changed and/or Book Updated events.

OnixS::CME::MarketData::DirectBestBidAskTrackingOptions::parameters bit field specifies which of available in best bid/ask attributes (e.g. price or quantity or number of orders or all) should be tracked for changes. Handler will report about changes and/or updates into a book only if specified parameters of best bid/ask were changed.

Other members of OnixS::CME::MarketData::DirectBestBidAskTrackingOptions structure allows to control sensitivity of Handler to the changes and updates.

In particular, OnixS::CME::MarketData::DirectBestBidAskTrackingOptions::priceThreshold member allows to define sensitivity threshold for the best bid/ask price values exposed in percents. If price of the best bid or ask changes for more than specified value (in percents), Handler will raise appropriate event. Otherwise - not.

Similarly, OnixS::CME::MarketData::DirectBestBidAskTrackingOptions::quantityThreshold member controls occasion of Book Changed and/or Book Updated event in case of best bid/ask quantity value change.

Finally, OnixS::CME::MarketData::DirectBestBidAskTrackingOptions::ordersCountThreshold member controls occasion of Book Changed and/or Book Updated event in case of best bid/ask number of orders value change.

Note
Different OnixS::CME::MarketData::DirectBestBidAskTrackingOptions can be specified for event types.

Example

Following example demonstrates how to configure the Handler to get notified only if price of best bid and ask changes for more than 10% or quantity changes for more than 50%.

using namespace OnixS::CME::MarketData;
class MyListener : public DirectBookChangeListener
{
public:
MyListener()
{
}
virtual void onDirectBookChange(const DirectBookChange& change, const ChannelId& channelId)
{
cout << "Best " << (Sell == change.side() ? "offer" : "bid") << "attributes are changed: ";
cout << "price is " << change.price() << ", quantity is " << change.quantity() << "." << endl;
}
};
...
Handler handler(handlerSettings);
bbaTrackingOptions.priceThreshold = Decimal(10, 0);
bbaTrackingOptions.quantityThreshold = Decimal(50, 0);
handler.registerDirectBookChangeListener(&myListener, bbaTrackingOptions);