Elektron SDK - C/C++

API Family: Elektron

EMA Consumer - Creating a barebones EMA consumer application

Download tutorial source code

Click here to download

Last update June 2018
Compilers Tutorial demonstration: Visual Studio 2013

Refer to the EMA Compiler Guides for a complete list
Prerequisites Downloaded, installed, compiled and ran an EMA consumer example


The goal of this tutorial is to setup a Visual Studio project which defines the required compiler and linker options to successfully build and run. This tutorial will setup an application shell which enables us to perform basic EMA initialization.


Market data is delivered to an application in an asynchronous event driven manner. Applications use EMA API to subscribe to items. API delivers the initial data, subsequent updates and status updates through callback events.


The goal of this tutorial is to setup a simple Visual Studio project, define a shell that performs basic EMA initialization, build and run the example successfully. The steps include:

  • Setup the Visual Studio Project
  • Implementation Overview - Shell code for EMA initialization
  • Build and run

Setup the Visual Studio Project

The Consumer project that is packaged with this tutorial can be installed in any location within your environment. It needs to access to EMA API headers, library, configuration and dictionary files. This project assumes our setup is based on environment variables. Using this approach, there is no need to modify the project file but instead define one environment variable. This will allow a developer to easily copy/duplicate projects to other members and to themselves without having to re-define directory locations within the project.

Define the project environment variables

  • EMAInstall - Points to the home directory where the Elektron SDK C++ is installed.

Eg. Windows > System Properties > Advanced (Tab) > Environment Variables... > System variables:

Variable name EMAInstall
Variable value C:\Projects\API\Elektron-SDK


Once this step has been completed, all tutorials should compile without any configuration change.

Implementation Overview - Basic shell code for EMA initialization

The basic shell utlizes a single source file Consumer.cpp and its corresponding header file: Consumer.h. For convenience, the shell contains an entry point and initialization routine that further tutorials will build on.

Class Definition: We include Ema.h, and define a custom class which extends from OmmConsumerClient. API will invoke onRefreshMsgonUpdateMsg and onStatusMsg of OmmConsumerClient, whenever there are any notifications (status update or market data) to be delivered.


#include "Ema.h"
class AppClient : public thomsonreuters::ema::access::OmmConsumerClient	  {
    void onRefreshMsg( ... );
    void onUpdateMsg( ... );
    void onStatusMsg( ... );

Implementation: An instance of AppClient is created in Consumer.cpp. This instance will be passed in API calls to indicate that we intend to receive callbacks here:

int main( int argc, char* argv[] )	
  // create an instance of consumer client
  AppClient client;
  // block this thread for 1 minute
  return 0;

You can see from above, this empty shell just includes a header file, and creates a type of EMA subclass, which is setup to receive events and updates from market data system. In the following tutorials, we will establish a connection and subscribe to market data.

Build and run

Assuming you have setup the environment variable, you can now compile and run the tutorial. If you encounter any compile errors, ensure your environment variable is properly defined. When you run the tutorial, you should see no errors and application will simply exit after a minute, at the command line. 

Tutorial Group: 
EMA Consumer