question

Upvotes
Accepted
25.3k 89 12 25

Eikon Desktop SDK IRealtimeUpdateDictionary – how to determine which Service the Update originates?

Hi all, I have subscribed to the same RIC code from two different services, how can I differentiate between them in my OnDataUpdated method from theIRealtimeUpdateDictionary variable ? Can’t see any kind of service qualifier in the InstrumentUpdates... Thanks!
eikoneikon-app-studio
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
25.3k 89 12 25
Hi Denis, Thanks for the reply - most useful. I am using a single IDataServices and multiple IRealtimeDataSubscription instances. Just to clarify when I said 'two different services' I meant two different service names / sources e.g. 'IDN_RDF' and 'IDN_DELAY'. Also, with regards the suggested solution I dont know if I was doing something wrong, but I seemed to get an occasional mismatch in the update handler between the passed in ric string and the contents of the IRealtimeDataSubscription, so I decided to ditch the ric string and just go with the following: private void OnDataUpdated( IRealtimeDataSubscription updateSub, IRealtimeUpdateDictionary update) //on data updated event { String qualRic = updateSub.Feed + "." + updateSub.Rics.First(); .... IRealtimeDataSubscription ricSub = null; ricSub = realtime.SetupDataSubscription(ricCode) // setup the subscription you want .WithFields(new[] { "BID", "ASK", "ACVOL_1" }) // add fields you want to subscribe to (without this line, the default is all) .WithFeed(selectedSvc) .OnDataUpdated(update => this.OnDataUpdated(ricSub, update)) .OnError(OnError) .CreateAndStart(); //create and start subscription The above appears to be working fine. Thanks and Regards, Umer
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
219 1 3 7
Hi Umer, I understand that you create multiple instances of IDataServices. For performance reason I recommend sharing the same IDataServices instance and launching different subscriptions on it. To answer your question: you can customize the callback signature using the convenient closure C# feature as shown below. In this example I pass RIC and subscription to the callback, this can be generalized to any variable you would like to see in your callback. private void Subscribe(string ric) { // Create and start a realtime subscription this.subscription = this.dataServices.Realtime.SetupDataSubscription(ric) .WithFields("ASK", "BID") .OnDataUpdated(update => this.MyCallback(ric, this.subscription, update)) .CreateAndStart(); } private void MyCallback(string ric, IRealtimeDataSubscription realtimeDataSubscription, IRealtimeUpdateDictionary update) { // Process data here }
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.