question

Upvotes
Accepted
18 1 4 10

How to retrieve MAV() result for a single date in DSWS API?

Hi.

Using the DatastreamDSWS Python API, I am trying to retrieve historical average daily value traded 5 days using formula: MAV#(X(VA)~USD,5D,C)

I wish to retrieve the value for date '2019-12-31' only but somehow I cannot get a valid value unless I also retrieve for '2019-12-30'. How do I just retrieve for '2019-12-31' without getting an error or NA value?

Example 1 (date range, OK):

get_data(tickers='<AAPL.OQ>', fields=['MAV#(X(VA)~USD,5D,C)'], start='2019-12-30', end='2019-12-31')

Result:

Instrument <AAPL.OQ>

Field MAV#(X(VA)~USD,5D,C)

Dates

2019-12-30 6940878.0

2019-12-31 7728726.6

Example 2 (date range start=end, got error):

get_data(tickers='<AAPL.OQ>', fields=['MAV#(X(VA)~USD,5D,C)'], start='2019-12-31', end='2019-12-31')

Result:

Instrument Datatype Value

0 <AAPL.OQ> MAV#(X(VA)~USD,5D,C) $$ER: 0904,NO DATA AVAILABLE

Example 3 (single date, got NA):
get_data(tickers='<AAPL.OQ>', fields=['MAV#(X(VA)~USD,5D,C)'], start='2019-12-31', kind=0)

Result:

Instrument Datatype Value

0 <AAPL.OQ> MAV#(X(VA)~USD,5D,C) NA

Appreciate your kind guidance. Thank you.

datastream-apidsws-api
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
18 1 4 10

To answer my own question, the option for MAV# should have been "R" instead of "C", ie.

MAV#(X(VA)~USD,5D,R)

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.

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.