question

Upvotes
Accepted
45 4 3 9

Can you pass a variable for DSDateFrequency

Hi,

I'm using the .net API for DSWS

I want to retrieve the last available value and date from a time series for a date range.

Is it possible to pass in a variable for DSDateFrequency ?



DSDataRequest reqDSRequest = new DSDataRequest()

{

Instrument = new DSInstrument("VOD"),

DataTypes = new DSDataTypes("P"),

Date = new DSTimeSeriesDate(DSDateType.Absolute("01/01/2020"), DSDateType.Absolute("31/12/2022"), DSDateFrequency.Quarterly;

}

#technologydsws-apic#
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.

1 Answer

· Write an Answer
Upvotes
Accepted
79.1k 250 52 74

@fergal.twomey

Thanks for reaching out to us.

Yes, you can set DSDateFrequency into a variable. The code looks like this:

var freq = DSDateFrequency.Quarterly;

DSDataRequest reqDSRequest = new DSDataRequest(){
    Instrument = new DSInstrument("VOD"),
    DataTypes = new DSDataTypes("P"),
    Date = new DSTimeSeriesDate(DSDateType.Absolute(new DateTime(2020, 1,1)), DSDateType.Absolute(new DateTime(2022, 12, 31)), freq)
            };

I created the freq variable for the DSDateFrequency enumeration. You can change it to other frequencies.

namespace Datastream.DswsApi
{   
    public enum DSDateFrequency
    {        
        None = 0,      
        Daily = 1,      
        Monthly = 2,     
        Weekly = 3,      
        Quarterly = 4,       
        Yearly = 5
    }
}

I hope that this information is of help.

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.

thank you

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.