question

Upvotes
Accepted
50 1 1 6

Eikon .NET API: Reinitialize connection

Hi,

I've developed a .NET application (Visual Basic) which retrieves live data from Eikon in order to support my portfolio tools and limit surveillance. The application itself works fine, however, after some hours (sometimes earlier, sometimes leater), my realtime requests start to return errors via the error callback function. The errors are mostly "timeout errors", however, I came accross different internal errors in the last few weeks.

When these error occur, the dataservice still shows that the connection is up. Restarting Eikon will not fix this problem. What i found out is that the API is hanging and will not come back at any time. The only way to fix it at the moment is to restart my application, but this is not what i want to do out of other reasons.

Out of this reason I need a way to reinitialize the dataservice. Here is how I start it.

        myReutersService = DataServices.Instance()
        myReutersService.Initialize("ReutersConnect")

If I try to set myReutersService to "nothing" (destroy it) or "dispose" it and to reassign the instance then, but this will lead to an error. I found that there is a reset function called "DataServices.Reset()" but I did not manage to get it working.

Could you please tell me how I can reinitialize the connection to get rid of these errors?

PS: This developers homepage is really a pain in the ass. Lots of CSS errors here in the forum (Firefox), the search window works only partly and I need to login every time I come here, as the cookie doesn't work or the timeout is way to short... Also, I had several erros when trying to send this post :-(

eikoneikon-com-apiconnectiontime-outeikon-.net-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.

20 Answers

Upvotes
Accepted
39.2k 75 11 27

Hi @inercomp,

I've had a chance to look at your project. As far as I can see every two seconds you create a snapshot request for the list of chains and their constituents. I cannot say I'm terribly surprised you run into weird issues. Eikon and the real time data distribution system that feeds Eikon with market data are not designed for this type of usage. They are designed to handle real-time data subscriptions and infrequent snapshot requests. Frequent snapshot requests are very taxing on the system. My recommendation is that you create real-time data subscriptions instead of real-time data requests, and you keep those subscriptions running as long as your application is running. If your ultimate goal is to produce two second snapshots of market data, you can implement in-proc cache for real-time data. You will then update the cache whenever market data updates are received. And you will grab your two second snapshots from the cache rather than directly from Eikon .NET SDK interfaces. Alternatively you may want to look into AdfinX Real-Time COM API to use it instead of Eikon .NET SDK. AdfinX Real-Time API implements in-proc cache for real-time data, which you can take advantage of instead of implementing your own cache. And it has ready available methods, which directly facilitate your use case. E.g. you can tell the COM object to start real-time data subscriptions and raise the event at 2 second frequency. From this event handler you can directly grab the data from in-memory cache provided by the object. This way you don't even need to implement your own timer. I hope this helps.

Alex

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.

Upvotes
39.2k 75 11 27

Hi @inercomp

You should be able to re-establish connection with Eikon without restarting your application. I've done it in a class library project by terminating the thread housing DataServices instance, recreating it on a new thread and initializing it. However if your project is a WinForms or a WPF application then the best practice is to house Eikon .NET SDK assemblies on the GUI thread. I personally haven't tried disposing DataServices and recreatnig it on the same thread, though a priori I don't see why it shouldn't work. What error messages are you getting?

I'm also rather puzzled that you experience the issue with the "API hanging" in the first place, as this is obviously not the expected behavior. I'm curious what exact errors do you see, and whether you could further elaborate on the behavior patterns you observed.

Finally, this portal is best accessed through Chrome or IE. I'm not sure if it's ever been tested with Firefox. It wouldn't surprise me if it never was.

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.

Upvotes
5 1 1 5

Hi,

I had the same issue from a WPF app. I reproduce it when you are retrieving some data and during that time you kill Eikon (to simulate a crash for example).

In that use case (not the , you get an exception when trying again to get the service by

DataServices.Instance.Realtime

I've tried also to do a reset / dispose but then it tells me that the instance is in dispose mode and you can't retrieve an instance.

I've implemented a restart for that and it works but it's definitely not the best way to do it.

If you have a better solution, do not hesitate to share the answer on the forum ;-)

Thanks

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.

Upvotes
39.2k 75 11 27

Hi @gerald,

After the shutdown of Eikon you can recover connectivity to Eikon by simply calling DataServices.Instance.Initialize. This is the same call you do when launching your application (probably in the constructor of the main control). I've just tried it in a WPF application and it worked for me. I called DataServices.Instance.Initialize after Eikon shutdown, which resulted in restart of Eikon, and I was able to recreate real-time data subscriptions.

Make sure you use the latest version (v1.8.4) of Eikon 4 Desktop Data API package available from NuGet.

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.

Upvotes
5 1 1 5

Thanks @Alex Putkov.

I'll give a try. The version I use is ThomsonReuters.Desktop.SDK.DataAccess.Signed.x64 v1.8.4.

I don't think the 64bits have any impact on this. If I can reproduce on a sample project I'll post the code.

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
50 1 1 6

Hi,

i am really desperate by now. I reworked my application in the last days and reduced the complexity, in order to be sure that I dont have any multithread issues (as i read that the API has Troubles with it)... Now the solution is much simpler, slower and less elegant, but I now have one class for the Eikon connection (including the establishment of the instance and all functions) which is called from a timer (by the way, it's a Windows Forms application and I am using the latest version of the x64 API from NuGet).

OK, so when Eikon is running, it pulls the realtime data for the contracts I want, for around an hour (sometimes more, sometimes less). The amount of contracts I pull is for a couple of chains, whic include some inactive contracts, so I fetch a couple of fields for around 600 contracts in total. What then happens is that I get an error callback from the realtime request (or the chain request) that simply states: "Request timed out". Sometimes my log file shows one of the following errors in between the timeout errors:

An error occured on communication layer during RawChainServiceProxyImpl.Subscribe() method invocation. Please see inner exception for Details.
Unable to resolve type: ThomsonReuters.Eikon.Ipc.IRawUdapService

It also happens that Eikon just pops up with saying "an error occured" (that's it). In this case i need to restart Eikon and the program to get it to work again.

It really sucks. I made the application back in January and it took me some days. I have spent way more time in debugging the reuters API in the meanwhile and still have no clue what's not working here.

If the datafeed has an error, I can not fix it programmatically. Sure, I can reinitialize the service, but this makes no difference. I tried to call DataServices.Reset() or DataServices.Dispose() before reinitializing, but all I get is an ObjectDisposedException (system tells me that I am trying to Access a disposed object when I try to initialize).

I don't understand why there is no possibility to reset the connection. Needless to say that restarting the application and Eikon is not an option for me. I want a working 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.

PS: Could you please get the cookie issue on this page fixed, so I dont need to re-login every 30 minutes here? Or am I the only one here having this issue? (the CSS flaws by the way really went away with Internet Explorer - which is also the reason for most of the typos here, is this program is trying to language correct the text here in German).

Upvotes
50 1 1 6

PS: When I get timeout errors from my application and I restart it, it now isn't able to give me a Service. I start the Connection the following way:

        myDataService = DataServices.Instance()
	myDataService.Initialize("ReutersConnect")

What is happening is that the IDataServices object tells me the following when looking at it:

Initialized = True
State = None

So, what to do in this situation besides restarting Eikon...

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.

Upvotes
50 1 1 6

@Alex Putkov Ok thats it. Literally spent the whole week to get this working, but it isn't. From what I saw so far I can tell the following: Eikon is open and I start the program - everything runs smooth for a while, then the API returns error callbacks saying that there was a timeout.

In 1/3 of the time when the timeout occurs also Eikon says that "a problem occured", the other 2/3 of the time it simply stops delivering data. There is usually no other error message than that.

The only fix for this is to restart Eikon AND the application, because the API says it is initalized but "state" is none. So the data conneciton is definitely gone.

I assume that the timeouts occure quicker, when I pull my normal amount of data (within 20-60 minutes) then, while less data keeps the connection alive longer (some hours). This is a gut feeling and is not 100% confirmed (but would also explain that I did not had that much trouble when developing the application, as I request only a few test contracts).

I need a solution for this now, dear developers. I am willing to share my Eikon connection with you (.NET Visual Basic) if this helps, but I absoultely cannot work with this API if it forces me to restart Eikon and the application every hour.

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.

Upvotes
39.2k 75 11 27

Hi @inercomp,

If you can post your project here, or better a trimmed down version of it, which you can still use to reproduce the issue, then I can try and see if I reproduce the same problem on my end.

It would also be helpful to enable real-time data logging in your Eikon to see if Eikon application experiences any problems with real-time data retrieval when the issue occurs.

Finally, since you obviously experience unexpected behavior, you can open a service case with Thomson Reuters support.

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.

Upvotes
50 1 1 6

@Alex Putkov

I made a stripped down version of my project that just has the basic function: pull data from Eikon and a textbox for logoutput. It's a Visual Studio project and you can direct-download it here:

http://ul.to/7c40tsqk

Please start it when Eikon is up and running. For me it worked fine for 2 hours or so, then the timeouts started to appear (you will see it in the logbox). Hope you can reproduce it (bug appears on different computers for me).

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.

Upvotes
50 1 1 6

Well, the timer is just set to a 2 seconds intervall, it waits for the job to finish. My aim was to receive data every 30 seconds in my program - however, you are right, in my stripped down version it fetches all the data and the restarts it, when its done (approx. all 10 seconds). But I get your point that the .NET API is not designed for that and even if I wnat to do it every 30 seconds it should be implement in another way. However, to be open - this is really annoying. If there would be a proper documentation, I would not have spent so much time into this API.

Nevertheless, I followed your advice and and started to work with the COM API, but I directly ran into some unexpected errors, which were connected to multithreading (it turned out that I cannot initialize from a another thread, from which I started the subscription - found the answer in the forum). Ok, I know that now.

But I still do not manage to receive data and I am more or less in the dark with a lot of things. There is barely a documentation besides the tutorial. For example, AdxRtList requires a so called "source" - I have no idea what this is and no idea whereI should find this informaiotn (just as an example)... This is really frustrating.

However, I am pretty sure that I have not understood how to transform the C# event handler code into Visual Basic. Could you give me

1.) a short explanation what I need to do so that the Update function is addresses

2.) how you would implement my use case (you said I should raise an event to grab the data every X seconds - but which event? OnImage? OnTime? As above, I have no clue what these events are even for and I have no clue where I shall find this information)...

    Public Sub GetRealtimeData()

        myLiveRequest = myDataService.CreateAdxRtList()
        myLiveRequest.Source = "IDN"
        myLiveRequest.RegisterItems("GBP=", "BID")
        myLiveRequest.StartUpdates(RT_RunMode.RT_MODE_ONUPDATE)

    End Sub

    Friend WithEvents AdxRtListHandler As AdxRtList

    Public Shared Sub RealtimeUpdate(strItemName As String, unkUsertag As Object, myStatus As RT_ItemStatus) Handles AdxRtListHandler.OnUpdate
        Debug.Print("Data received")
    End Sub
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.

Upvotes
39.2k 75 11 27

Hi @inercomp,

I'm afraid I don't get what you're asking in question #1. Would you care to rephrase?

As for your second question, here's a quick take on what you need to do. And attached is a comprehensive VB.NET example showcasing all the capabilities available in AdxRtList object. You may need to reestablish references to two COM Interop libraries before compiling this example.

    Public Sub GetRealtimeData()
        myLiveRequest = myDataService.CreateAdxRtList()
        myLiveRequest.Source = "IDN"
        myLiveRequest.RegisterItems("GBP=", "BID")
	myLiveRequest.Mode = "FRQ:3S" ' Update frequency once every 3 seconds
        myLiveRequest.StartUpdates(RT_RunMode.RT_MODE_ONTIME)
    End Sub

    Private Sub myLiveRequest_OnTime()
	Debug.Print(myLiveRequest.Value("GBP=","BID"))
    End Sub

list.zip (18.7 KiB)
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.

Upvotes
50 1 1 6

Thanks Alex, that VB.NET example will help a lot.. I'll try to recode my application. But before I do that, just to be sure: The Adfin API will also allow me to retrieve historical data (i need to retrieve daily settlement prices for some contracts) and to resolve RICs - right?

My initial question which was about the "IDN" value set in the "source" property. What is this for?

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.

Upvotes
39.2k 75 11 27

For daily price history I suggest you stick with .NET SDK. I'm not sure what you mean by "to resolve RICs". Would you care to elaborate or rephrase?

The Source property in AdxRtList object is the equivalent of the Feed property of IRealtimeDataRequest interface of Eikon .NET SDK, which you're already familiar with. It specifies the source name on Thomson Reuters Enterprise Platform for Real-Time Data (TREP). Since I gather you do not have TREP deployed locally, the only source name available to you is the one for Thomson Reuters market data feed, which in AdxRtList object is aliased as "IDN". You can hardcode this value for the Source property of AdxRtList object in your application.

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.

Upvotes
50 1 1 6

Sorry, I actually meant to resolve chains (getting contracts from a chain)...

I played around with the .COM API a bit today and it looks fine. However, when I close Eikon during runtime and reopen it, the API just shows "disconnect" until I restart my program... If I try to run .initialize() again it doesnt help either. So, how can I reconnect with this 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.

Upvotes
39.2k 75 11 27

Yes, you can retrieve chains using AdfinX Real-Time library. AdxRtChain object serves this purpose. Unfortunately closing Eikon creates a terminal state for applications using Eikon COM APIs. The only way to recover from this state is to restart the application process. This is indeed very unfortunate, but there are no plans to address this deficiency.

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
50 1 1 6

Well, that's really really bad... If the COM API drops when Eikon shuts down and it cannnot come back this AdfinX API is more or less useless to develop a stable application. I dont want to restart my application (which does other things as well) just in order to get an API connection (in fact, the reestablishment of the connection was the issue why I opend a forum thread here). This is such a horrible limitation, it should be pointed out in the description page in the first paragraph, so that people dont waste time in this API.

I myself went back to the SDK now and built an own cache for the data based on subscriptions. Hope this will work.

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.

Well, by now you should have realized that the Eikon API development team is suffering from some serious .Net skill deficiencies. I have been trying to get the newer Eikon .Net API working for months (please see multiple threads and posts where I documented multiple serious errors and shortcomings in the APIs), nothing worked properly and correctly. Many threading issues, initialization problems, similar to what you are describing. The older COM API is even worse. The new Web API does not seem to support .Net/C# usage, I was flatout denied any pointers to how I can use the Web API in C#. Sigh

Upvote
50 1 1 6

OK, subscriptions are working now with a own built cache, so this topic can be closed. Nevertheless I would like to mention that it would be really helpful if such general information about the APIs (what is it designed for, do's and don'ts, can the library reconnect etc.) would be available, instead of just saying "The libraries in the SDK are self documented". Would have saved me lots of time...

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.

Upvotes
31 0 0 1

@inercomp, we could work around this limitation by creating the API objects into separate AppDomains. When Eikon connection drops, we unload the current appdomain and create a new one. By doing this we are able to call .Initialize() multiple times without having to restart our application.

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.

Upvotes
50 1 1 6

Thanks a lot @IT, I'll immediately try make this work... Suffering from this issue for months now and never found a solution, glad you did. Thank you so much for sharing.

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.

Click below to post an Idea Post Idea