I need an example application using MarketData/TibMsg interface to parse page data
Best Answer
-
Hello @Catherine Wong
The page data can be updated partially. Therefore, the
application requires additional steps for processing an update message to
display the correct data of the field.Normally, updates to specific fields would be accomplished by
sending the whole data field; however with some large fields this can be inefficient
when only a few characters within the data field are to be updated. In such
cases the publishing application sends an intra-field positioning sequence
within the data field so that the minimum number of characters are transmitted
to effect a change.The syntax of an intra-field positioning sequence is as follows:
<CSI>n<HPA>
Where:
- <CSI> is the control sequence introducer
(this can be a one or two-byte sequence, either Hex 9B or Hex 1b 5b)
- 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 the
field id 318 is:4087 -1s 4409 8578 | 3349 3268 8038 8738
and the following hex update is received:
1b 5b 37 60 38 35 37 37 20 20 33 30 37 37 20 20 36 34 33
The update means update the field at position 7 with “8577 3077 643”
Then after the update is processed, the data of the field id 318
that the application should display is:4087 8577 3077 6438 | 3349 3268 8038 8738
The intra-field positioning sequence is supported for fields of the ALPHANUMERIC type.
TibMsg Interface used by MarketData applications provides the
following class/constant that helps to interpret partial update:- TibMsg.TIBMSG_PARTIAL: Indicates data is
partial field type containing offset and content(updated value). Use the
class TibPartial for casting
and dereference of this type of data. - TibPartial : provide methods to get
offset(TibPartial.offset) and content(TibPartial.contents) in an partial
update message.
Unfortunately, there is no MarketData example
application shipped with RFA Java package to process partial updates. However,
you can modify the file named MDSubDemoClient.java in MDSubDemo application located in <RFAJ_Package>\Legacy\Examples\com\reuters\rfa\legacyexample\session\mdsub
to use the class/constant above to process partial update.The example source code of modified MDSubDemoClient.java to process
partial and full update is below:public class MDSubDemoClient implements Client
{
private final MDSubDemo _application;
TibMsg msg = new TibMsg();
TibField field = new TibField();
//The map which keeps the fields(Field id & Value) to be updated
Map<Integer,String> pageFields;
…
public MDSubDemoClient(MDSubDemo subDemo)
{
_application = subDemo;
//initialize the map which keeps fields to be updated
pageFields = new TreeMap<Integer,String>();
}
…
protected void processMarketDataItemEvent(MarketDataItemEvent marketDataItemEvent)
{
…
if (dict.fhint == Tib.HINT_MFEED_ENUMERATED)
{
…
}
else
//System.out.println(field.StringData());
{ // if the field is not Enumerated type
if( field.Type() == TibMsg.TIBMSG_PARTIAL )
//update partial field
{
TibPartial p = (TibPartial)field.Data();
String updateStr = new String(p.contents);
int offset = p.offset; //offset starts from 0
System.out.println("fieldId:"+fid + ", offset:"+ offset + ", updateString:" + updateStr);
StringBuilder value = new StringBuilder(pageFields.get(fid));
value.replace(offset, offset+updateStr.length(), updateStr);
pageFields.put(fid, value.toString());
}
else {//update whole field
pageFields.put(fid, field.StringData());
}
}
…
System.out.println();
//display the page after updating all fields of the page
System.out.println("**********************Updated Page***************************************");
for (Integer fieldId: pageFields.keySet()){
System.out.print(fieldId+":");
System.out.println(pageFields.get(fieldId).toString());
}
}The example command line to run MDSubDemo 5
minutes(300 seconds) with a user named pimchaya to subscribe a
RIC named 3323bk.HKd to the service named ELEKTRON_NEON on the
server configured in a consumer session(connection type is SSL) named SSLNamespace::pageSSLSession:java -cp .;..\..\Libs\rfa.jar com.reuters.rfa.legacyexample.session.mdsub.MDSubDemo -session SSLNamespace::pageSSLSession -serviceName ELEKTRON_NEON -itemName 3323bk.HKd -mounttpi true -user pimchaya -runTime 300
For the help of MDSubDemo, please refer to package.html in <RFAJ_Package>\Legacy\Examples\com\reuters\rfa\legacyexample\session\mdsub
The example output:
0 - <CSI> is the control sequence introducer
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 689 Datastream
- 1.4K DSS
- 625 Eikon COM
- 5.2K Eikon Data APIs
- 11 Electronic Trading
- 1 Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 255 ETA
- 558 WebSocket API
- 39 FX Venues
- 15 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 277 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 23 RDMS
- 1.9K Refinitiv Data Platform
- 696 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 106 UPA
- 194 TREP Infrastructure
- 229 TRKD
- 918 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 94 Workspace SDK
- 11 Element Framework
- 5 Grid
- 19 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛