question

Upvotes
Accepted
16 5 8 12

EMA SDK examples to parse page based data

Hello,

Are there any examples provided in EMA SDK to parse page based data?

Thank you.

NWM

elektronrefinitiv-realtimeelektron-sdkpageparser
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.

Upvotes
Accepted
9.5k 10 5 7

Hello @NWM

You can use example102__MarketPrice__Snapshot to send a snapshot item/RIC request to snapshot the page. Hence, you will get only a refresh message containing the latest data of all available fields of the RIC at that time; there is no any update message after the refresh message. The example calls ReqMsg.interestAfterRefresh(false) to specify that snapshot item is requested as code below:

consumer.registerClient(reqMsg.serviceName("DIRECT_FEED").name("IBM.N").interestAfterRefresh(false), appClient);

Whenever the application want to snapshot the page, it needs to send a snapshot RIC request by calling consumer.registerClient(..) as the source code above.

Normally, a page is shown via the field named ROW64_1(field id 215) to ROW64_14(field id 228) or ROW80_1(field id 315) to ROW80_25(field id 339). Please refer to decode(FieldList fieldList) method in example120__MarketPrice__FieldListWalk which shows how to get the field id.

The example of a page display in ROW64_n fields:

The example of a page display in ROW80_n fields:


row64-page.png (42.3 KiB)
row80-page.png (73.4 KiB)
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.

Upvotes
9.5k 10 5 7

Hello @NWM,

The page can be update partially by the provider sends an intra-field positioning sequence within the data field. Hence, the application requires additional steps for processing an update message to display the correct data of the field.

The syntax of an intra-field positioning sequence is as follows:

Where:

  • <CSI> is the control sequence introducer (this can be a one or two-byte sequence, either Hex 9B or Hex 1B5B)
  • n is an ASCII numeric string representing the cursor offset position relative to the start of the field.
  • <HPA> is the Horizontal Position Adjust character which terminates the intra-field position sequence (Hex 60 which is an ASCII “ ‘ ”).

The 0x60 byte signals the termination of the partial update positioning sequence. n is a set of numeric digits (0x30 through 0x39) that represent the byte offset position relative to the start of the field. Counting begins with the first byte position being number 0 (zero).

For example, the application receives a refresh message with Field Id 317 is:

7189 4378 3077 6438 | 6438 6387 3269 5465

and the following update is received:

FIELD_ENTRY 317: 1b5b313460343433202037383137

Hex "1b5b313460343433202037383137" means update the field at position 14 with “443 7817”

Then after the update is processed, the data of field 317 that the application should display is:

7189 4378 3443 7817 | 6438 6387 3269 5465

EMA provides RmtesBuffer.apply() to interpret the intra-field position. Even there is no example to parse page data in EMA but you can modify example120__MarketPrice__FieldListWalk shipped with EMA Java package to parse page data as the snipped source code below:

class AppClient implements OmmConsumerClient
{
  //a Map keeps field Id as a key with RmtesBuffer
  TreeMap <Integer, RmtesBuffer> rmtesMap = new TreeMap <Integer, RmtesBuffer>();
      …
 void decode(FieldList fieldList)
 {
   Iterator<FieldEntry> iter = fieldList.iterator();
   FieldEntry fieldEntry;
   while (iter.hasNext())
   {
      fieldEntry = iter.next();
      //not print a value of each field
      //System.out.println("Fid: " + fieldEntry.fieldId() + " Name: " +    fieldEntry.name() + " value: " + fieldEntry.load());
    //apply() call for any RMTES field which is not blank
    if(fieldEntry.loadType()==DataTypes.RMTES & fieldEntry.code()!=Data.DataCode.BLANK) 
    {
     //if the field id does not exist in the map, create new RmtesBuffer object
     if(!rmtesMap.containsKey(fieldEntry.fieldId())) 
     {
     rmtesMap.put(fieldEntry.fieldId(), EmaFactory.createRmtesBuffer());
     } 
     //call apply() to interpret the intra-field position 
     rmtesMap.get(fieldEntry.fieldId()).apply(fieldEntry.rmtes());
    }
   }
   //prints all RMTES fields(the field id with its value) in the map on the console to display the page
   for (Integer fieldId: rmtesMap.keySet())
   {
     System.out.print(fieldId+":");
     System.out.println(rmtesMap.get(fieldId).toString());  
   }
 }
…
}  
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.

Upvotes
16 5 8 12

@Pimchaya, Thank you for the explanation. My requirement is to snapshot the page once / twice a day and the page does not update frequently. Can you share examples (RFA also ok) to extract data given the start & end position? Thanks.

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.

Upvotes
16 5 8 12

@Pimchaya, Thank you for the information. I will look into the sample programs as you suggested.

Regards

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