question

Upvotes
Accepted
21 0 1 4

How can I use the com(VBA) API in batch(non-callback) query mode?

hello,

i'm trying to do batch queries for a lost of list tickers in non-interative non-callback mode. i care about performance very much and have to work within vba.

i have not found any example on how to do this. all documentation and samples are showing callback interactive mode.

Please help me asap.

thanks,

jude jin

eikoneikon-com-api
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.

Upvote
Accepted
39.2k 75 11 27

Hi @jude.x.jin,

I don't believe I offered to produce an example of synchronous behavior. I can of course do it, however my job is to advocate best practices in the use of Thomson Reuters APIs. It is best practice to use the APIs as designed. If the API is asynchronous, it is best practice to use it asynchronously. Tricking an asynchronous API into producing synchronous behavior is a back door, which is only to be considered when the front door doesn't work. The use case you specified is trivial and can be easily implemented asynchronously. See attached example, which retrieves closing prices for 2,549 stocks (current constituents of Nasdaq Composite index). On my end it takes 5-6 seconds to retrieve the entire list, though the actual retrieval times will vary depending on a number of factors. Still the retrieval time on your end should be in the same order of magnitude as it is for me.

adxrtlistsnapshot.zip


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.

hello, alex.

this relies on application.enableevents being set to true...

i cannot rely on this being true.

then how can i do this efficiently?

thank you very much,

jude jin

It does not. The value of Application.EnableEvents has no effect on ActiveX controls, user forms, COM objects etc. Try it. Set it to False and see that the example still retrieves the data.

Upvotes
39.2k 75 11 27

Hi @jude.x.jin

I suppose by "batch queries" you mean synchronous data retrieval, right? All Eikon COM APIs are asynchronous, which means that your data handling must be in the callback procedure for the event notifying the application that data has been retrieved. It is possible to trick some of Eikon COM APIs into producing seemingly synchronous behavior by sitting in the loop and checking data status until data status indicated that the data is ready. But I would not recommend this, especially since you're concerned about performance. The API is designed to produce asynchronous data retrieval and this is how it should be used. There's absolutely nothing you can do with synchronous retrieval that you cannot do with asynchronous. If you have a specific use case that you're struggling to implement using asynchronous retrieval, feel free to specify it here, and I'll be happy to produce an example of how whatever you need to do can be achieved. Or if you meant something else by "batch queries", then please elaborate on what you meant.

Best regards,

Alex Putkov

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.

hello, alex.

can you show me an example of "synchronous" behavior that retrieve HST_CLOSE of 1000 tickers in under 5 seconds or a little over? i need this asap. your competitor can do this very easily.

thank you.

jude jin

I concur with OP. Would you please provide an example how a flash quote of all nasdaq constituents can be retrieved within 5 seconds. And the developers talk about best practices. How about getting rid of using Windows pumps in their API, something that is driving me absolutely crazy because it simply does not belong in there. It causes huge issues when making requests from non UI and different threads. It is absolutely frustrating to work with the Eikon .Net API. Bloomberg does not use Windows message pumps, nor any of Reuters' competitors

Click below to post an Idea Post Idea