@credentum/parse-figi
v0.0.1
Published
Validate and parse FIGI (Financial Instrument Global Identifier) strings with check digit verification. Zero dependencies.
Maintainers
Readme
parse-figi
Validate and parse FIGI (Financial Instrument Global Identifier) strings. Returns structured data: provider prefix, body, check digit, and validation status.
Installation
npm install @credentum/parse-figiUsage
import { parseFIGI } from '@credentum/parse-figi';
const result = parseFIGI('BBG000BLNNH6');
// => {
// raw: 'BBG000BLNNH6',
// valid: true,
// prefix: 'BB',
// body: 'G000BLNNH',
// checkDigit: '6',
// computedCheckDigit: '6',
// provider: 'Bloomberg'
// }Quick Validation
import { isValidFIGI } from '@credentum/parse-figi';
isValidFIGI('BBG000BLNNH6'); // true (IBM)
isValidFIGI('BBG000BLNNH0'); // false (bad check digit)Compute a Check Digit
import { computeCheckDigit } from '@credentum/parse-figi';
computeCheckDigit('BBG000BLNNH'); // '6'Why?
FIGI is the OMG standard for uniquely identifying financial instruments (ANSI X9.145-2021). Regulated reporting under MiFID II and CAT requires FIGI validation. There is no existing npm package that validates FIGI identifiers.
parse-figi gives you:
- Validation via Modulus 10 Double Add Double (Luhn variant) check digit
- Parsing that extracts provider prefix, body, and check digit
- Provider identification — recognizes Bloomberg (BB) and Kaiko (KK) prefixes
- Excluded-prefix detection — flags BS, BM, GG, GB, VG, GH, KY per spec
- Zero dependencies, pure TypeScript, <2KB
API
parseFIGI(figi: string): FIGIResult
Parse a 12-character FIGI string into structured data.
interface FIGIResult {
raw: string; // Original input
valid: boolean; // Format correct + check digit matches
prefix: string; // Positions 1-2 (provider code)
body: string; // Positions 3-11
checkDigit: string; // Position 12 (provided)
computedCheckDigit: string; // What position 12 should be
provider: string; // Known provider name or 'Unknown'
}isValidFIGI(figi: string): boolean
Returns true if the FIGI has valid format and correct check digit.
computeCheckDigit(figi11: string): string
Compute the check digit for the first 11 characters of a FIGI. Returns a single digit character, or empty string if input is invalid.
Validation Rules
Per the OMG FIGI specification and ANSI X9.145-2021:
- Exactly 12 characters
- Characters: uppercase consonants (B-Z, no vowels) and digits 0-9
- Positions 1-2: uppercase consonants only (no digits)
- Position 3: always
G - Position 12: check digit (Modulus 10 Double Add Double)
- Prefixes BS, BM, GG, GB, VG, GH, KY are excluded (ISIN collision avoidance)
Test Vectors
| FIGI | Security | Valid |
|------|----------|-------|
| BBG000BLNNH6 | IBM | yes |
| BBG000BPH459 | Microsoft | yes |
| BBG001S5N8V8 | Apple | yes |
| BBG000BLNNH0 | (bad check digit) | no |
| AAG000BLNNH6 | (vowel in prefix) | no |
| BSG000BLNNH6 | (excluded prefix) | no |
License
MIT
