question

Upvotes
Accepted
1 0 0 0

FieldEntry name return doesn't match with the FieldValue

public void onUpdateMsg(UpdateMsg updateMsg, OmmConsumerEvent event) {
 FieldList fieldList = updateMsg.payload().fieldList();
 for (FieldEntry fieldEntry : fieldList)
 {
 if (Data.DataCode.BLANK == fieldEntry.code())
 break;
 else if (fieldEntry.fieldId() == fid)
 fieldValue = Double.toString(fieldEntry.real().asDouble());
 LOGGER.log(Level.INFO, "update~~~~~~~~" + updateMsg.name() + " " +  fieldEntry.name() + " " + fieldValue);
 break;
 }
 }

I am working on the implementation for the real time data to the excel plugin. I have encounter the following issue.

Here I have subscribe to the 0005.HKd with BEST_ASK1 and BEST_ASIZ1. I print out the update msg receive from data feed.

2019-08-28 16:04:52,896 - INFO : update~~~~~~~~0005.HKd BEST_ASK1 127600.0
2019-08-28 16:04:52,896 - INFO : update~~~~~~~~0005.HKd BEST_ASK1 56.05

The fieldEntry.name() return BEST_ASK1 instead of BEST_ASIZ1 for best ask size 1.

elektronrefinitiv-realtimeelektron-sdkrrtema-apielektron-message-api
icon clock
10 |1500

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

1 Answer

Upvotes
Accepted
11.3k 25 8 13

Hi @a33

From the code, the updateMsg.name() and fieldEntry.real().asDouble() are not called in the same statement. Could you modify scope of else if statement to ensure that both interfaces are called at the same time as follows?

public void onUpdateMsg(UpdateMsg updateMsg, OmmConsumerEvent event) 
{ 
	FieldList fieldList = updateMsg.payload().fieldList(); 
	for (FieldEntry fieldEntry : fieldList) 
{ if (Data.DataCode.BLANK == fieldEntry.code())
break;
else if (fieldEntry.fieldId() == fid)
{
fieldValue = Double.toString(fieldEntry.real().asDouble());
LOGGER.log(Level.INFO, "update~~~~~~~~" + updateMsg.name() + " " + fieldEntry.name() + " " + fieldValue); break;
} }
}
icon clock
10 |1500

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

Click below to post an Idea Post Idea