Retrieving market data at a snap time

Hi,

I need to save live RIC values at a very specific snap time. I've got a list of RICs on different feeds, I realized (am I right ?) that the best solution is to group these RICs by feed and setup a data request for each feed.

Here is the code I'm using: (repoDico is my RICs/Fields/Feeds Dictionary)

I'm using ThomsonReuters.Desktop.SDK.DataAccess.Realtime

List<string> feeds = repoDico.Values.Select(x => x.source).Distinct().ToList();
List<string> fields;
List<string> rics;

var realtime = services.Realtime;

for (int i = 0; i < feeds.Count; i++)
{
_currentFeed = feeds[i];

fields = repoDico.Values.Where(x => x.source == _currentFeed).Select(x => x.field).Distinct().ToList();
rics = repoDico.Values.Where(x => x.source == _currentFeed).Select(x => x.ric).Distinct().ToList();

realtime.SetupDataRequest()
.WithRics(rics)
.WithFields(fields)
.WithFeed((_currentFeed == "IDN") ? "" : _currentFeed)
.OnError(RealTimeDataError)
.OnDataReceived(DataReceivedChain)
.CreateAndSend();

PushFrame();
}

The issue I'm having is that whenever there is a 'bad' RIC, it blocks the process. I need a way that snaps the market data and if there's an error, well then the RIC will have no value. The other feeds need to be snapped at the same time.

Thanks for your help.

Best Answer

  • Alex Putkov.1
    Alex Putkov.1 ✭✭✭✭✭
    Answer ✓

    Hi @mohammedamrani,

    Yes, the best thing is to setup a separate request per feed.

    From the code snippets you included it seems to me that the problem you experience has nothing to do with invalid RICs. Invalid RICs will not be included in IRealtimeUpdateDictionary object passed to OnDataReceived event handler. In fact they will be completely ignored unless you handle OnStatusReceived event where you can see the status of individual RICs.

    It seems to me that the problem is that while you create a new DispatcherFrame for each request, you put them all into the same variable?

    For your process you might be better off without pushing DispatcherFrames altogether. Just call Dispatcher.Run once after creating IDataServices.

Answers