DS Formula Data to be Obtained using Python API

Huma
Huma LSEG
edited 2:01AM in Datastream

I have few other formulas on excel, and I am not sure how can I get that data via python, if you could please help me with that too?

=@thomson .Reuters.AFOSpreadSheetFormulas.DSGRID("@:M3WRLD","A12MKC;AT0TOT;AT1TOT;AT2TOT;AT3TOT;AF0TOT;AF1TOT;AF2TOT;AF3TOT;AD0TOT;AD1TOT;AD2TOT;AD3TOT","Latest Value","","","RowHeader=true;ColHeader=true;DispSeriesDescription=true;DispDatatypeDescription=true","")

=@thomson .Reuters.AFOSpreadSheetFormulas.DSGRID("@:USMSCIP","A12MKC;AT0TOT;AT1TOT;AT2TOT;AT3TOT;AF0TOT;AF1TOT;AF2TOT;AF3TOT;AD0TOT;AD1TOT;AD2TOT;AD3TOT","Latest Value","","","RowHeader=true;ColHeader=true;DispSeriesDescription=true;DispDatatypeDescription=true","")

=@thomson.Reuters.AFOSpreadSheetFormulas.DSGRID("@:M1EROP","A12MKC;AT0TOT;AT1TOT;AT2TOT;AT3TOT;AF0TOT;AF1TOT;AF2TOT;AF3TOT;AD0TOT;AD1TOT;AD2TOT;AD3TOT","Latest Value","","","RowHeader=true;ColHeader=true;DispSeriesDescription=true;DispDatatypeDescription=true","")

Answers

  • The user can use the DatastreamPy module to get data in Python. See the python package https://pypi.org/project/DatastreamPy/

    The same DSGrid call can be used in the Python programming as well -

    =DSGRID("@:M3WRLD","A12MKC,AT0TOT,AT1TOT,AT2TOT,AT3TOT,AF0TOT,AF1TOT,AF2TOT,AF3TOT,AD0TOT,AD1TOT,AD2TOT,AD3TOT","Latest Value","","","RowHeader=true;ColHeader=true;DispSeriesDescription=true;DispDatatypeDescription=true")
    

    will become -

    >>> ds.get_data(tickers='@:M3WRLD', fields=['A12MKC','AT0TOT','AT1TOT','AT2TOT','AT3TOT','AF0TOT','AF1TOT','AF2TOT','AF3TOT','AD0TOT','AD1TOT','AD2TOT','AD3TOT\'], kind = 0)
               Instrument Datatype     Value Currency
    Dates
    2025-08-27   @:M3WRLD   A12MKC  86250530       U$
    2025-08-27   @:M3WRLD   AT0TOT   6601749       U$
    2025-08-27   @:M3WRLD   AT1TOT   6863093       U$
    2025-08-27   @:M3WRLD   AT2TOT   7581338       U$
    2025-08-27   @:M3WRLD   AT3TOT   8246969       U$
    2025-08-27   @:M3WRLD   AF0TOT   3877606       U$
    2025-08-27   @:M3WRLD   AF1TOT   4185019       U$
    2025-08-27   @:M3WRLD   AF2TOT   4721557       U$
    2025-08-27   @:M3WRLD   AF3TOT   5299865       U$
    2025-08-27   @:M3WRLD   AD0TOT   1467361       U$
    2025-08-27   @:M3WRLD   AD1TOT   1537136       U$
    2025-08-27   @:M3WRLD   AD2TOT   1662088       U$
    2025-08-27   @:M3WRLD   AD3TOT   1783168       U$
    >>>
    >
    
  • Huma
    Huma LSEG

    Hi Gurpreet,

    I wanted to understand how can I add other parameters in the request as

    RowHeaderDispSeriesDescription, DispDatatypeDescription, ColHeader