where can I find a sample of TibMsg::PrintTib usage
Best Answer
-
I think I know what's happening.. I do delete[] buff and this is probably what cause an exception. This will happen only if PrintTib deletes buffer in the body of the function. Is it possible to confirm?
0
Answers
-
Hello @igorg,
In my RFA 7.6 SDK installation, in folder Legacy/Docs, there is TibMsg Programmer Guide
That contains the method declaration and the example of use:
TibMsg msg;
msg.PrintTib(stdout);Note, that at the time of the general release of RFA 7.6, in 2014, TibMsg was already best-described as "legacy". Elektron SDK APIs, EMA and ETA are the best choice for new development, if you are looking at a sizable enhancement requirement, it is likely a good point of time to migrate the app to Elektron API.
0 -
Could you give me a link where I can download or view RFA 7.6 documentation? I have Docs and Examples from 7.6.2.E3 and I couldn't find anything about TibMsg.
/Legacy/Docs/refman/rfa/classes.html - has nothing about TibMsg as well.
I know about Elekton, however we use RFA in old existing project that is not going to be abandoned soon.
0 -
Download the complete older SDK from RFA Downloads at the very bottom.
0 -
This crashes
static size_t s = 6000; // crashes with bigger size (???)
char* buff = new char[s];
string content(tMsg.PrintTib(buff, s));if I use s = 5000. It works fine. Could you check if there is a bug in PrintTib function?
0 -
Hello @igorg,
Personally, I doubt that there can be a bug in RFA in PrintTib, considering how old the API is, how widely used it was for many years, and how any issue, that could be found during the years of active support, was reported by clients and fixed by us.
Two things that I would do:
1. Make sure you are on the version of API 7.6.2, the only version that includes market data support (TibMsg) and is still currently supported by Refinitiv. This version also incorporates all the fixes to the issues reported prior to it.
2. Try printing your message to the output
msg.PrintTib(stdout);
to see, if you can detect, if something is wrong with the message itself.
Failing this, and if you are on 7.6.2 supported version, you, as a customer, have an option report a suspected issue with a supported version of an API via Refinitiv Helpdesk, choosing Product -> RFA C++, and have it investigated in detail.
0 -
1. Yes, we use 7.6.2. I can see version 7.6.2.1 on RFA7_Common140.dll file.
2. Print to the file works fine. Print to the buffer throws.
I will post this issue via Helpdesk and see what they say.
Thanks
0 -
Ok, I create new case with HelpDesk. They sent me to Developers portal.
0 -
I have tested your sample codes with our example RFASTTicker from 7.6.2.L1 package but still not found the issue.
I have modified MarketDataClient::processDataFromMarketDataEvent from Client.cpp to print the std::string created by your codes.
void MarketDataClient::processDataFromMarketDataEvent(const std::string& serviceName,
const std::string& subject,
const std::string& msgType,
const rfa::sessionLayer::MarketDataItemEvent & MDEvent)
{
TibMsg tMsg;
TibErr err;
_ASSERTE ( MDEvent.getBuffer().c_buf());
tMsg.UnPack( (char *) MDEvent.getBuffer().c_buf() ,MDEvent.getBuffer().size());
static size_t s = 6000; // crashes with bigger size (???)
char* buff = new char[s];
string content(tMsg.PrintTib(buff, s));
cout << "=================== processDataFromMarketDataEvent call tMsg.PrintTIb() =================" << endl;
cout << content.c_str() << endl;
//printTibMsg(serviceName,subject,msgType, tMsg );
}
And below is sample output from the RFASTTIcker when testing with currency RIC such as JPY=
=================== processDataFromMarketDataEvent call tMsg.PrintTIb() =================
PROD_PERM : INT 4 : 526 <0>
RDNDISPLAY : INT 4 : 153 <0>
DSPLY_NAME : STRING 16 : "DANSKE BANK COP"
TIMACT : STRING 5 : "03:43" <259>
NETCHNG_1 : REAL 8 : -0.53 <18>
HIGH_1 : REAL 8 : 108.62 <18>
LOW_1 : REAL 8 : 108.01 <18>
CURRENCY : STRING 3 : "392" <261>
ACTIV_DATE : STRING 11 : "03 JAN 2020" <258>
OPEN_PRC : REAL 8 : 108.55 <18>
HST_CLOSE : REAL 8 : 108.57 <18>
…
ASIA_CL_DT : STRING 11 : "02 JAN 2020" <258>
ASIA_CLOSE : REAL 8 : 108.77 <18>
ASIA_HI_TM : STRING 5 : "23:30" <259>
ASIA_HIGH : REAL 8 : 108.62 <18>
ASIA_LOW : REAL 8 : 108.01 <18>
ASIA_LW_TM : STRING 5 : "02:47" <259>
ASIA_NETCH : REAL 8 : -0.73 <18>
ASIA_OP_TM : STRING 5 : "22:00" <259>
ASIA_OPEN : REAL 8 : 108.55 <18>
EURO_CL_DT : STRING 11 : "02 JAN 2020" <258>
EURO_CLOSE : REAL 8 : 108.42 <18>
EURO_HI_TM : STRING 5 : "10:08" <259>
EURO_HIGH : REAL 8 : 108.86 <18>
EURO_LOW : REAL 8 : 108.22 <18>
EURO_LW_TM : STRING 5 : "15:48" <259>
EURO_NETCH : REAL 8 : -0.23 <18>
EURO_OP_TM : STRING 5 : "06:00" <259>
EURO_OPEN : REAL 8 : 108.73 <18>
US_CL_DT : STRI
=================== processDataFromMarketDataEvent call tMsg.PrintTIb() =================
BID : REAL 8 : 108.04 <18>
PRIMACT_1 : REAL 8 : 108.04 <18>
ASK : REAL 8 : 108.05 <18>
SEC_ACT_1 : REAL 8 : 108.05 <18>
VALUE_DT1 : STRING 11 : "03 JAN 2020" <258>
VALUE_TS1 : STRING 8 : "03:43:07" <260>
TIMACT : STRING 5 : "03:43" <259>
NETCHNG_1 : REAL 8 : -0.53 <18>
ACTIV_DATE : STRING 11 : "03 JAN 2020" <258>
ACVOL_1 : REAL 8 : 19767 <0>
PCTCHNG : REAL 8 : -0.49 <18>
BID_NET_CH : REAL 8 : -0.53 <18>
MID_PRICE : REAL 8 : 108.05 <18>
MID_NET_CH : REAL 8 : -0.53 <18>
NUM_BIDS : REAL 8 : 19767 <0>
CTBTR_1 : STRING 12 : "COMM BK KW "
CTB_LOC1 : STRING 3 : "KWI"
CTB_PAGE1 : STRING 4 : "CMBK"
QUOTIM : STRING 8 : "03:43:07" <260>
QUOTE_DATE : STRING 11 : "03 JAN 2020" <258>
QUOTIM_MS : REAL 8 : 13387105 <0>
BIDPCTCHNG : REAL 8 : -0.49 <18>
DSPLY_NAME : STRING 16 : "COMM BK KW KWI"
OFFCL_CODE : STRING 12 : "COMK "
BCKGRNDPAG : STRING 4 : "CMBK"
DLG_CODE1 : STRING 6 : "COMK "
VALUE_TS2 : STRING 8 : "03:43:05" <260>
VALUE_TS3 : STRING 8 : "03:43:05" <260>
ASIA_BNC : REAL 8 : -0.73 <18>
=================== processDataFromMarketDataEvent call tMsg.PrintTIb() =================
ASIA_NETCH : REAL 8 : -0.73 <18>
=================== processDataFromMarketDataEvent call tMsg.PrintTIb() =================
PCTCHG_3M : REAL 8 : 1.07 <18>
PCTCHG_6M : REAL 8 : 0.2 <18>
PCTCHG_MTD : REAL 8 : -0.75 <18>
PCTCHG_YTD : REAL 8 : -0.75 <18>
=================== processDataFromMarketDataEvent call tMsg.PrintTIb() =================
BID_NET_CH : REAL 8 : -0.53 <18>
IRGPRC : REAL 8 : -0.49 <18>
-Can you try the codes with our example RFASTTIcker and then compare the result with your app?
0 -
thanks for your response.
Unfortunately, it's not easy to run the sample code in our environment..
In any case, I've checked your code and it basically does the same what I do.
Could you check your sample with AMXL.MX or CEMEXCPO.MX? I did a couple more tests.. with buffer size equals to 5650 it works fine. With 5800 , it throws when I receive first msg with the snapshot.
0 -
Hello @igorg,
I think dynamically allocating memory in the callback, and then deallocating when you don't need it anymore, may be a better option, give it a try?
Same as @moragodkrit.chumsri_1, I have tested with RFASTTicker example ( am on win10, VS2019, shared lib)
In processDataFromMarketDataEvent I used almost the same code, tested IBM.N and AMXL.MX
tMsg.UnPack( (char *) MDEvent.getBuffer().c_buf() ,MDEvent.getBuffer().size());
cout << "=================== processDataFromMarketDataEvent before call tMsg.PrintTIb() =================" << endl;
static size_t s = 10000;
char* buff = (char *)malloc(sizeof(char) * (s + 1))
string content(tMsg.PrintTib(buff, s));
cout << "=================== processDataFromMarketDataEvent after call tMsg.PrintTIb() =================" << endl
cout << content.c_str() << endl;No issue with any buffer size, tested 5000, 6000, 10000.
No crush same as Moragodkrit, see the updates.
=================== processDataFromMarketDataEvent before call tMsg.PrintTIb() =================
=================== processDataFromMarketDataEvent after call tMsg.PrintTIb() =================
ASK : REAL 8 : 15.37 <19>
SEQNUM : REAL 8 : 7083217 <0>
QUOTIM_NS : REAL 8 : 70326 <0>
ASKSIZE : REAL 8 : 33866 <0>
SEQNUM_QT : REAL 8 : 7083217 <0>
NA_MSG_TYP : STRING 1 : "O"
SALTIM : STRING 8 : "19:32:06" <260>
ASK_TIM_NS : REAL 8 : 70326 <0>0 -
Hello @zoya.farberov, I'm not sure what you mean by dynamically allocating memory.
This is exactly what I do :
char* buff = new char[s]; - allocating
Printing...
delete[] buff; - deleting.
I just ran a couple more tests on LABB.MX. s = 6000 crashes, but s = 60000 does not. This happens on first message when it's big, around 10000+ characters.
Btw, we use lib to link with our app, not dll.
0 -
Hello @igorg
There may be differences, in environment, in custom app.
I suggested trying with malloc instead of char buffer init, with all/any sizes,
As this test worked for me and should be easy for you.
static size_t s = 10000;
char* buff = (char *)malloc(sizeof(char) * (s + 1))
string content(tMsg.PrintTib(buff, s));I have tested with RFASTTicker,
0 -
I would try with malloc ( no delete[]) and see if it removes the issue for you. Worked for me, but there may be various tricky factors.
If it does, then you can also try char buffer, with and without delete...
0 -
if I do not delete, it does not crash, but it leaks the memory. If I do delete, it crashes with some buffer sizes.
malloc requires 'free' , otherwise it will be memory leak again
0 -
or maybe in some cases you override null character of the buffer and my delete[] gets confused.
I will use different approach for the buffer and test it on Monday since the market is closed already.
Thanks
0 -
Hi @igorg,
Not sure how you are deleting, but think you may be right, this may be connected to how you are deleting.
I just tested freeing, right after print, for different sizes, 5000, 6000, 10000, prints as expected, observe no issues, perhaps you will find this useful:
cout << "=================== processDataFromMarketDataEvent before malloc tMsg.PrintTIb() =================" << end
static size_t s = 10000;
char* buff = (char *)malloc(sizeof(char) * (s + 1));
string content(tMsg.PrintTib(buff, s));
cout << content.c_str() << endl;
free(buff);
cout << "=================== processDataFromMarketDataEvent after free tMsg.PrintTIb() =================" << endl;0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 37 Alpha
- 167 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 705 Datastream
- 1.5K DSS
- 633 Eikon COM
- 5.2K Eikon Data APIs
- 14 Electronic Trading
- 1 Generic FIX
- 7 Local Bank Node API
- 6 Trading API
- 3K Elektron
- 1.5K EMA
- 259 ETA
- 569 WebSocket API
- 40 FX Venues
- 16 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 25 Messenger Bot
- 4 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 284 Open PermID
- 47 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 24 RDMS
- 2.2K Refinitiv Data Platform
- 879 Refinitiv Data Platform Libraries
- 5 LSEG Due Diligence
- 1 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
- 123 Open DACS
- 1.1K RFA
- 108 UPA
- 196 TREP Infrastructure
- 232 TRKD
- 919 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 103 Workspace SDK
- 11 Element Framework
- 5 Grid
- 19 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛