OnixS ICE iMpact Multicast Price Feed Handler C++ library 8.18.0
Users' manual and API documentation
Loading...
Searching...
No Matches
Local Book Verification Sample

Subscribes to one or more markets (market IDs may be passed on the command line) and traces market data events so the locally maintained order books can be compared against a reference such as the WebICE portfolio.

Source code

#include "../Common/Defaults.h"
#include "../Common/MarketDataEventTracer.h"
#include "../Common/ServiceEventTracer.h"
#include "../Common/Utils.h"
#include <cstdlib>
int main(int argc, char* argv[])
{
try
{
introduceMyself("Local Book Verification");
FeedEngineSettings feedEngineSettings;
FeedEngine feedEngine(feedEngineSettings);
HandlerSettings handlerSettings;
// For most of Linux operating systems it would be
// better to define following parameter to be able to
// successfully receive market data from multicast feeds.
handlerSettings.networkInterface = NETWORK_INTERFACE;
// Let's activate logging to get data for support.
handlerSettings.logLevel = LogLevels::Debug;
handlerSettings.logDirectory = LOG_DIRECTORY;
handlerSettings.logFileNamePrefix = LOG_FILE_NAME_PREFIX;
// By default, license is stored in lib folder of the distribute
// package. Instead of copying, let's use original file.
handlerSettings.licenseDirectory = LICENSE_DIRECTORY;
// Primary settings - connectivity configuration.
handlerSettings.connectivityConfiguration = AP1_C10Y_FILE;
// Constructs handler with custom license root and enabled logging.
Handler handler(handlerSettings);
// Binds the handler to the feed engine.
handler.bindFeedEngine(feedEngine);
// Traces all service events coming from handlers.
ServiceEventTracer serviceEventTracer;
serviceEventTracer.attachTo(handler);
// Traces all market data events coming from handlers.
MarketDataEventTracer marketDataEventTracer;
marketDataEventTracer.attachTo(handler);
// Making subscription.
MarketSubscriptions subscriptions;
MarketSubscription brentFutures(
);
for (int i = argc - 1; i > 0; --i)
{
brentFutures.marketIds.insert(atoi(argv[i]));
}
subscriptions.insert(brentFutures);
// Now starts the subscription.
handler.start(subscriptions);
readUserResponse();
std::cout << "Shutdown the Handler..." << std::endl;
// Stops multicast data processing.
handler.stop();
std::cout << "Done." << std::endl;
}
catch (const std::exception& ex)
{
std::cout << "Error: " << ex.what() << std::endl;
return EXIT_FAILURE;
}
catch (...)
{
std::cout << "Unknown exception." << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}