Skip to main content

ISO 4217 Currencies

Complete list of ISO 4217 currencies supported by @genkin/currencies.

Major Currencies

The most commonly used currencies worldwide:

CodeNameSymbolPrecision
USDUS Dollar$2
EUREuro2
GBPBritish Pound Sterling£2
JPYJapanese Yen¥0
CNYChinese Yuan¥2
CHFSwiss FrancCHF2
CADCanadian DollarC$2
AUDAustralian DollarA$2
NZDNew Zealand DollarNZ$2
SEKSwedish Kronakr2
NOKNorwegian Kronekr2
DKKDanish Kronekr2

Usage

Import and use any currency:

import { genkin } from '@genkin/core';
import { USD, EUR, GBP, JPY } from '@genkin/currencies';

const usd = genkin(100, { currency: USD });
const eur = genkin(85, { currency: EUR });
const gbp = genkin(75, { currency: GBP });
const jpy = genkin(15000, { currency: JPY });

Zero-Precision Currencies

Some currencies don't have fractional units:

CodeNameSymbolPrecision
JPYJapanese Yen¥0
KRWSouth Korean Won0
VNDVietnamese Dong0
CLPChilean Peso$0
ISKIcelandic Krónakr0
TWDNew Taiwan DollarNT$0
import { genkin } from '@genkin/core';
import { JPY, KRW } from '@genkin/currencies';

// These amounts are always whole numbers
const yen = genkin(1000, { currency: JPY });
const won = genkin(50000, { currency: KRW });

Three-Decimal Currencies

Some currencies use 3 decimal places:

CodeNameSymbolPrecision
BHDBahraini DinarBD3
JODJordanian DinarJD3
KWDKuwaiti DinarKD3
OMROmani RialOMR3
TNDTunisian DinarDT3
import { genkin } from '@genkin/core';
import { KWD } from '@genkin/currencies';

const dinar = genkin(10.500, { currency: KWD });
console.log(dinar.precision); // 3

All Supported Currencies

@genkin/currencies includes 180+ ISO 4217 currencies. Here are some examples by region:

Americas

  • USD (US Dollar), CAD (Canadian Dollar), MXN (Mexican Peso)
  • BRL (Brazilian Real), ARS (Argentine Peso), CLP (Chilean Peso)
  • COP (Colombian Peso), PEN (Peruvian Sol), VES (Venezuelan Bolívar)

Europe

  • EUR (Euro), GBP (British Pound), CHF (Swiss Franc)
  • SEK (Swedish Krona), NOK (Norwegian Krone), DKK (Danish Krone)
  • PLN (Polish Złoty), CZK (Czech Koruna), HUF (Hungarian Forint)
  • RON (Romanian Leu), BGN (Bulgarian Lev), HRK (Croatian Kuna)

Asia-Pacific

  • JPY (Japanese Yen), CNY (Chinese Yuan), KRW (South Korean Won)
  • INR (Indian Rupee), IDR (Indonesian Rupiah), THB (Thai Baht)
  • MYR (Malaysian Ringgit), SGD (Singapore Dollar), PHP (Philippine Peso)
  • VND (Vietnamese Dong), AUD (Australian Dollar), NZD (New Zealand Dollar)

Middle East & Africa

  • AED (UAE Dirham), SAR (Saudi Riyal), QAR (Qatari Riyal)
  • ILS (Israeli Shekel), TRY (Turkish Lira), EGP (Egyptian Pound)
  • ZAR (South African Rand), NGN (Nigerian Naira), KES (Kenyan Shilling)

Importing Currencies

Individual Imports

import { USD, EUR, GBP } from '@genkin/currencies';

Bulk Imports

import * as currencies from '@genkin/currencies';

const usd = currencies.USD;
const eur = currencies.EUR;

Configuration Objects

import { USD_CONFIG, EUR_CONFIG } from '@genkin/currencies';

console.log(USD_CONFIG);
// {
// code: 'USD',
// numeric: 840,
// precision: 2,
// symbol: '$',
// name: 'US Dollar',
// base: 10
// }

Factory Functions

import { createUSD, createEUR } from '@genkin/currencies';

const usd = createUSD();
const eur = createEUR();

Currency Properties

Each currency object includes:

import { USD } from '@genkin/currencies';

console.log(USD.code); // "USD"
console.log(USD.numeric); // 840 (ISO 4217 numeric code)
console.log(USD.precision); // 2
console.log(USD.symbol); // "$"
console.log(USD.name); // "US Dollar"
console.log(USD.base); // 10

Formatting and Parsing

All currency objects support formatting and parsing:

import { USD, EUR, JPY } from '@genkin/currencies';

// Formatting
console.log(USD.format(1234.56)); // "$1,234.56"
console.log(EUR.format(1234.56)); // "€1,234.56"
console.log(JPY.format(1234)); // "¥1,234"

// Parsing
console.log(USD.parse('$1,234.56')); // 1234.56
console.log(EUR.parse('€1,234.56')); // 1234.56
console.log(JPY.parse('¥1,234')); // 1234

Type-Safe Currency Codes

Use typed currency codes for better type safety:

import { USD_CODE, EUR_CODE, type USDCode, type EURCode } from '@genkin/currencies';

function processUSD(code: USDCode) {
console.log(`Processing ${code}`);
}

processUSD(USD_CODE); // OK
processUSD('USD'); // OK
// processUSD('EUR'); // Type error!

Custom Currencies

Need a currency not in ISO 4217? Create a custom one:

import { createCurrency } from '@genkin/core';

const BTC = createCurrency({
code: 'BTC',
numeric: 0,
precision: 8,
symbol: '₿',
name: 'Bitcoin',
base: 10
});

Next Steps