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?
Resolver not registered: react.asset.discussionTagsAsset
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 trtr.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()
Permission Problem You need the session.valid permission to do that.