# stdnum.isin

ISIN (International Securities Identification Number).

The ISIN is a 12-character alpha-numerical code specified in ISO 6166 used to identify exchange listed securities such as bonds, commercial paper, stocks and warrants. The number is formed of a two-letter country code, a nine character national security identifier and a single check digit.

This module does not currently separately validate the embedded national security identifier part (e.g. when it is a CUSIP).

More information:

- https://en.wikipedia.org/wiki/International_Securities_Identification_Number

    >>> validate('US0378331005')
    'US0378331005'
    >>> validate('US0378331003')
    Traceback (most recent call last):
        ...
    InvalidChecksum: ...
    >>> from_natid('gb', 'BYXJL75')
    'GB00BYXJL758'

stdnum.isin.calc_check_digit(number: str) → str

  Calculate the check digits for the number.

stdnum.isin.compact(number: str) → str

  Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.

stdnum.isin.from_natid(country_code: str, number: str) → str

  Generate an ISIN from a national security identifier.

stdnum.isin.is_valid(number: str) → bool

  Check if the number provided is valid. This checks the length and check digit.

stdnum.isin.validate(number: str) → str

  Check if the number provided is valid. This checks the length and check digit.