question

Upvotes
Accepted
0 0 0 0

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.

pythondsws-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

Upvote
Accepted
47.2k 109 44 60

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


1657070738090.png (26.6 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.

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