This sample shows the simplest way to receive and process CME MDP 3.0 market data.
class DirectBookListener : public SecurityListener
{
{
std::cout <<
"DirectBook updated:" << std::endl <<
toStr(book) << std::endl;
}
};
int main(int argc, char** argv)
{
std::cout
<< "." << std::endl << std::endl;
if (argc < 2)
{
std::cerr << "usage: [ChannelId]" << std::endl;
return 1;
}
try
{
Handler handler;
handler.settings().channel(channelId);
handler.settings().licenseSettings().licenseStore(LICENSE_STORE_FOLDER);
handler.settings().connectivityConfigurationFile(CONNECTIVITY_CONFIGURATION_FILE);
#if !defined(_WIN32)
checkNetworkSettings(NETWORK_INTERFACE_FOR_FEEDS_A, NETWORK_INTERFACE_FOR_FEEDS_B);
handler.settings().feeds()
.feedANetworkInterfaces(NETWORK_INTERFACE_FOR_FEEDS_A)
.feedBNetworkInterfaces(NETWORK_INTERFACE_FOR_FEEDS_B);
#endif
handler.settings().bookManagement().directBooks().maintain(true);
handler.settings().logging().debug().traceBooks(true);
DirectBookListener listener;
handler.settings().listeners().security(&listener);
std::cout << "Starting processing market data.." << std::endl << "Press Ctrl+C to stop and exit." << std::endl;
handler.start();
while (!InterruptDetector::instance().detected())
CurrentThread::sleep(1);
std::cout << "Stopping processing market data.." << std::endl;
handler.stop();
}
catch (const std::exception& ex)
{
std::cerr << std::endl << "ERROR: " << ex.what() << std::endl;
return 1;
}
return 0;
}