New user of Code Book inside Eikon API.
I want to start with LEI and find corpororate information like parent LEI and industry code.
Input: ZYBR0GI2DCOB4RV8NO37
Output industry group: debt fund
@NGurbuxani
Thank you for reaching out to us.
You can use the LEI with the get_data method in the LSEG Data Library for Python.
ld.get_data("ZYBR0GI2DCOB4RV8NO37@LEI","TR.Commonname")
The output is:
However, you need to contact the helpdesk team directly via MyAccount of the fields that can provide the required data.
Otherwise, you can use the Search API to search data for this LEI.
ld.discovery.search( view = ld.discovery.Views.ORGANISATIONS , top = 10, query = "ZYBR0GI2DCOB4RV8NO37", select = "DocumentTitle,ParentOrganisationName")
You can use the following code to list all fields in the search.Views.ORGANISATIONS view.
response = search.metadata.Definition( view = search.Views.ORGANISATIONS).get_data()response.data.df
I think this LEI is a private company so the data in the database is quite limited.
You can access the LD library examples on GitHub.
Thanks for explaining. I have the earlier version of this API (refinitiv-data). I was able to run above code, except for last cell. The last line gives strang results. I am looking for all fields (e.g., "TR.Commonname") that can be obtained.
import refinitiv.data as rd
rd.open_session()
df = rd.get_data(["ZYBR0GI2DCOB4RV8NO37@LEI", "5493004LZLCTSJUBPZ86@LEI"], "TR.Commonname")
rd.discovery.search(view=rd.discovery.Views.ORGANISATIONS, query="5493004LZLCTSJUBPZ86")
rd.discovery.search(view=rd.discovery.Views.ORGANISATIONS)
For the last line, please refer to the following example on GitHub. The code will get all available fields of the ORGANISATIONS view in the Search API.
For the TR.xxx fields used by the get_data method, you can use the Data Item Browser tool to search for fields.
Otherwise, you can contact the helpdesk team directly via MyAccount of the fields that can provide the required data.
This is my code.
from refinitiv.data.content import search
response = search.metadata.Definition(view=search.Views.ORGANISATIONS).get_data()
Now I can get field names from this object.
response.data.df.iloc[195:200]
gives these names: LegalNameZhHans, LegalNameZhHant, LEI, LipperID, LiquidityRIC
But these names do not return any values.
rd.get_data(["ZYBR0GI2DCOB4RV8NO37@LEI", "5493004LZLCTSJUBPZ86@LEI", 'MSFT.O'],
['TR.BusinessEntity', 'TR.Ebit', 'TR.ExpenseRatio', 'TR.Gics', 'TR.GicsCode',
'TR.GicsIndustryId', 'TR.HasESGContent', 'TR.IPDate', 'TR.IsPublic',
'TR.IssuerPrimaryRIC', 'TR.LEI', 'TR.LipperID',
'TR.Commonname'])
Above call returns a data frame with only four columns: Instrument, EBIT, Expense Ratio, Organization is Public Flag, Company Common Name. But we already know that LEI is available.
What is the correct way to input field names in function call rd.get_data()?
Thanks again,
Otherwise, you can contact the helpdesk support team directly via MyAccount to verify the content of those fields.