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

Sector average data for a specific stock

How to get sector average data for specific stock, e.g., find average P/E ratio for the sector that AAPL.O is in? Is there an example?

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

Hello @luyu

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?
If yes, please click the 'Accept' text next to the reply. This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question.

Thanks,
AHS

1 Answer

· Write an Answer
Upvotes
Accepted
4.6k 26 7 22

Yes, with the use of screening functions (for sector) or peer service (for peers). The following code gives you an average historic p/e for all companies in Apple Inc. sector, headquartered in US with market cap > $1B:

import eikon as tr

tr.set_app_id('your_app_id')
expression = 'SCREEN(U(IN(Equity(active,public,primary))), \
                IN(TR.GICSSectorCode,45), IN(TR.HQCountryCode,US), \
                TR.CompanyMarketCap>=1000000000, CURN=USD)'

df, e = tr.get_data([exp], ['TR.CompanyName','TR.HistPE'])
df.dropna()
df['Historic P/E'].mean()


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.