Skip to main content

Crate regit_identifiers

Crate regit_identifiers 

Source
Expand description

Securities identifier validation in pure Rust — #![no_std], no alloc, zero dependencies.

regit-identifiers parses, validates, and converts the identifiers that name a security or a market: ISIN, CUSIP / CINS, SEDOL, LEI, BIC, MIC, FIGI, CFI, and the national numbers WKN and VALOR.

An identifier is the primary key of a security: a trade is routed, a position is settled, and a holding is reported to a regulator against it. If a malformed or mistyped identifier is accepted as valid, every one of those operations is wrong. This crate’s first duty is therefore to never certify a bad identifier as good. For every identifier that carries a check digit, the digit is recomputed from its governing standard and verified — never trusted. Structural rules are enforced exactly as the standard specifies.

The crate is #![no_std] and allocation-free: every identifier is a fixed-size byte array, every algorithm is hand-rolled integer arithmetic, and there is no runtime dependency. The same audited logic runs in a backend service, a WASM bundle, or on an embedded device.

§Quick start

use regit_identifiers::checkdigit;

// Recompute the check digit of Apple's ISIN body — never trust the
// digit you were given.
assert_eq!(checkdigit::isin_check_digit("US037833100").unwrap(), '5');

// A securities identifier is, at its core, a check-digit scheme over an
// alphanumeric alphabet — that core is exposed directly.
assert_eq!(checkdigit::cusip_check_digit("03783310").unwrap(), '0');
assert_eq!(checkdigit::sedol_check_digit("026349").unwrap(), '4');
assert_eq!(checkdigit::figi_check_digit("BBG000BLNNH").unwrap(), '6');

§Architecture

errors       typed errors — ValidationError, ConversionError
charset      ASCII alphabet primitives (internal)
checkdigit   check-digit algorithms — ISIN, CUSIP, SEDOL, LEI, FIGI
country      ISO 3166-1 alpha-2 codes and ISIN prefix rules

isin         ISIN  — ISO 6166         cusip   CUSIP / CINS — ANSI X9.6
sedol        SEDOL — LSE Masterfile   lei     LEI   — ISO 17442
figi         FIGI  — ANSI X9.145      bic     BIC   — ISO 9362
mic          MIC   — ISO 10383        cfi     CFI   — ISO 10962
wkn          WKN   — national (DE)    valor   VALOR — national (CH)

convert      cross-identifier conversions (ISIN ⇄ CUSIP / SEDOL / VALOR)
detect       SecurityId — unified type + auto-detection
mic_registry embedded ISO 10383 registry  (feature `mic-registry`)

Every rule is traced to a citable standard — ISO 6166, ISO 17442, ISO 9362, ISO 10383, ISO 10962, ISO 7064, and the CUSIP, SEDOL, and FIGI specifications — in the doc comment of the module that implements it.

Part of Regit OS — the operating system for investment products. From Luxembourg.

Re-exports§

pub use bic::Bic;
pub use cfi::Cfi;
pub use cusip::Cusip;
pub use detect::IdentifierKind;
pub use detect::SecurityId;
pub use errors::ConversionError;
pub use errors::ValidationError;
pub use figi::Figi;
pub use isin::Isin;
pub use lei::Lei;
pub use mic::Mic;
pub use sedol::Sedol;
pub use valor::Valor;
pub use wkn::Wkn;
pub use mic::MicEntry;
pub use mic::MicStatus;

Modules§

bic
BIC — Business Identifier Code (ISO 9362), the SWIFT address of a financial institution.
cfi
CFI — Classification of Financial Instruments (ISO 10962).
checkdigit
Check-digit algorithms for securities identifiers.
convert
Conversions between securities identifiers.
country
ISO 3166-1 alpha-2 country codes and ISIN country-prefix rules.
cusip
CUSIP — Committee on Uniform Securities Identification Procedures (ANSI X9.6).
detect
Auto-detection — recognising which kind of identifier a raw string is.
errors
Typed error enums for identifier validation and conversion.
figi
FIGI — Financial Instrument Global Identifier (ANSI X9.145).
isin
ISIN — International Securities Identification Number (ISO 6166).
lei
LEI — Legal Entity Identifier (ISO 17442).
mic
MIC — Market Identifier Code (ISO 10383).
mic_registry
Embedded snapshot of the ISO 10383 Market Identifier Code registry. Enabled by the default mic-registry feature. Embedded snapshot of the ISO 10383 Market Identifier Code (MIC) registry.
sedol
SEDOL — Stock Exchange Daily Official List number (London Stock Exchange).
valor
VALOR — Valorennummer (SIX Financial Information).
wkn
WKN — Wertpapierkennnummer (WM Datenservice).