rdp.search with conditions

Hi everyone,

I would have a question about a search using Eikon API.
I am crating a peer group to analyze bonds. The code I am using now is:
GroupSize= 20
basestring = "DerivedCategory eq '" + currentInstrumentData['DerivedCategory'][
0] + "' and " + "OriginalIssueCurrency eq '" + currentInstrumentData['OriginalIssueCurrency'][
0] + "' and " \
+ "ParentIndustrySector eq '" + currentInstrumentData['ParentIndustrySector'][
0]
srchfields = "RIC,ISIN,SeniorityType,NativeIdentifier
peergroupData = rdp.search(view=rdp.SearchViews.GovCorpInstruments, filter=basestring, top=GroupSize,
select=srchfields)

being said that it works perfectly so far, sometimes I get peers with empty RIC or empty NativeIdentifier and this clock the rest of my code.
Is it possible tosearh fr peers using the forementioned method but excluding peers with empty RIC and NativeIdentifier during the search itself?

thank you

Best Answer

  • Hi @tanja.baccega

    You can add more condition to your search filter

    Here is the sample but you can add more condition to fit your needs:

    GroupSize= 5
    basestring = "DerivedCategory eq 'BOND' and OriginalIssueCurrency eq 'USD' and ParentIndustrySector eq 'BANKS' and RIC ne null and ISIN ne null"
    srchfields = "RIC,ISIN,SeniorityType,NativeIdentifier,DerivedCategory,OriginalIssueCurrency,ParentIndustrySector"
    peergroupData = rdp.search(view=rdp.SearchViews.GovCorpInstruments, filter=basestring, top=GroupSize, select=srchfields)
    peergroupData


    "RIC ne null" means "RIC field does not equal NULL value".

    image