Global Directory
Global Directory
EXPLORE OUR SITES
London Stock Exchange Group
LSEG Data & Analytics
MyAccount
LSEG Perspectives
London Stock Exchange
FTSE Russell
LCH
Contact Us
Home
App Studio
Eikon Desktop SDK IRealtimeUpdateDictionary – how to determine which Service the Update originates?
umer.nalla
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!
Find more posts tagged with
eikon
eikon-app-studio
Accepted answers
umer.nalla
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
All comments
Denis Dollfus
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
}
umer.nalla
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
Quick Links
All Forums
Recent Questions
Terms of use
Privacy & Cookie Statement
Cookies settings
Do not sell my info
Whistleblowing
UK Bribery Act
Modern Slavery Act