question

Upvotes
Accepted
5 1 2 3

"Latest Value" equivalent in DSWS REST/WCF?

When I run the following function in Excel Datastream AddIn, I receive a (correct) result of "N"

=DSGRID("BHP.AX","SOPRDP039","Latest Value","","","RowHeader=true;ColHeader=true;DispSeriesDescription=true;DispDatatypeDescription=true;Sym=RIC","")


However, when I run the equivalent request in python DatastreamDSWS:

r2 = ds.get_data(tickers='<BHP.AX>', fields=['SOPRDP039'], kind=0)

or, for that matter, the same thing in .Net DSWS:

DataRequest = new DSDataRequest() { Instrument = new DSInstrument() { Value = "A:BHPX" }, DataTypes = new[] { new DSDataType() { Value = "SOPRDP039" } }, Date = new DSDate() { Kind = DSDateKind.Snapshot } }

then I receive an (incorrect) result of "NA"


Can anyone help, I must be doing something wrong? How can I get the latest/snapshot value for BHP using the python/.net DSWS?

Also, I have tried kind=1, start="LATESTDATE", end="LATESTDATE", freq="D" in the python already but receive a '$$ER: 9898,NO DATA AVAILABLE' result..

Thanks

datastream-apidsws-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

1 Answer

Upvotes
Accepted
38.1k 71 35 53

@Pocari Sweat

Please try this one:

r2 = ds.get_data(tickers='<BHP.AX>', fields=['SOPRDP039'], start="LATESTDATE", kind=0)

The output is:

For .NET, the code looks like this.

            var request = new DSDataRequest()
            {
                Instrument = new DSInstrument("<BHP.AX>"),
                DataTypes = new DSDataTypes("SOPRDP039"),
                Date = new DSSnapshotDate(DSDateType.Literal(DSDateLiterals.LatestDate))
            };

1608258533625.png (12.5 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

This works, many thanks!

Click below to post an Idea Post Idea