Skip to content

Simple domain model for representing security identifiers and their validations

License

Notifications You must be signed in to change notification settings

kelebra/security-identifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

security-identifier

Build Status Maven Central
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:

Quick start

<dependency>
  <groupId>com.github.kelebra</groupId>
  <artifactId>security-identifier</artifactId>
  <version>0.2</version>
</dependency>

Classes representing security identifiers

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.

Create particular security identifier:

Isin isin = Isin.from("US0378331005");
Sedol sedol = Sedol.from("0263494");
Cusip cusip = Cusip.from("037833100");

Parse any security identifier:

SecurityIdentifierFactory.from("US0378331005"); // creates Isin instance
SecurityIdentifierFactory.from("0263494"); // creates Sedol instance
SecurityIdentifierFactory.from("037833100"); // creates Cusip instance

Defining security identifier type:

SecurityIdentifierFactory.getType("US0378331005"); // returns SecurityIdentifierType.ISIN
SecurityIdentifierFactory.getType("0263494"); // returns SecurityIdentifierType.SEDOL
SecurityIdentifierFactory.getType("037833100"); // returns SecurityIdentifierType.CUSIP

Validations applied when creating an instance of security identifier:

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

Create security identifier without check digit check:

new IsinBuilder().withoutCheckOfCheckDigit().build("US0378331006"); // creates Isin instance
new SedolBuilder().withoutCheckOfCheckDigit().build("0263497"); // creates Sedol instance
new CusipBuilder().withoutCheckOfCheckDigit().build("037833101"); // creates Cusip instance

About

Simple domain model for representing security identifiers and their validations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages