Screener sort and top results

Hi all,
Is there any way to extract the top10 companies by Revenue in a specific TRBC activity using the screen expression in the Eikon API?
I mean, to the following query:
exp = 'SCREEN(U(IN(Equity(active, public, private, primary))),IN(TR.TRBCActivityCode,"5430102012"),CURN=USD)'
companies_data, err = ek.get_data(instruments=[exp], fields=['TR.Orgidcode','TR.CompanyName', {'TR.Revenue':{'params':{'Period': 'FY2016', 'Curn':'USD'}}}]
I only want to see the top10. Anyway, I think that Eikon can only return some x values.
Thanks in advance,
Miriam
Best Answer
-
You can include top 10 criteria directly in your screener expression
exp = 'SCREEN(U(IN(Equity(active, public, primary))),IN(TR.TRBCActivityCode,"5430102012"),TOP(TR.Revenue(FY2016), 10, nnumber),CURN=USD)'
companies_data, err = ek.get_data(instruments=[exp], fields=['TR.Orgidcode','TR.CompanyName', {'TR.Revenue':{'params':{'Period': 'FY2016', 'Curn':'USD'}}}])
companies_data.sort_values(by=['Revenue'],ascending=False)I have done it only for public companies, the separate can be done for private ones.
This is how you can do it in in SCREENER
0
Answers
-
I do not know if there is a way to easily limit the result set to 10, I searched but could not find it. But there is a way to sort the results by revenue, using 'sort_dir':'desc'. This results in >76k results. A trivial solution to display only 10 results is to use head(10):
exp = 'SCREEN(U(IN(Equity(active, public, private, primary))),IN(TR.TRBCActivityCode,"5430102012"),CURN=USD)'
companies_data, err = ek.get_data(instruments=[exp], fields=['TR.Orgidcode','TR.CompanyName', {'TR.Revenue':{'params':{'Period': 'FY2016', 'Curn':'USD'}, 'sort_dir':'desc'}}])
companies_data.head(10)Hope this helps a bit.
0 -
Thanks for the help but if I run your code I have the error...:
EikonError: Error code 400 | Backend error. 400 Bad Request
I suppose that it is due to the Eikon limit per time.
I do not know if there is one way to sort the companies and only ask for top 10 ...
0 -
A 400 is returned when the platform is overwhelmed. Not really surprising since there are >76k results.
I do not believe it is possible to limit the result set to only 10 directly, because the query is done in 2 steps:
- the screener returns 76k instruments, based on your criteria,
- these instruments serve as input to get_data, which retrieves the revenue for all input instruments.
You might want to narrow down your screening criteria, if possible.
An alternative could be to split the screener result set into several smaller ones, and submit several get_data requests for the smaller instrument lists. After that you could combine the individual result sets to analyze them. More cumbersome, but less heavy.
0 -
@marcin.bunkowski, I converted your comment to an answer, it is the best answer to this query :-)
0 -
Hi @marcin.bunkowski and @Christiaan Meihsl
Thanks both for the help!!!
It works for public companies but I cannot get it right for private companies. I mean, for example Mercadona is not an equity and I want companies.
If I look for the formula in Eikon Excel there is no 'TOP' filter and when I write the formula in EIKON Python I get an error:
exp ="SCREEN(U(IN(Private(OrgType(COM, UNK, MKP)))/*UNV:Private*/), IN(TR.TRBCActivityCode,""5430102012""), BETWEEN(TR.PCTotRevenueFromBizActv(Period=FY2016), 0.00, 100.00), CURN=USD)"
companies_data, err = ek.get_data(instruments=[exp], fields=['TR.CommonName'])EikonError: Error code 400 | Backend error. 400 Bad Request
Thanks in advance,
Miriam
0 -
You might want to try this (thanks go to @marcin.bunkowski for help on this):
exp ="SCREEN(U(IN(Private(OrgType(COM,UNK,MKP)))/*UNV:Private*/), IN(TR.TRBCActivityCode,""5430102012""), TOP(TR.PCTotRevenueFromBizActv(Period=FY2016),10,nnumber), CURN=USD)"
companies_data, err = ek.get_data(instruments=[exp], fields=['TR.PCTotRevenueFromBizActv','TR.CommonName'])
companies_data.sort_values(by=['Total Revenue (Pvt)'], ascending=False)Hope this helps
0
Categories
- All Categories
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 33 Data Model Discovery
- 682 Datastream
- 1.4K DSS
- 613 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 248 ETA
- 552 WebSocket API
- 37 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.8K Refinitiv Data Platform
- 622 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 26 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 191 TREP Infrastructure
- 228 TRKD
- 915 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 84 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛