question

Upvotes
Accepted
1 0 0 2

DSWS Average Function

I am using Datastream and want to know how convert a call from Excel to DSWS API

The Excel formula is
=@DSGRID("K:TCNT","AVG#(X(MV),-6M,)","Latest Value","","","RowHeader=true;ColHeader=true;DispSeriesDescription=true;DispDatatypeDescription=true")
It will calculate the average Market Cap of a stock over the previous 6 months.

I have tried various ways to replicate the same in DSWS but not successful. Please help.

dsws-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.

hi @Alan Tam

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?
If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.

Thanks,
AHS

@Alan Tam

Hi,

Please be informed that a reply has been verified as correct in answering the question, and marked as such.

Thanks,

AHS

1 Answer

· Write an Answer
Upvotes
Accepted
79.2k 251 52 74

@Alan Tam

Please try this one:

ds.get_data(tickers='K:TCNT', fields=['AVG#(X(MV),-6M,)'], start="LATESTDATE", kind=0)

1638348001011.png


1638348001011.png (23.8 KiB)
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.