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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 0 0

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-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpython
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.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 5.0 MiB each and 10.0 MiB total.

Upvotes
23k 22 9 14

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 5.0 MiB each and 10.0 MiB total.

Upvotes
23k 22 9 14

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 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea