question

Upvotes
1 0 0 1

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 5.0 MiB each and 10.0 MiB total.

1 Answer

Upvotes
38.1k 71 35 53

@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 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea