I am trying to retrieve LEI codes of issuing company from ISIN codes of open end funds.
The code works decently but there is a problem that should be addressed. There are companies for which there exists LEI code in Refinitiv but the code cannot retrieve it. In particular one should focus on the part:
fund_company = 'AXA Investment Managers Paris SA'
# get the PermID from name:
perm_id = rd.discovery.search(
view=rd.discovery.Views.SEARCH_ALL,
filter=f"CommonName eq '{fund_company}'",
select="PI"
)
# get the LEI code from PermID:
print(rd.get_data(perm_id['PI'][0], ['TR.LegalEntityIdentifier', 'TR.CommonName']))
creates this error:
Traceback (most recent call last):
File "/Users/francescofabirs/Library/Python/3.9/lib/python/site-packages/pandas/core/indexes/base.py", line 3802, in get_loc
return self._engine.get_loc(casted_key)
File "pandas/_libs/index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/index.pyx", line 165, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 5745, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 5753, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'PI'
However, if you input AXA Investment Managers Paris SA DIB manually into Workspace, you can find LEI code.