By default, Handler processes market data for all securities available in a particular market data channel. For certain channels, it may be a huge amount of data which may cause the Handler to allocate significant amount of system resources (like a memory). From other side, it often happens that not all securities are the point of interest. For these reasons, Handler provides an ability to define a subset of securities for which Handler will monitor market data, maintain books and report about changes in statistics. No events will be fired by the Handler for any security not present in the defined subset. This feature is called securities filtering.
Operating over securities filter is similar to the process of filling bag with apples. OnixS::CME::MarketData::Handler::addSecurityIdFilter member must be used to put a security into the collection of securities for which the Handler must process market data. There's no limits on quantity of securities which can be included into filtering. Client code may put from single up to all securities available in the single market data channel.
If at least one security is added to the filter, Handler stops raising events for all securities available in the market data channel. Since that moment Handler will fire events only for securities included into filtering.
To remove security from the filter, it's necessary to call OnixS::CME::MarketData::Handler::removeSecurityIdFilter member. Handler will continue processing market data and raising events only for the securities which remain in the filter.
If collection of securities in the filter becomes empty, Handler starts processing market data and event notifying for all securities in the market data channel.
To ensure no securities are available in the securities filter, use OnixS::CME::MarketData::Handler::removeAllSecurityIdFilters member. It will clear the filter.
In addition to filtering market data based on security identifiers, the Handler provides ability to filter market data using security symbol and group attributes.
Handler's interface includes addSecurity<FilterType>Filter
, removeSecurity<FilterType>Filter
and removeAllSecurity<FilterType>Filters
set of members (where FilterType is either Symbol or Group) to filter market data using security symbol (value of OnixS::CME::MarketData::SecurityDefinition::securitySymbol field) and/or group (value of OnixS::CME::MarketData::SecurityDefinition::securityGroup field) attributes.
Following code demonstrates how to instruct the Handler to process data only for two particular securities: