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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
16 1 1 1

it is possible to use the get_data() function to retrieve a list of all bank LEI codes ?

Hello Eikon,

I was wondering if it is possible to use the get_data() function to retrieve a list of all bank LEI codes. Thank you. I have tried this code (below) but but it does not work ....


banks,err = ek.get_data('TR.LegalEntityIdentifier',{'TR.LegalEntityIdentifier':'All','TR.CompanyIndustry':'Banking'})

#technologypython api#content
icon clock
10 |1500

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

Upvote
55.7k 144 45 65

@mohammed.mroweh

Thanks for reaching out to us.

You can try the screener.

screener_exp = 'SCREEN(U(IN(Equity(active,public,primary))), IN(TR.RegCountryCode,"US"), IN(TR.GICSIndustryCode,"401010"), DOES_NOT_CONTAIN(TR.LegalEntityIdentifier,"NA"), CURN=USD)'
companies_data, err = ek.get_data(
    instruments=[screener_exp], 
    fields=['TR.CommonName','TR.RegistrationCountry','TR.GICSIndustry','TR.LegalEntityIdentifier']
)
companies_data

The formula above gets the LEI of public banks in the US.

The output is:

1674533650053.png

You can use the Screener app in Eikon Excel to get create filters that match your requirement.

1674533741023.png


1674533650053.png (24.5 KiB)
1674533741023.png (145.0 KiB)
icon clock
10 |1500

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

Upvotes
16 1 1 1

Thank you very much, but with screener : is it possible to provide with a list of all entities that have an LEI (Legal Entity Identifier) regardless of whether they have a RIC (Reuters Instrument Code)?


For example, this bank (screen below) no has RIC but has a LEI, indeed with Screener i can't see this couterparty :

1674580987344.png


1674580987344.png (90.4 KiB)
icon clock
10 |1500

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

Hi @mohammed.mroweh

If you need specifically use the LEI code as an input you can do it like this:

df, err = ek.get_data(['969500EVOBAGHKZEXA33@lei'], ['TR.CommonName'])
df
Upvotes
13.7k 61 39 63

Hi @mohammed.mroweh

Alternatively, you can try using the Search API defined within the Refinitiv Data Library for Python. For example:

import refinitiv.data as rd
from refinitiv.data.content import search

...

response=search.Definition(
    view=search.Views.SEARCH_ALL,
    filter="RCSTRBCLeaf xeq 'Banks' and RCSFilingCountryLeaf eq 'United States' and LEI ne null",
    select ="DocumentTitle, LEI, RCSTRBCLeaf, PrimaryRIC",
    top = 10000
).get_data()
response.data.df

Here is a snapshot of part of this output (include NA values for RIC):

ahs.png


ahs.png (132.1 KiB)
icon clock
10 |1500

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

Upvotes
55.7k 144 45 65

@mohammed.mroweh

Yes, you can by changing the universe to public and private companies and using the TR.TRBCIndustryCode instead.

The code looks like this:

screener_exp = 'SCREEN(U(IN(Equity(active,public,private,primary))), IN(TR.RegCountryCode,"FR"), IN(TR.TRBCIndustryCode,"55101010"), DOES_NOT_CONTAIN(TR.LegalEntityIdentifier,"NA"), CURN=USD)'
companies_data, err = ek.get_data(
    instruments=[screener_exp], 
    fields=['TR.CommonName','TR.RegistrationCountry','TR.GICSIndustry','TR.LegalEntityIdentifier']
)
companies_data.loc[companies_data['Instrument'] == '5000037141']

This code lists all public and private banks in France. The output is:

1674615841900.png



1674615841900.png (68.9 KiB)
icon clock
10 |1500

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