The main intention for creation of this library is to have standart domain model across financial institutions for representing security identifiers and their validations.
Currently supported security identifiers:
<dependency>
<groupId>com.github.kelebra</groupId>
<artifactId>security-identifier</artifactId>
<version>0.2</version>
</dependency>
Security identifier | Class |
---|---|
ISIN | com.github.kelebra.security.identifier.Isin |
CUSIP | com.github.kelebra.security.identifier.Cusip |
SEDOL | com.github.kelebra.security.identifier.Sedol |
All of them are successors of SecurityIdentifier class which is intendent to be used in case when you want to have generic representation and do not worry about actual underlying type.
Isin isin = Isin.from("US0378331005");
Sedol sedol = Sedol.from("0263494");
Cusip cusip = Cusip.from("037833100");
SecurityIdentifierFactory.from("US0378331005"); // creates Isin instance
SecurityIdentifierFactory.from("0263494"); // creates Sedol instance
SecurityIdentifierFactory.from("037833100"); // creates Cusip instance
SecurityIdentifierFactory.getType("US0378331005"); // returns SecurityIdentifierType.ISIN
SecurityIdentifierFactory.getType("0263494"); // returns SecurityIdentifierType.SEDOL
SecurityIdentifierFactory.getType("037833100"); // returns SecurityIdentifierType.CUSIP
Security identifier | Must have country code | Is alpha numeric | Required length | Check digit validation algorithm | Additional requirements |
---|---|---|---|---|---|
ISIN | + | + | 12 | Luhn's algorithm | |
CUSIP | - | + | 9 | Modulo 10 hashing algorithm | |
SEDOL | - | + | 7 | Modulo 10 hashing algorithm | GB country code for ISIN conversion |
new IsinBuilder().withoutCheckOfCheckDigit().build("US0378331006"); // creates Isin instance
new SedolBuilder().withoutCheckOfCheckDigit().build("0263497"); // creates Sedol instance
new CusipBuilder().withoutCheckOfCheckDigit().build("037833101"); // creates Cusip instance