# Currency Amount (ISO Code Prefix)

Key: `finance.currency.amount_code_prefix`

ISO 4217 three-letter currency code as prefix, followed by amount. Standard in SWIFT messages, banking/FX systems, and international financial data. Separator conventions vary by currency.

Page: <https://meridian.online/docs/finetype/types/finance/currency/amount_code_prefix>

Samples: `USD 1,234.56`, `EUR 1.234,56`, `GBP 999.99`, `JPY 10,000`

## Use it

Shell

```shell
finetype infer -i 'USD 1,234.56' --mode column
# → finance.currency.amount_code_prefix
```

DuckDB

```sql
SELECT ft_infer('USD 1,234.56');
-- → 'finance.currency.amount_code_prefix'
```

Cast template: {col} is your column

```sql
CAST(REGEXP_REPLACE(REGEXP_REPLACE({col}, '^[A-Z]{3}\s?', ''), ',', '', 'g') AS DECIMAL(18,2))
```

## Background

### Origin

ISO 4217 defines alpha codes and numeric codes for the representation of currencies.[[1]](https://en.wikipedia.org/wiki/ISO_4217) The first edition of ISO 4217 was published in 1978.[[1]](https://en.wikipedia.org/wiki/ISO_4217) ISO 4217:2015 is the most recent edition of the standard.[[1]](https://en.wikipedia.org/wiki/ISO_4217) The ISO 4217 tables are maintained by SIX Group on behalf of ISO and the Swiss Association for Standardization (SNV).[[1]](https://en.wikipedia.org/wiki/ISO_4217) For a national currency, the first two letters of the ISO 4217 alpha code are the two letters of the ISO 3166-1 alpha-2 country code.[[1]](https://en.wikipedia.org/wiki/ISO_4217)

ISO 4217 does not regulate spacing, prefixing or suffixing when a currency code is written with an amount.[[1]](https://en.wikipedia.org/wiki/ISO_4217) FineType defines this type as an ISO 4217 three-letter currency code written as a prefix, followed by the amount.[[2]](https://github.com/meridian-online/finetype/blob/main/labels/definitions_finance.yaml) The style guide of the European Union's Publications Office puts the ISO 4217 code first, followed by a non-breaking space and the amount, in English, Irish, Latvian and Maltese texts.[[1]](https://en.wikipedia.org/wiki/ISO_4217) For French, German, Spanish and the other EU languages it lists, the Publications Office style guide reverses the order, writing the amount, a non-breaking space and then the ISO 4217 code.[[1]](https://en.wikipedia.org/wiki/ISO_4217) Wikipedia's ISO 4217 article notes that the order is determined by the native language of the document rather than by the currency.[[1]](https://en.wikipedia.org/wiki/ISO_4217)

### Use

The ISO 4217 code list is used in banking and business globally.[[1]](https://en.wikipedia.org/wiki/ISO_4217) ISO 4217 alpha codes are used on airline tickets and international train tickets to remove any ambiguity about the price.[[1]](https://en.wikipedia.org/wiki/ISO_4217) JavaScript's Intl.NumberFormat constructor has a currencyDisplay option whose value code uses the ISO currency code.[[3]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat) A code prefix is a good sign the source system was built to carry more than one currency in a single column, so expect a mix of codes rather than one. (Meridian's view)

Different countries officially designate different symbols as the decimal separator.[[4]](https://en.wikipedia.org/wiki/Decimal_separator) Wikipedia's decimal separator article lists 1.234.567,89 among the forms seen in Germany, Brazil and Dutch-speaking Belgium.[[4]](https://en.wikipedia.org/wiki/Decimal_separator) The currency code tells you the currency, not which character is the decimal mark, so decide the separator convention per file or per source before you strip anything. (Meridian's view)

## Sources

1. [ISO 4217 - Wikipedia](https://en.wikipedia.org/wiki/ISO_4217) — secondary source
2. [finetype/labels/definitions\_finance.yaml at main · meridian-online/finetype](https://github.com/meridian-online/finetype/blob/main/labels/definitions_finance.yaml) — FineType
3. [Intl.NumberFormat() constructor - JavaScript \| MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat) — documentation
4. [Decimal separator - Wikipedia](https://en.wikipedia.org/wiki/Decimal_separator) — secondary source

## How it's detected

SWIFT, FX, banking standard.
