OnixS ICE iMpact Multicast Price Feed Handler C++ library 8.18.0
Users' manual and API documentation
Loading...
Searching...
No Matches
Selecting Securities Of Interest

Defining Securities of Interest

By default, the Handler processes market data for all securities available in a particular MarketSubscription. For certain subscriptions, the data may be large enough to cause the Handler to allocate significant system resources (e.g., memory). On the other hand, it often happens that not all securities are of interest. For these reasons, the Handler provides an ability to define a subset of securities for which the Handler will monitor market data, maintain books and report on other market-related events. No events will be fired by the Handler for any security not present in the defined subset. This feature is called selecting securities or security filtering.

There are two ways (which can be combined) to create and modify a security filter:

  1. The MarketSubscription::marketIds container can be used to collect securities for which the Handler should process market data. There are no limits on the quantity of securities which can be included in the selection. This way, securities can be filtered by market ID only.
  2. Special parameter isInterested of the ExchangeListener::onFuturesProductDefinition, ExchangeListener::onFuturesStrategyDefinition, ExchangeListener::onNewFuturesStrategyDefinition, ExchangeListener::onOptionsProductDefinition, ExchangeListener::onNewOptionsMarketDefinition, ExchangeListener::onOptionsStrategyDefinition, ExchangeListener::onNewOptionsStrategyDefinition, ExchangeListener::onNewExpiry callbacks can be used to add security to the security filter. This way, securities can be filtered by any attributes.

If at least one security is added to the filter, the Handler stops raising events for all securities available in the market data channel. Since that moment, the Handler fires events only for securities included in the filter. An empty (blank) security selection causes the Handler to process market data and trigger events for all securities in the market data feed.

Note
Selecting securities affects ExchangeListener, OrderBookChangeListener, OrderBookUpdateListener and OrderBookBundleUpdateListener listeners only. Handler does not invoke listener members for securities out of the selection scope. Other listeners are not affected by this feature.
Attention
Filtering can be manipulated only when the Handler is not processing market data or when the state is HandlerStates::SecurityDefinitionsRecoveryFinished. Once the Handler begins market data processing or exits the noted state scope, security selection does not affect the security filter.

Example

The following code demonstrates how to instruct the Handler to process data only for preselected securities:

// Initialize the Handler settings.
HandlerSettings handlerSettings;
handlerSettings.connectivityConfiguration =
"ConnectivityConfiguration.AP1.xml";
// Set up a market subscription for Brent Futures.
MarketSubscription brentFutures(
// Market type ID for IPE Brent Futures.
// Use non-implied prices.
// Defines type of securities (Futures/OTC, Options or UDS Markets).
// Build and maintain the top five price levels books.
// Set up the desired market IDs.
MarketId someMarketId = 318412;
brentFutures.marketIds.insert(someMarketId);
// Initialize the subscriptions collection.
MarketSubscriptions subscriptions;
subscriptions.insert(brentFutures);
// Start the Handler with the specified subscriptions.
Handler handler(handlerSettings);
handler.start(subscriptions);

The following code demonstrates how to instruct the Handler to add securities to the filter during security definition recovery:

virtual void onFuturesProductDefinition(
const FuturesProductDefinition& msg,
bool& isInterested) override
{
if (318412 == msg.marketId)
{
isInterested = true;
}
}