question

Upvotes
Accepted
15 7 4 9

What is the best way to decode the OMMMsgs received (e.g. to get prices) when subscribing to a RIC using RFA?

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

@Ethan Wong

Thank you for your participation in the forum.

Are any of the replies below satisfactory in resolving your query?

If yes please click the 'Accept' text next to the most appropriate reply. This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your question.

Thanks,

AHS

Hi @Ethan Wong

Awaiting your response?

Regards,

AHS

1 Answer

· Write an Answer
Upvote
Accepted
582 9 15 23

Hi @Ethan Wong

Are you asking about decoding Market Price (for trades, indicative quotes) response message payloads?

If so, here's the description of the Market Price response message payload.

Here's a tutorial on Retrieving Level 1 MARKET PRICE Data

Here's an example:

OMMItemEvent ie = (OMMItemEvent)event;
OMMMsg respMsg = ie.getMsg();

if (respMsg.getDataType() != OMMTypes.NO_DATA) {
	if (respMsg.getPayload().getType() == OMMTypes.FIELD_LIST) {	        	
		OMMFieldList fl = (OMMFieldList) respMsg.getPayload();
		
		 for (Iterator iter = ((OMMIterable)fl).iterator(); iter.hasNext();) {
			 OMMEntry entry = (OMMEntry)iter.next();
			 
			 if (entry.getType() == OMMTypes.FIELD_ENTRY) {
				 OMMFieldEntry fe = (OMMFieldEntry)entry;	             
				 System.out.print("FID="+fe.getFieldId() );	                	 
				 if (CURRENT_DICTIONARY != null)  {
					 FidDef fiddef = CURRENT_DICTIONARY.getFidDef(fe.getFieldId());
					 if (fiddef != null) {	    
						 System.out.print(" FieldName="+fiddef.getName() +" FieldValue=");
						 OMMData data = null;
						 if (fe.getDataType() == OMMTypes.UNKNOWN)
							 data = fe.getData(fiddef.getOMMType());
						 else
							 // defined data already has type
							 data = fe.getData();
						 
						 if (data.getType() == OMMTypes.ENUM) {
							 System.out.print(CURRENT_DICTIONARY.expandedValueFor(fiddef.getFieldId(),
																		  ((OMMEnum)data).getValue()));
							 System.out.println(" (" + data + ")");
						 }  else
							 System.out.println(data); 
					 } else {
						 System.out.println(" - Not defined in dictionary");
					 }
				 } // END - if (CURRENT_DICTIONARY != null)
			 }    // FIELD_ENTRY            
		 } // END-FOR	        	
	} // END - if FIELD_LIST
}

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.