Skip to main content

Python wraper for Legal Entity Identification API and ISIN to LEI and vice versa conversion.

Project description

python-lei

codecov black Python LEI pypi Version

This project is wraper for Leilex, legal entity identifier API. Includes ISIN-LEI conversion. Search LEI number using company name.

Dependencies

  1. Python >= 3.4
  2. requests
  3. dateutils
  4. pandas

Usage

After installing the module, first step is to download the data for ISIN and LEI mappings

>>> from python_lei.utils import Download

>>> Download()

This will download latest ISIN LEI mappings into resources directory. This is only necessary if you want to use ISIN LEI conversion.

Get LEI information

>>> from python_lei.pylei import pyLEI

>>> getinfo = pyLEI()

>>> raw_output, lei_results, dataframe = getinfo.get_lei_info(["A23RUXWKASG834LTMK28"], return_dataframe=True)

>>> print(raw_output)

[{'total_record_count': 1,
  'page_number': 1,
  'page_size': 100,
  'total_pages': 1,
  'has_more': False,
  'records': [{'LEI': 'A23RUXWKASG834LTMK28',
    'LegalName': 'AUTOLIV, INC.',
    'LegalJurisdiction': 'US-DE',
    'LegalForm': 'XTIQ',
    'OtherLegalForm': '',
    'EntityStatus': 'ACTIVE',
    'EntityExpirationDate': None,
    'EntityExpirationReason': '',
    'SuccessorEntity': '',
    'InitialRegistrationDate': '2012-06-06T03:52:00.000 +00:00',
    'LastUpdateDate': '2019-12-18T03:32:00.000 +00:00',
    'RegistrationStatus': 'ISSUED',
    'NextRenewalDate': '2020-12-15T10:15:00.000 +00:00',
    'ManagingLOU': 'EVK05KS7XY1DEII3R011',
    'ValidationSources': 'FULLY_CORROBORATED',
    'AssociatedLEI': '',
    'AssociatedEntityName': '',
    'AssociatedEntityType': '',
    'RegistrationAuthorityID': 'RA000602                                ',
    'OtherRegistrationAuthorityID': '',
    'RegistrationAuthorityEntityID': '2155072',
    'EntityCategory': '',
    'Addresses': [{'Line1': 'Box 70381',
      'Line2': '',
      'Line3': '',
      'Line4': '',
      'City': 'Stockholm',
      'Region': 'SE-AB',
      'Country': 'SE',
      'PostalCode': '107 24',
      'OtherType': '',
      'AddressType': 'HEADQUARTERS_ADDRESS'},
     {'Line1': 'C/O THE CORPORATION TRUST COMPANY',
      'Line2': 'CORPORATION TRUST CENTER 1209 ORANGE ST',
      'Line3': '',
      'Line4': '',
      'City': 'WILMINGTON',
      'Region': 'US-DE',
      'Country': 'US',
      'PostalCode': '19801',
      'OtherType': '',
      'AddressType': 'LEGAL_ADDRESS'}],
    'OtherNames': [],
    'ValidationAuthorities': [{'ValidationAuthorityID': 'RA000602',
      'OtherValidationAuthorityID': '',
      'ValidationAuthorityEntityID': '2155072'}],
    'Relationships': [],
    'ReportingExceptions': [{'LEI': 'A23RUXWKASG834LTMK28',
      'ExceptionCategory': 'DIRECT_ACCOUNTING_CONSOLIDATION_PARENT',
      'ExceptionReasons': [{'Reason': 'NON_CONSOLIDATING'}],
      'ExceptionReferences': []},
     {'LEI': 'A23RUXWKASG834LTMK28',
      'ExceptionCategory': 'ULTIMATE_ACCOUNTING_CONSOLIDATION_PARENT',
      'ExceptionReasons': [{'Reason': 'NON_CONSOLIDATING'}],
      'ExceptionReferences': []}]}]}]


# Class based retrieval
>>> print(lei_results.lei_names)
['AUTOLIV, INC.']

>>> print(lei_results.lei_list)
['A23RUXWKASG834LTMK28']

# Dataframe
>>> print(dataframe[["LEI", "Legal_Name"]])
|    | LEI                  | Legal_Name    |
|---:|:---------------------|:--------------|
|  0 | A23RUXWKASG834LTMK28 | AUTOLIV, INC. |

Get LEI-ISIN information

# LEI TO ISIN
>>> from python_lei.isin_lei import ISINtoLEI, LEItoISIN

>>> lei_to_isin = LEItoISIN()

>>> isin_list, dataframe = lei_to_isin.get_isin("A23RUXWKASG834LTMK28", return_dataframe=True)

>>> print(isin_list)
['SE0000382335',
 'US052800AB59',
 'US0528002084',
 'US0528003074',
 'US0528001094',
 'US0528001177']

>>> print(dataframe)
|         | LEI                  | ISIN         |
|--------:|:---------------------|:-------------|
| 1858574 | A23RUXWKASG834LTMK28 | SE0000382335 |
| 2141681 | A23RUXWKASG834LTMK28 | US052800AB59 |
| 2990824 | A23RUXWKASG834LTMK28 | US0528002084 |
| 3450877 | A23RUXWKASG834LTMK28 | US0528003074 |
| 3766379 | A23RUXWKASG834LTMK28 | US0528001094 |
| 4442500 | A23RUXWKASG834LTMK28 | US0528001177 |

# ISIN TO LEI
>> isin_to_lei = ISINtoLEI()

>> lei_number = isin_to_lei.get_lei("US0528003074")

>> print(lei_number)
['A23RUXWKASG834LTMK28']

Search LEI using company name

You can also search for possible LEI numbers for a given company name.

>>> from python_lei.lei_search import SearchLEI
>>> search_possible_lei = SearchLEI()
>>> raw_data, table = search_possible_lei.search_lei("Apple INC.", show_table=True)
>>> print(table)
+------------+----------------------+
| Legal Name | LEI                  |
+------------+----------------------+
| APPLE INC. | HWUPKR0MPOU8FGXBT394 |
+------------+----------------------+

>>> print(raw_data)
[{'LegalName': 'APPLE INC.', 'LEI': 'HWUPKR0MPOU8FGXBT394'}]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-lei-0.1.1.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

python_lei-0.1.1-py2.py3-none-any.whl (11.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file python-lei-0.1.1.tar.gz.

File metadata

  • Download URL: python-lei-0.1.1.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7

File hashes

Hashes for python-lei-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7d1ec68e02d46f2e4b6b3d26a832d8325470647521bacbe2a63f8936207cd261
MD5 d5fe88bf4deeca5d03a1fed40076b6e4
BLAKE2b-256 db7d3462d6be01c6df1eb0f58db7744b55c912eb0c1ec75e2ae2bc36e2f012a3

See more details on using hashes here.

File details

Details for the file python_lei-0.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: python_lei-0.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7

File hashes

Hashes for python_lei-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e9a14b5aa1e9002022ba9da72b07ce22960dbaad0e77a6c98cf6ba2711e8fcfa
MD5 e6396a3a7f8342610342d3d1a839ae8e
BLAKE2b-256 4263558434b1ef7cd6fed236e85455d1ada94a64a690967f8e0116b1b9c4ac0e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page