Upgrade from Eikon -> Workspace. Learn about programming differences.

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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 1 1

How can I obtain the information of TR.HeadquartersCountry companies in a specific country in Python

Hi,

I want to pull the data for the companies of specific exchange of a country. But I couldn't put the python code of the "Country of Headquarters" (Data Item Name), "TR.HeadquartersCountry" (Data Item Code) into my work.


ex:

esg=[

'TR.CompanyName',

'TR.TRESGResourceUseScore(Period=FY0)',

'TR.TRESGEmissionsScore(Period=FY0)']

result, err= ek.get_data('0#.FTSE', fields=esg)


How can I change the .FTSE with "TR.HeadquartersCountry". I don't want to see the companies in FTSE but I prefer to see "the companies that Country of Headquarters is UK".

Thanks



eikoneikon-data-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-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.

Upvotes
Accepted
41 0 0 0

Hi @ramazan.aslan

You could screen for companies in the FTSE 100 that are headquartered in the UK:

screen = 'SCREEN(U(IN(indices(4932935/*FTSE 100*/))),IN(TR.HQCountryCode,"GB"))'

fields = ["TR.CommonName","TR.TRESGResourceUseScore(Period=FY0)","TR.TRESGEmissionsScore(Period=FY0)"]

df, e = ek.get_data(screen,fields)

1631624488091.png



1631624488091.png (43.4 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.

Upvotes
32.2k 40 11 19

Hello @ramazan.aslan,

Using screener expression, with get_data call, should yield the required result. I think you will find the article Find Your Right Companies with SCREENER | Eikon Data APIs(Python) very informative on how to define and use the screeners?

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
32.2k 40 11 19

Additionally, if you prefer using CodeBook in Eikon, the examples with CodeBook include a Screener use example, please find it:

screenerexamplecodebook.gif



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.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.