Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • Eikon Data APIs /

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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

avatar image
Question by miriam.benito · May 28, 2019 at 06:35 AM · eikoneikon-data-apiworkspacepythonworkspace-data-apirefinitiv-dataplatform-eikonscreeningscreener

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

People who like this

0 Show 0
Comment
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

4 Replies

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by marcin.bunkowski · May 28, 2019 at 01:05 PM

Hi @miriam.benito

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


revenue.jpg (131.8 KiB)
Comment
Christiaan Meihsl
miriam.benito

People who like this

2 Show 1 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

avatar image
REFINITIV
Christiaan Meihsl ♦♦ · May 29, 2019 at 04:12 AM 0
Share

@marcin.bunkowski, I converted your comment to an answer, it is the best answer to this query :-)

avatar image
REFINITIV
Answer by Christiaan Meihsl · May 28, 2019 at 09:29 AM

@miriam.benito,

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.

Comment

People who like this

0 Show 2 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

avatar image
miriam.benito · May 28, 2019 at 12:01 PM 0
Share

Hi @Christiaan Meihsl,

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

avatar image
REFINITIV
Christiaan Meihsl ♦♦ miriam.benito · May 28, 2019 at 12:24 PM 0
Share

@miriam.benito,

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.

avatar image
Answer by miriam.benito · May 29, 2019 at 05:07 AM

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


captura-de-pantalla-2019-05-29-a-las-105917.png (226.0 KiB)
Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

avatar image
REFINITIV
Answer by Christiaan Meihsl · May 31, 2019 at 11:50 AM

@miriam.benito,

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

Comment
miriam.benito

People who like this

1 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

Watch this question

Add to watch list
Add to your watch list to receive emailed updates for this question. Too many emails? Change your settings >
9 People are following this question.

Related Questions

How to get all investors for a list of stocks, historically with the python API

Screener does not return all active/inactive Euronext Paris stocks

screener query in python with a large number of identifiers

Equity Screening on Ex Dividend Date with API

Can requests via the Screener be adjusted fo historic values?

  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Electronic Trading
    • Generic FIX
    • Local Bank Node API
    • Trading API
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • Intelligent Tagging
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open Calais
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • RDMS
  • Refinitiv Data Platform
    • Refinitiv Data Platform Libraries
  • Rose's Space
  • Screening
    • Qual-ID API
    • Screening Deployed
    • Screening Online
    • World-Check One
    • World-Check One Zero Footprint
  • Side by Side Integration API
  • TR Knowledge Graph
  • TREP APIs
    • CAT
    • DACS Station
    • Open DACS
    • RFA
    • UPA
  • TREP Infrastructure
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • Workspace SDK
    • Element Framework
    • Grid
  • World-Check Data File
  • 中文论坛
  • Explore
  • Tags
  • Questions
  • Badges