Decoding FieldList Contents with Field and Enumerated Types Dictionaries
It's not very clear from the docs HOW actually I can get decoded value from the dictionary.
For example the following request:
consumer.registerClient(EmaFactory.createReqMsg().domainType(6)
.serviceName("ELEKTRON_EDGE").name("ADDYY.PQ"), appClient);
I receive
FieldEntry fid="15" name="CURRENCY" dataType="Enum" value="840"
How I can programmatically get corresponding value for 840 from enumtype.def dictionary? (840 "USD" US dollar)
Best Answer
-
EMA Java does not provide
interface to get decoded enum value. EMA Java keeps the dictionaries
(RDMFieldDictionary and enumtype.def) internally. However, EMA Java is open
source so you can modify it to get decoded enum value according to the enum
dictionary it has loaded as example shown below:OmmEnum.java– add getEnum() method
public com.thomsonreuters.upa.codec.Enum getEnum();
OmmEnumImpl.java–
implement getEnum() method@Override
public com.thomsonreuters.upa.codec.Enum getEnum()
{
return _rsslEnum;
}FieldEntry.java– add
enumText() methodpublic String enumText();
FieldEntryImpl.java–
implement enumText() to get decoded enum value according to enum dictionary@Override
import com.thomsonreuters.upa.codec.EnumType;
…
public String enumText() {
OmmEnum aEnum= ((OmmEnum)_load);
EnumType enumType =_fieldList._rsslDictionary.entryEnumType(_rsslDictionaryEntry,aEnum.getEnum());
if(enumType==null) {
String errText = errorString().append("Attempt to enumText() while value(" )
.append(String.valueOf(aEnum.enumValue())).append(") is not found in enumtype.def").toString();
throw ommIUExcept().message(errText);
}
else
return enumType.display().toString();
}1
Answers
-
It does not appear EMA supports enumerated types properly, it is possible with ETA.
EnumType enumType = dictionary.entryEnumType(dictionaryEntry, fidEnumValue);
System.out.println (enumType.display().toString());You have the enum value in EMA but the dictionary is completely hidden.
0 -
The example to use enumText() which source code is above:
System.out.print("Fid: " + fieldEntry.fieldId() + " Name = " + fieldEntry.name() + " DataType: " + DataType.asString(fieldEntry.load().dataType()) + " Value: ");
...
case DataTypes.ENUM :
System.out.println(fieldEntry.enumValue() + "(" + fieldEntry.enumText()+")");
break;The example output:
Fid: 15 Name = CURRENCY DataType: Enum Value: 840(USD)
1 -
This is a good way to convert the enum value to text. Wanted to state that the proposed solution goes against the EMA established decoding rules. Throwing exception when the enum text is not found in the dictionary on the decoding path is "frowned upon" due to the Java performance implications. The OmmError class should be used instead. Handling of this situation is tricky since it is unclear what caused the error: network glitch, wrong dictionary, or anything else. Blindly converting the OmmEnum into the OmmError may bring "wrong" consequences to apps that do not care about the enum text.
0 -
the ETA and RFA do provide means for enum value to text conversion. The EMA is planning to add a similar capability too.
0 -
The Elektron SDK team just released a new version ("Elektron SDK - Java - 1.1.0" available for download here) that implements the features you need. The FieldEntry::getEnumDisplay() method gives you access to String representations of Enum values. This new SDK also allows you to get access to the internal EMA dictionary. I did not test these features yet but they seem promising.
0
Categories
- All Categories
- 6 AHS
- 39 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛