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;

}

Best Answer

  • @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.

Answers