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.

Tagged:

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @Alan Tam

    Please try this one:

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

    1638348001011.png