How do I retrieve data type Y% for GDP in Datastream via Python?

Hi,

Consider the following RIC in Datastream Web Services: "aBRGDP/A". How may I obtain the data type that is displayed as "Y%" in the data browser? I tried:


ds = DatastreamDSWS.Datastream(...)
ds.get_data(tickers="<aBRGDP/A>", fields=["Y%"], kind=1)

However the above code returns an error. The RIC is correct because if I pass None for fields it returns the None value, which is the time series level value. I tried to pass the string as r"%Y" also with no avail.

Tagged:

Best Answer

  • Jirapongse
    Jirapongse admin
    Answer ✓

    @lmotta

    I checked and found that you need to use Datastream functions to retrieve percentage changes.

    Percentage change (PCH#) calculates the percentage change between values in a series.

    The code looks like this:

    ds.get_data(tickers="<aBRGDP/A>", fields=["PCH#(X,-1Y)"],
                freq="M",  
                kind=1, 
                start="2010-01-01", 
                end="2022-10-12")

    The output is:

    1657070738090.png

    However, you need to contact the Datastream support team directly via MyRefintiiv to confirm the function used to retrieve Y% values.

Answers

  • Thanks, I believe you are right, the Y%, etc. views on the web page are just transformations of the sort PCH(X,-Y).