Function Repository Resource:

ValidISINQ

Source Notebook

Verify an international securities identification number

Contributed by: Sander Huisman

ResourceFunction["ValidISINQ"][isin]

verifies whether isin is valid.

Details

ISIN stands for International Securities Identification Number.
Verifies that the ISIN is: two letter characters, followed by 9 security code characters (A—Z, 0—9), followed by a checksum digit (0—9).
The first two characters have to be one of: AA, AC, AD, AE, AF, AG, AI, AL, AM, AN, AO, AP, AQ, AR, AS, AT, AU, AW, AX, AZ, BA, BB, BD, BE, BF, BG, BH, BI, BJ, BL, BM, BN, BO, BQ, BR, BS, BT, BU, BV, BW, BX, BY, BZ, CA, CC, CD, CF, CG, CH, CI, CK, CL, CM, CN, CO, CP, CQ, CR, CS, CU, CV, CW, CX, CY, CZ, DE, DG, DJ, DK, DM, DO, DY, DZ, EA, EC, EE, EF, EG, EH, EM, EP, ER, ES, ET, EU, EV, EW, EZ, FI, FJ, FK, FL, FM, FO, FR, FX, GA, GB, GC, GD, GE, GF, GG, GH, GI, GL, GM, GN, GP, GQ, GR, GS, GT, GU, GW, GY, HK, HM, HN, HR, HT, HU, IB, IC, ID, IE, IL, IM, IN, IO, IQ, IR, IS, IT, JA, JE, JM, JO, JP, KE, KG, KH, KI, KM, KN, KP, KR, KW, KY, KZ, LA, LB, LC, LF, LI, LK, LR, LS, LT, LU, LV, LY, MA, MC, MD, ME, MF, MG, MH, MK, ML, MM, MN, MO, MP, MQ, MR, MS, MT, MU, MV, MW, MX, MY, MZ, NA, NC, NE, NF, NG, NI, NL, NO, NP, NR, NT, NU, NZ, OA, OM, OO, PA, PE, PF, PG, PH, PI, PK, PL, PM, PN, PR, PS, PT, PW, PY, QA, QM, QN, QO, QP, QQ, QR, QS, QT, QU, QV, QW, QX, QY, QZ, RA, RB, RC, RE, RH, RI, RL, RM, RN, RO, RP, RS, RU, RW, SA, SB, SC, SD, SE, SF, SG, SH, SI, SJ, SK, SL, SM, SN, SO, SR, SS, ST, SU, SV, SX, SY, SZ, TA, TC, TD, TF, TG, TH, TJ, TK, TL, TM, TN, TO, TP, TR, TT, TV, TW, TZ, UA, UG, UK, UM, UN, US, UY, UZ, VA, VC, VE, VG, VI, VN, VU, WF, WG, WL, WO, WS, WV, XA, XB, XC, XD, XE, XF, XG, XH, XI, XJ, XK, XL, XM, XN, XO, XP, XQ, XR, XS, XT, XU, XV, XW, XX, XY, XZ, YE, YT, YU, YV, ZA, ZM, ZR, ZW, or ZZ in order to be valid. See the ISO 3166-1 alpha-2 specification.
The checksum digit is checked by interpreting the first 11 digits as base 36 and interpreting this as a base 10 number, and then performing the Luhn test on it.
ValidISINQ has the Listable atrtibute.

Examples

Basic Examples (2) 

Verify an ISIN:

In[1]:=
ResourceFunction["ValidISINQ"]["US0378331005"]
Out[1]=

Test another ISIN:

In[2]:=
ResourceFunction["ValidISINQ"]["U50378331005"]
Out[2]=

Scope (1) 

Verify several:

In[3]:=
ResourceFunction[
 "ValidISINQ"][{"US0378331005", "U50378331005", "FR0000988040"}]
Out[3]=

Neat Examples (1) 

Find the first valid ISIN:

In[4]:=
res = ResourceFunction["FindFirstNumberInstance"][
   ResourceFunction["ValidISINQ"][
     "AA" ~~ StringPadLeft[ToString[#], 10, "0"]] &];
"AA" ~~ StringPadLeft[ToString[res], 10, "0"]
Out[5]=

Publisher

SHuisman

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 1.0.0 – 05 June 2024

Related Resources

License Information