question

Upvotes
Accepted
3 2 2 6

Regarding data

In my code where I receive data from Reuters, I am giving a milliseconds of 500. So at intervals of 500 milliseconds, it reads the data. Are we missing any data if we increase the time?

elektronrefinitiv-realtimeelektron-sdkema-apirrtelektron-message-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
21.9k 58 14 21

@liyarthomas your code does not show the event dispatch and callback handler. Application has to receive data from EMA not poll it. If the ticks are not removed from EMA fast enough, then queue will fill up and application will run out of heap memory.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
25.3k 87 12 25

Hi @liyarthomas

Depending on the volatility of the instruments you are consuming and the service you are consuming from, there could well be much higher update rates.

Are you using streaming requests or snapshot requests?

Can you confirm what you mean by 'at intervals of 500ms it reads the data' - how exactly are you controlling this?

The event callback handlers in EMA (onRefreshMsg, onUpdateMsg etc) are event driven and called as & when any new updates arrive from the server - provided that you are continuously dispatching events.

Are you limiting the calls to dispatch() to once every 500ms? If so, any updates received from the server could start building up in a queue and your callbacks will only receive the next one in the queue as and when dispatch is called. If you do not call dispatch often enough for a instrument that updates more frequently - you may not get all the updates...

Please explain how your interval reading is working....

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
3 2 2 6
We are using an Asynchronous server here which reads the data store every 200 milliseconds and publishing it into the zero MQ.
The event callback handlers in EMA are event driven and are called as and when any new updates arrives from server.

I have attached here just two files which does the following. But I have not attached the event driven appclient.

So what we wanted to know is that, as we are reading the datastore every 200ms, are we missing any ticks?

using namespace thomsonreuters::ema::access;
using namespace thomsonreuters::ema::rdm;
using namespace std;
int main(int argc, char* argv[])
{
	try {
		// instantiate callback client
		mdsdemo::DataStore ds; 
		mdsdemo::AppClient client(ds);
		//ip, port, interval, datastore
		mdsdemo::AsyncServer as("*", 40000, 1000, ds );
		cout << "Connecting to market data server" << endl;


		// create OMM consumer
		OmmConsumer consumer(
			OmmConsumerConfig()
			.host("159.220.108.133:14002")
			.username("NJ2_03_RHB_SWVPNTRIAL01")
		);


		cout << "Subscribing to market data" << endl;
		std::vector<string> rics = {
			"USDEUR=R","JPYUSD=R","USDGBP=R","USDAUD=R","CHFUSD=R", "CADUSD=R"
		}; 


		for (const auto ric : rics)
		{
			//first setup datastore for the ric 
			ds.AddStorage(ric, new mdsdemo::FxData());


			// subscribe to Level1 market data
			consumer.registerClient(
				ReqMsg()
				// default subscription domain is MMT_MARKET_PRICE
				.serviceName("hEDD")
				.name(ric.c_str()),
				client);
		}


		//run asynchronously reading the data store every 1000 milliseconds and publishing into the 
		//queue 
		as.RunForEver();


	}
	catch (const OmmException& excp) {
		cout << "Exception subscribing to market data: " << excp << endl;
	}


	return 0;
}


#include <sstream>
#include <iostream>
#include <boost/bind.hpp>
#include "AsyncServer.h"


using std::cout; 
using std::endl;


namespace mdsdemo
{


	AsyncServer::AsyncServer(string ip, int port, long interval,  DataStore & ds)
		:context_(1), pub_(context_, ZMQ_PUB), interval_(interval), ds_(ds)
	{
		std::stringstream ss;
		ss << "tcp://" << ip << ":" << port; 
		pub_.bind(ss.str());
	}


	AsyncServer::~AsyncServer()
	{
	}


	void AsyncServer::RunForEver()
	{
		boost::asio::deadline_timer t(io_, boost::posix_time::millisec(interval_));
		t.async_wait(boost::bind(&AsyncServer::OnTimer, this,
			boost::asio::placeholders::error, &t));
		io_.run();
	}


	void AsyncServer::Publish()
	{
		try {
			std::string jsonData = "full ";
			jsonData += 
			ds_.ToJsonFull();
			zmq::message_t msg(jsonData.begin(), jsonData.end());
			pub_.send(msg);
			cout << jsonData << endl; 
		}
		catch (const std::exception & exp)
		{
			//TODO log errors
		}
	}


	void AsyncServer::OnTimer(const boost::system::error_code& /*e*/,
		boost::asio::deadline_timer* t)
	{
		Publish();
		t->expires_at(t->expires_at() + boost::posix_time::millisec(interval_));
		t->async_wait(boost::bind(&AsyncServer::OnTimer, this,
			boost::asio::placeholders::error, t));
	}




}


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.