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 bm01 · Jan 21 at 07:38 PM · eikoneikon-data-apiworkspacepythonworkspace-data-apidatarefinitiv-data-platform-eikon

Filter companies based on a compound keyword in the Business Description, using the Eikon API

I learnt how do it with simple keywords (single word) following this article: https://developers.refinitiv.com/en/article-catalog/article/find-your-right-companies-with-screener-eikon-data-apis-python.


But there is an issue when the keyword is compound (spelled with two different words). I will give an example to illustrate the issue. Applying the filters in the lower left (note the compound keyword "laser solutions"), I find one company shown in the image:

screen-shot-2022-01-21-at-71355-pm.png

Now in order to get SCREENER syntax, I press the little arrow next to the green excel button and select "Export All as Formulas".


This gives the following formula:

=TR("SCREEN(U(IN(Private(OrgType(COM, UNK, MKP)))/*UNV:Private*/), IN(TR.HQCountryCode,""GB""), IN(TR.TRBCEconSectorCode,""56""), IN(TR.TRBCIndustryCode,""56101010""), Contains(TR.BusinessSummary,""laser solutions""), CURN=USD,TR.Organizati"&"onStatusCode=Act)","TR.CommonName;TR.HeadquartersCountry;TR.TRBCEconomicSector;TR.TRBCIndustry;TR.BusinessSummary","curn=USD RH=In CH=Fd")


Now, following the steps in https://developers.refinitiv.com/en/article-catalog/article/find-your-right-companies-with-screener-eikon-data-apis-python, I extract SCREENER syntax and format it in Python:

syntax = "SCREEN(U(IN(Private(OrgType(COM, UNK, MKP)))), IN(TR.HQCountryCode,""GB""), IN(TR.TRBCEconSectorCode,""56""), IN(TR.TRBCIndustryCode,""56101010""), Contains(TR.BusinessSummary,""laser solutions""), CURN=USD, TR.OrganizationStatusCode=Act)"
    
fields = ["TR.CommonName","TR.HeadquartersCountry","TR.TRBCEconomicSector","TR.TRBCIndustry","TR.BusinessSummary"]

df, e = ek.get_data(syntax, fields)

But the df I get is:

screen-shot-2022-01-21-at-72651-pm.png

If everything was fine, I should have gotten the same company I get when I use the Refinitiv desktop. I noticed that if instead of using the compound keyword "laser solutions", I use the simple keyword "laser", I find the right company, i.e. I get the same result in the desktop and in my jupyter notebook.


How can I filter using the API, based a compound keyword, and get the same result as with the desktop?

screen-shot-2022-01-21-at-72651-pm.png (44.8 KiB)

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.

3 Replies

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by nick.zincone · Jan 21 at 08:30 PM

Hi @bm01 ,

Try placing the embedded strings within your Screener expression as single quotes:

syntax = "SCREEN(U(IN(Private(OrgType(COM, UNK, MKP)))), IN(TR.HQCountryCode,'GB'), IN(TR.TRBCEconSectorCode,'56'), IN(TR.TRBCIndustryCode,'56101010'), Contains(TR.BusinessSummary,'laser solutions'), CURN=USD, TR.OrganizationStatusCode=Act)"
Comment
bm01

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.

avatar image
REFINITIV
Answer by zoya faberov · Jan 21 at 08:30 PM

Hello @bm01 ,

Try this:

syntax = "SCREEN(U(IN(Private(OrgType(COM, UNK, MKP)))), IN(TR.HQCountryCode,""GB""), IN(TR.TRBCEconSectorCode,""56""), IN(TR.TRBCIndustryCode,""56101010""), Contains(TR.BusinessSummary,""\"laser solutions\"""), CURN=USD, TR.OrganizationStatusCode=Act)"
    
fields = ["TR.CommonName","TR.HeadquartersCountry","TR.TRBCEconomicSector","TR.TRBCIndustry","TR.BusinessSummary"]
 
df, e = ek.get_data(syntax, fields)
df

from my testing, the result is:

escape.gif

not fully sure, the extra double-quote appears to help keep the expression together as it is passed from screen.




escape.gif (26.7 KiB)
Comment
bm01

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.

avatar image
Answer by bm01 · Jan 21 at 08:57 PM

Both solutions work! Thank you so much!

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.

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 >
11 People are following this question.

Related Questions

Total Returns and Price Returns over specific periods

How to Pull List of all output options for a TR field?

Which field should I use for Close Price? When will it be updated?

Download of Quarterly data for banks

Last Total Return value returned ad infinitum

  • 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