dictionary load problem
Hello, everyone. Currently I encounter some question on using reuter dictionary. My sample code as follows:
thomsonreuters::ema::rdm::DataDictionary fid_dict_;
map<Int16, const emardm::DictionaryEntry*> map_fid_dict_;
fid_dict_.loadFieldDictionary(dict_file.c_str());
fid_dict_.loadEnumTypeDictionary(enum_file.c_str());
const emaaccess::EmaVector<emardm::DictionaryEntry>& vec_entry = fid_dict_.getEntries();
for(unsigned i = 0; i < vec_entry.size(); i++)
{
const emardm::DictionaryEntry* ptr = &(vec_entry[i]);
map_fid_dict_[ vec_entry[i].getFid() ] = ptr;
LOG_DEBUG("acronym:%s, ddeAcronym:%s, fid:%d, rippleToField:%d, fieldType:%d, length:%d, "
"enumLength:%d, rwfType:%d, rwfLength:%d",
ptr->getAcronym().c_str(), ptr->getDDEAcronym().c_str(), ptr->getFid(),
ptr->getRippleToField(), ptr->getFieldType(), ptr->getLength(),
ptr->getRwfType(), ptr->getRwfLength());
}
The sample code load field dictionary and enum type dictionary from RDMFieldDictionary and enumtype.def which are shipped with EMA SDK. But when using LOG_DEBUG print certain field value, it seems the RwfType and RwfLength is unitialized at this moment, for example I got following output for BIDSIZE field:
Debug: acronym:BIDSIZE, ddeAcronym:BID SIZE, fid:30, rippleToField:0, fieldType:1, length:15, enumLength:8, rwfType:7, rwfLength:30603272
But later when I use map_fid_dict to fetching DictonaryEntry info for adding data into FieldList, I print the entry for BIDSIZE again like this:
Debug: BIDSIZE with type:1, fid:30, rwfType:8, length:7
The latter is right according to RDMFieldDictionary file. But why the previous printed rwf type & length is incorrect at that moment? My code has no further modification to map_fid_dict after load dictionary file. Many thanks.
Best Answer
-
The number of format characters and variables mismatch.
There are nine format characters in the format string but there are only eight values.
- ptr->getAcronym().c_str() => acronym:%s
- ptr->getDDEAcronym().c_str() => ddeAcronym:%s
- ptr->getFid() => fid:%d
- ptr->getRippleToField() => rippleToField:%d
- ptr->getFieldType() => fieldType:%d
- ptr->getLength() => length:%d
- => enumLength:%d
- ptr->getRwfType() => rwfType:%d
- ptr->getRwfLength() => rwfLength:%d
You need to add ptr->getEnumLength().
printf("acronym:%s, ddeAcronym:%s, fid:%d, rippleToField:%d, fieldType:%d, length:%d, "
"enumLength:%d, rwfType:%d, rwfLength:%d\n",
ptr->getAcronym().c_str(), ptr->getDDEAcronym().c_str(), ptr->getFid(),
ptr->getRippleToField(), ptr->getFieldType(), ptr->getLength(),
ptr->getEnumLength(),
ptr->getRwfType(), ptr->getRwfLength());The output is:
acronym:PROD_PERM, ddeAcronym:PERMISSION, fid:1, rippleToField:0, fieldType:1, length:5, enumLength:0, rwfType:4, rwfLength:2
acronym:RDNDISPLAY, ddeAcronym:DISPLAYTEMPLATE, fid:2, rippleToField:0, fieldType:1, length:3, enumLength:0, rwfType:4, rwfLength:1
acronym:DSPLY_NAME, ddeAcronym:DISPLAY NAME, fid:3, rippleToField:0, fieldType:5, length:16, enumLength:0, rwfType:19, rwfLength:16
acronym:RDN_EXCHID, ddeAcronym:IDN EXCHANGE ID, fid:4, rippleToField:0, fieldType:6, length:3, enumLength:3, rwfType:14, rwfLength:1
acronym:TIMACT, ddeAcronym:TIME OF UPDATE, fid:5, rippleToField:0, fieldType:7, length:5, enumLength:0, rwfType:10, rwfLength:5
acronym:TRDPRC_1, ddeAcronym:LAST, fid:6, rippleToField:7, fieldType:4, length:17, enumLength:0, rwfType:8, rwfLength:7
acronym:TRDPRC_2, ddeAcronym:LAST 1, fid:7, rippleToField:8, fieldType:4, length:17, enumLength:0, rwfType:8, rwfLength:7
acronym:TRDPRC_3, ddeAcronym:LAST 2, fid:8, rippleToField:9, fieldType:4, length:17, enumLength:0, rwfType:8, rwfLength:7
acronym:TRDPRC_4, ddeAcronym:LAST 3, fid:9, rippleToField:10, fieldType:4, length:17, enumLength:0, rwfType:8, rwfLength:70
Answers
-
I did a quick test your codes to print the dict. I just changed LOG_DEBUG to use normal cout and use static_cast when display integer value and then get a correct output according to the dic I load.
cout << "acronym:" << ptr->getAcronym().c_str() <<"\tddeAcronym:" << ptr->getDDEAcronym().c_str() << "\tfid:" << static_cast<int>(ptr->getFid()) << "\trippleToField:" << (int)ptr->getRippleToField() << "\tfieldType:" << static_cast<int>(ptr->getFieldType()) << "\tlength:" << static_cast<int>(ptr->getLength()) << "\tenumLength:" << static_cast<int>(ptr->getEnumLength()) << "\trwfType:" << static_cast<int>(ptr->getRwfType()) << "\trwfLength:" << static_cast<int>(ptr->getRwfLength()) << "\n";
Below is dictionary and sample output from the codes.
! Previous latest bid prices the first being most recent. ! ASK "ASK" 25 ASK_1 PRICE 17 REAL64 7 ! ! Latest Ask Price (price offering to sell) ! ASK_1 "ASK 1" 26 ASK_2 PRICE 17 REAL64 7 ASK_2 "ASK 2" 27 ASK_3 PRICE 17 REAL64 7 ! ! Previous latest ask prices the first being most recent. ! NEWS "NEWS" 28 NULL ALPHANUMERIC 4 RMTES_STRING 4 ! ! News retrieval page code. ! NEWS_TIME "NEWS TIME" 29 NULL TIME 5 TIME 5 ! ! Time of generation of news item whose page code is given by NEWS. ! BIDSIZE "BID SIZE" 30 NULL INTEGER 15 REAL64 7 ! ! The number of shares, lots, or contracts willing to buy at the Bid price ! ASKSIZE "ASK SIZE" 31 NULL INTEGER 15 REAL64 7 ! ! The number of shares, lots, or contracts willing to sell at the Ask price ! ACVOL_1 "VOL ACCUMULATED" 32 NULL INTEGER 15 REAL64 7 ! ! Accumulated number of shares, lots or contracts traded according to the market ! convention ! EARNINGS "EARNINGS" 34 NULL PRICE 17 REAL64 7 ! ! Latest reported earnings per share. ! YIELD "YIELD" 35 NULL PRICE 17 REAL64 7
acronym:ASK ddeAcronym:ASK fid:25 rippleToField:26 fieldType:4 length:17 enumLength:0 rwfType:8 rwfLength:7 acronym:ASK_1 ddeAcronym:ASK 1 fid:26 rippleToField:27 fieldType:4 length:17 enumLength:0 rwfType:8 rwfLength:7 acronym:ASK_2 ddeAcronym:ASK 2 fid:27 rippleToField:6130 fieldType:4 length:17 enumLength:0 rwfType:8 rwfLength:7 acronym:NEWS ddeAcronym:NEWS fid:28 rippleToField:0 fieldType:5 length:4 enumLength:0 rwfType:19 rwfLength:4 acronym:NEWS_TIME ddeAcronym:NEWS TIME fid:29 rippleToField:0 fieldType:7 length:5 enumLength:0 rwfType:10 rwfLength:5 acronym:BIDSIZE ddeAcronym:BID SIZE fid:30 rippleToField:0 fieldType:1 length:15 enumLength:0 rwfType:8 rwfLength:7 acronym:ASKSIZE ddeAcronym:ASK SIZE fid:31 rippleToField:0 fieldType:1 length:15 enumLength:0 rwfType:8 rwfLength:7 acronym:ACVOL_1 ddeAcronym:VOL ACCUMULATED fid:32 rippleToField:0 fieldType:1 length:15 enumLength:0 rwfType:8 rwfLength:7 acronym:EARNINGS ddeAcronym:EARNINGS fid:34 rippleToField:0 fieldType:4 length:17 enumLength:0 rwfType:8 rwfLength:7 acronym:YIELD ddeAcronym:YIELD fid:35 rippleToField:0 fieldType:4 length:17 enumLength:0 rwfType:8 rwfLength:7
0 -
@jirapongse.phuriphanvichai @moragodkrit.chumsri_1 Thank you all. As jirapongse.phuriphanvichai replied, it's a problem of printf formatting. Sorry for my carelessness, and thanks you two again.
0
Categories
- All Categories
- 6 AHS
- 37 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 中文论坛