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.

1 Answer

· Write an Answer
Upvotes
Accepted
78.2k 246 52 72

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