question

Upvotes
Accepted
1 0 0 1

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-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.

@a33, thank you for your participation in the forum. Is the reply below satisfactory in resolving your query? If yes please click the 'Accept' text beneath the reply. This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question. Thanks, AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.


Thanks,

AHS

1 Answer

· Write an Answer
Upvotes
Accepted
11.3k 25 9 14

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 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.