How can I extend the IBarData in foreach (IBarData bar in chunk.Records.ToBarRecords()) to access ot

I use NDA_RAW in my request and in the debugger I can see the records in the data chunk, but how can I access the individual keys in the dictionary?

            request = timeSeries.SetupDataRequest("ESc1")
.WithView("NDA_RAW")
.WithAllFields()
.WithInterval(CommonInterval.Daily)
.WithNumberOfPoints(10)
.OnDataReceived(DataReceivedCallback)
.CreateAndSend();

Best Answer

  • You cannot get IBarData from NDA_RAW view. Instead you need to iterate through the records in chunk.Records and for each record item use record.AllFields, which returns a dictionary of field names and values, e.g.

    foreach (IData record in chunk.Records)
    {
    foreach (string key in record.AllFields.Keys)
    {
    Console.WriteLine(key + " : " + record.AllFields[key]);
    }
    }

Answers