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'})

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @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


Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @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

  • 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

  • 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

  • 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