For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 1 2

Is it possible to get macroeconomic indicators with an API?

I'm trying to automate some of our queries, which are mostly on indicators like GDP growth. I can get this data in Excel, as well as the stand-alone Eikon App, but because I am most familiar with Python, I would like to download it with Python. I found these as instruments in Data Item Browser, but did not finde any Data Items under them. Is there a way to request this data with the Python API? If not, which API can I use? TIA

eikoneikon-data-apipythonworkspaceworkspace-data-apirefinitiv-dataplatform-eikondata-item-browser
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.

Upvotes
Accepted
39.3k 76 11 27

You can use the same field names you use in =RtGet or =TR function in Excel. E.g. if you're using =TR("USGDPF=ECI","GN_TXT16_4") to retrieve the latest actual reported US GDP growth into Excel, you can use ek.get_data(['USGDPF=ECI'],['GN_TXT16_4']) in Python to retrieve the same data as a pandas dataframe.

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. This works great for the GDP stuf, but do you also know how I can get the instruments that start with an "a"? (e.g. 'aCNFRTRRAW'). I have not been able to get them, and the error is: "TSIUnknownInstrument". Thanks in advance, TDS

Upvotes
39.3k 76 11 27

Economic indicator RICs starting with a small 'a' are historical only RICs. There's no quote for these RICs on the real-time datastream, you can only retrieve timeseries for these instruments using get_timeseries method, which given the error message you received I figure is what you're already trying to do. There are two issues here. One is a bug in Eikon Python library, which results in incorrect handling of mixed case RICs (such as the ones starting with small 'a') when those RICs are provided to get_timeseries method as strings. This bug is the reason for the error message you received. The bug will be fixed in the production release of Eikon Python library. In the meantime the workaround is to always use list in the first argument of get_timeseries method. The second issue is that the default value for interval parameter of get_timeseries method is 'daily'. Most economic indicators are not updated on a daily basis and for most economic indicator RICs starting with small 'a' daily interval does not exist in the timeseries database. You need to make sure you use appropriate interval value for the RIC in get_timeseries method. Here's an example:
ek.get_timeseries(['aCNFRTRRAW'], interval='monthly')

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.