How can I return date with corresponding value when calling GetData with DSTimeSeriesDate using d...

...atastream .net api

How can I return date with corresponding value when calling GetData with DSTimeSeriesDate using datastream .net api

Here is an example

var datatype = "REBE#(X/FTSE100)-100";

var request = new DSDataRequest()

{

Instrument = new DSInstrument(identifier),

DataTypes = new DSDataTypes(datatype),

Date = new DSTimeSeriesDate(DSDateType.Literal("-2Y"), DSDateType.Literal(""), DSDateFrequency.Daily),

};

var response = DSClient.DataService.GetData(request);

double[] values = response[datatype][identifier].GetValue<double[]>();


How can I return collection of objects that gives date and its corresponding value

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @vishal.kak

    Dates can be accessed via response.Dates.

                double[] values = response[datatype]["U:IBM"].GetValue<double[]>();


                for (int i = 0;i < values.Length; i++){
                    Console.WriteLine("{0} \t {1}", response.Dates[i], values[i]);
                }

Answers

  • Alex Putkov.1
    Alex Putkov.1 ✭✭✭✭✭

    @vishal.kak

    If you were using Datastream Web Service WSDL, as described in DSWS Tutorial - Microsoft Visual Studio, the array of dates is provided by the Dates property of DSDataResponse class. However, you mentioned on this thread, that you're using ThomsonReuters.DswsApi.NET4.5.dll, which I'm not familiar with. I'm afraid before I can give you any advise, I need to understand what ThomsonReuters.DswsApi.NET4.5.dll is. Would you mind sharing where you got it from? I couldn't find any references to it internally or externally.