Skip to content

Check minor units of historical currencies #109

Closed

Description

@BenMorel

Background

We're using the list-three.xml file from SIX Group to generate the list of historical currencies. But unlike list-one, this file does not contain the number of minor units of each currency.

Some research work has been done by @survik1 in #104, and the (currency code, minor units) pairs merged in this PR are listed in the table below. On each line, I've also included the number of minor units as reported by a number of data sources and money libraries:

Table

PR #104 ISO BSI CLDR Wikipedia Moneta Joda Noda Dinero Ruby Go
ADP 0 - 0 0 0 0 0 0 - - -
AFA 2 - 2 - 2 2 - 0 - - -
ALK 2 - - - - - - - - - -
ANG 2 2 2 - 2 2 2 2 2 2 2
AOK 2 - - - 0 - - 0 - - -
AON 0 - - - 0 - - 0 - - -
AOR 0 - - - 0 - - 0 - - -
ARA 2 - - - 2 - - 2 - - -
ARP 2 - - - 2 - - 2 - - -
ARY 2 - - - - - - 0 - - -
ATS 2 - 2 - 2 2 2 2 - - -
AYM 2 - - - - 2 - - - - -
AZM 2 - 2 - 2 2 - 0 - - -
BAD 2 - - - 2 - - 2 - - -
BEC 2 - - - - - - - - - -
BEF 2 - 0 - 2 0 0 2 - - -
BEL 2 - - - - - - - - - -
BGJ 2 - - - - - - 0 - - -
BGK 2 - - - - - - 0 - - -
BGL 2 - 2 - 2 2 - 2 - - -
BGN 2 2 2 - 2 2 2 2 2 2 2
BOP 2 - - - 2 - - 2 - - -
BRB 2 - - - 2 - - 2 - - -
BRC 2 - - - 2 - - 2 - - -
BRE 2 - - - 2 - - 2 - - -
BRN 2 - - - 2 - - 2 - - -
BRR 2 - - - 2 - - 2 - - -
BUK 2 - - - - - - 0 - - -
BYB 2 - - - 2 0 - 2 - - -
BYR 2 0 0 0 0 0 0 0 - 0 0
CHC 2 - - - 2 - - - - - -
CSD 2 - - - 2 2 - 2 - - -
CSJ 2 - - - 2 - - 0 - - -
CSK 2 - - - 2 - - 0 - - -
CUC 2 2 - - 2 2 2 2 2 2 2
CYP 3 - 2 - 2 2 2 2 - - -
DDM 2 - - - - - - 0 - - -
DEM 2 - 2 - - 2 2 2 - - -
ECS 2 - - - 0 - - 0 - - -
ECV 2 - - - 2 - - 0 - - -
EEK 2 - 2 - 2 2 2 2 - 2 2
ESA 2 - - - - - - 0 - - -
ESB 2 - - - - - - 0 - - -
ESP 2 - 0 0 0 0 0 0 - - -
EUR 2 2 2 - 2 2 2 2 2 2 2
FIM 2 - 2 - 2 2 2 2 - - -
FRF 2 - 2 - 2 2 2 2 - - -
GEK 0 - - - 0 - - - - - -
GHC 2 - 2 - 2 2 - 0 - 2 2
GHP 2 - - - 2 - - - - - -
GNE 2 - - - - - - 0 - - -
GNS 2 - - - - - - 0 - - -
GQE 2 - - - - - - 0 - - -
GRD 2 - 0 - 0, 2 0 0 2 - - -
GWE 2 - - - - - - 0 - - -
GWP 2 - 2 - 2 2 - 0 - - -
HRD 2 - - - 2 - - 0 - - -
HRK 2 2 2 - 2 2 2 2 2 2 2
IDR 2 2 2 0 2 2 2 2 2 2 2
IEP 2 - 2 - 2 2 2 2 - - -
ILP 3 - - - 3, 2 - - 3 - - -
ILR 2 - - - 2 - - 2 - - -
ISJ 2 - - - 2 - - 2 - - -
ITL 2 - 0 0 0 0 0 0 - - -
LAJ 2 - - - - - - 0 - - -
LSM 2 - - - - - - 0 - - -
LTL 2 2 2 - 2 2 2 2 - 2 2
LTT 2 - - - 2 - - - - - -
LUC 2 - - - - - - - - - -
LUF 2 - 0 0 2 0 0 2 - - -
LUL 2 - - - - - - - - - -
LVL 2 2 2 - 2 2 2 2 - 2 2
LVR 2 - - - 2 - - - - - -
MGF 2 - 0 0 0 0 - 2 - - -
MLF 2 - - - - - - 0 - - -
MRO 2 2 2 0 2 2 2 1 - 1 -
MTL 3 - 2 - 2 2 2 2 - 2 -
MTP 2 - - - - - - 0 - - -
MVQ 2 - - - - - - 0 - - -
MWK 2 2 2 - 2 2 2 2 2 2 2
MXP 2 - - - - - - 0 - - -
MZE 2 - - - 2 - - 0 - - -
MZM 2 - 2 - 2 2 - 0 - - -
NIC 2 - - - 2 - - 0 - - -
NLG 2 - 2 - 2 2 2 2 - - -
PEH 2 - - - - - - 0 - - -
PEI 2 - - - - - - 0 - - -
PEN 2 2 2 - 2 2 2 2 2 2 2
PES 2 - - - 2 - - - - - -
PLZ 2 - - - 2 - - 0 - - -
PTE 2 - 0 - 0 0 0 0 - - -
RHD 2 - - - 2 - - 0 - - -
ROK 2 - - - - - - 0 - - -
ROL 2 - 2 - 0 0 - 0 - - -
RON 2 2 - - 2 2 2 2 2 2 2
RUR 2 - 2 - 2 2 2 2 - - 2
SDD 2 - 2 - 2 2 - 0 - - -
SDG 2 2 - - 2 2 2 2 2 2 2
SDP 2 - - - - - - 0 - - -
SIT 2 - 2 - 2 2 2 2 - - -
SKK 2 - 2 - 2 2 2 2 - 2 2
SLL 2 2 2 0 2 2 2 2 2 2 2
SRG 2 - 2 - 2 2 - 0 - - -
STD 2 2 2 0 2 2 2 2 - 2 2
SUR 2 - - - - - - 0 - - -
SZL 2 2 2 - 2 2 2 2 2 2 2
TJR 2 - - - 0 - - 0 - - -
TMM 2 - 2 0 2 2 - 0 - 2 -
TPE 2 - 0 - 0 0 - 0 - - -
TRL 2 - 0 0 0 0 - 0 - - 2
TRY 2 2 - - 2 2 2 2 2 2 2
UAK 2 - - - 2 - - 0 - - -
UGS 2 - - - - - - 0 - - -
UGW 2 - - - - - - 0 - - -
USS 2 2 2 - 2 2 - 2 - - -
UYN 2 - - - 2 - - 0 - - -
UYP 2 - - - - - - 0 - - -
VEB 2 - 2 - 2 2 - 2 - - -
VEF 2 2 - 2 2 2 2 2 - 2 2
VNC 2 - - - - - - 2 - - -
XEU - - - - 0 - 0 0 - - -
XFO - - - - - - - 0 - - -
XFU - - - - - - 0 0 - 2 -
XRE - - - - - - - - - - -
YDD 2 - - - - - - 0 - - -
YUD 2 - - - 2 - - 2 - - -
YUM 2 - 2 - 2 2 - 2 - - -
YUN 2 - - - 2 - - 2 - - -
ZAL 2 - - - 2 - - 0 - - -
ZMK 2 - 2 0 2 2 - 2 - 2 -
ZRN 2 - - - 2 - - 2 - - -
ZRZ 2 - - - 2 - - 3 - - -
ZWC 2 - - - 2 - - 2 - - -
ZWD 2 - 2 0 2 2 - 2 - 2 2
ZWL 2 2 - - 2 2 2 2 2 2 2
ZWN 2 - - - 2 2 - 2 - 2 -
ZWR 2 - - - 2 2 - 2 - 2 -

Question

Should we really attempt to obtain potentially erroneous information from untrusted sources (Wikipedia and random websites), or should we stick to the two trusted sources, which probably cover all recently withdrawn currencies (like BGN)?

To put it differently, there are two approaches for the untrusted entries:

  1. include them anyway, wait for someone to open an issue if wrong
  2. don't include them, wait for someone to open an issue if missing, citing a reliable source for minor units

I'd lean towards option 2, which is the safest one, and probably covers 99% of the use cases out there anyway.

@survik1, what's your take on this?

Activity

  1. survik1 commented on Jan 8, 2026

    @survik1
    Contributor

    @BenMorel Unfortunately, the sources you have listed do not suffice. As I said in my MR, my goal was to extend minor units to the biggest value it used to have (even though I don't know if it is a correct approach).

    For example:
    GRD - Used to have minor units, became obsolete over time https://en.wikipedia.org/wiki/Modern_drachma
    CYP - Used to have 1/1000 minor unit, replaced with 1/100
    TRL - First Turkish lira, hard to get any detailed information, but they did have minor unit of Para ... or at least they had coins of that unit https://cs.ucoin.net/catalog/?country=turkey&period=141

    As you can see, these information are in contradiction even with authoritative sources as these sources are using the latest value instead of the max as I have used.

    My idea was to ensure that rounding errors wont pop up due to changes over the time, yet this introduces another difference with current existing currencies, as they tend to loose their minor units as well (ISK for example). Maybe it is better to keep the latest value and let users to apply different number of minor units if necessary?

    In any way, I would not remove currencies. The possible error from setting the uncertain values to 2 is rather insignificant, as that only allows loose rounding behavior. On contrary, missing currency will lead to critical fail on attempt to create an instance with it.

    Note: Currencies starting with X are virtual and can be ignored.

  2. BenMorel commented on Jan 9, 2026

    @BenMorel
    MemberAuthor

    Thank you for these insights, @survik1.

    I updated the issue with data from the CLDR / ICU, plus data extracted from the most popular money libraries in several languages, to get a better view of the landscape.

    As I said in my MR, my goal was to extend minor units to the biggest value it used to have (even though I don't know if it is a correct approach).

    I'm torn on this one. To analyze your examples:

    • GRD: Moneta/Joda use 0 (latest), Noda uses 2 (max)
    • CYP: Moneta/Joda/Noda agree on 2 (latest)
    • TRL: Moneta/Noda use 0, Go uses 2

    BSI seems to always use the latest one, which seems reasonable to me.

    One argument in favour of using the latest one is: if at some point a currency currently in use updated its number of minor units, we would have to update the library with this (breaking) change; then if at a later point the currency were withdrawn, we would archive it with its current value, so the latest one.

    In any way, I would not remove currencies. The possible error from setting the uncertain values to 2 is rather insignificant, as that only allows loose rounding behavior. On contrary, missing currency will lead to critical fail on attempt to create an instance with it.

    I disagree with this one: I think that for a money library, correctness is more valuable than completeness. In my opinion, a few currencies provide most of the value of historical currencies (typically the ones withdrawn in the last couple decades), and we do have archives of official sources for these.

    The remaining currencies are much less likely to be used with this library, and if they are, I think one can expect the library to not provide out-of-the-box support for them (and it's easy to create your own Currency instance with whatever minor units suit you). This is the approach used by most money libraries in other languages, so this should not come as a surprise for users.

    Side note: we could also add support for currencies with "unknown minor units": monies created with such a currency could be initialized with a CustomContext set to whatever precision was used in the given amount, instead of the DefaultContext. I'm not sure if this feature is of any value though (plus it may violate the principle of least astonishment).

  3. BenMorel commented on Jan 20, 2026

    @BenMorel
    MemberAuthor

    After much thought, I've decided to exclude historical currencies for which we don't yet have sufficient data:

    money/import-currencies.php

    Lines 309 to 469 in a9fda39

    /**
    * Minor units of historical currencies are not listed within list-three file. They have to be reconstructed manually from additional sources.
    * This list has to be exhaustive, otherwise import will fail. Use null when minor units are unknown.
    *
    * The data sources used for minor unit values in this list are archived copies of the following URLs:
    *
    * http://www.currency-iso.org/dam/downloads/dl_iso_table_a1.xml
    * https://www.currency-iso.org/dam/downloads/lists/list_one.xml
    * https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/amendments/lists/list_one.xml
    * https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
    * http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    *
    * The official ISO sources are currency-iso.org (old website) and six-group.com (new website).
    * The URL of the XML file changed several times over the years.
    *
    * The tig90x.doc file is an old file (the last archived copy is from 2004) from the British Standards Institution.
    * BSI is a member body of ISO, and SAP cites tig90x.doc as a reference in publicly available documentation, so we consider this list authoritative.
    *
    * See: https://github.com/brick/money/issues/109
    *
    * @var array<string, int|null> $historicalMinorUnits
    */
    $historicalMinorUnits = [
    'ADP' => 0, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'AFA' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'ALK' => null,
    'ANG' => 2, // https://web.archive.org/web/20250324115248/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
    'AOK' => null,
    'AON' => null,
    'AOR' => null,
    'ARA' => null,
    'ARP' => null,
    'ARY' => null,
    'ATS' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'AYM' => null,
    'AZM' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'BAD' => null,
    'BEC' => null,
    'BEF' => 0, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'BEL' => null,
    'BGJ' => null,
    'BGK' => null,
    'BGL' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'BGN' => 2, // https://web.archive.org/web/20250928170142/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
    'BOP' => null,
    'BRB' => null,
    'BRC' => null,
    'BRE' => null,
    'BRN' => null,
    'BRR' => null,
    'BUK' => null,
    'BYB' => null,
    'BYR' => 0, // https://web.archive.org/web/20161201195250/https://www.currency-iso.org/dam/downloads/lists/list_one.xml
    'CHC' => null,
    'CSD' => null,
    'CSJ' => null,
    'CSK' => null,
    'CUC' => 2, // https://web.archive.org/web/20250128081422/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
    'CYP' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'DDM' => null,
    'DEM' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'ECS' => null,
    'ECV' => null,
    'EEK' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'ESA' => null,
    'ESB' => null,
    'ESP' => 0, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'EUR' => 2, // https://web.archive.org/web/20250928170142/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
    'FIM' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'FRF' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'GEK' => null,
    'GHC' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'GHP' => null,
    'GNE' => null,
    'GNS' => null,
    'GQE' => null,
    'GRD' => 0, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'GWE' => null,
    'GWP' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'HRD' => null,
    'HRK' => 2, // https://web.archive.org/web/20221107144009/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
    'IDR' => 2, // https://web.archive.org/web/20250928170142/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
    'IEP' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'ILP' => null,
    'ILR' => null,
    'ISJ' => null,
    'ITL' => 0, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'LAJ' => null,
    'LSM' => null,
    'LTL' => 2, // https://web.archive.org/web/20130703061233/http://www.currency-iso.org/dam/downloads/dl_iso_table_a1.xml
    'LTT' => null,
    'LUC' => null,
    'LUF' => 0, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'LUL' => null,
    'LVL' => 2, // https://web.archive.org/web/20130703061233/http://www.currency-iso.org/dam/downloads/dl_iso_table_a1.xml
    'LVR' => null,
    'MGF' => 0, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'MLF' => null,
    'MRO' => 2, // https://web.archive.org/web/20170912004601/https://www.currency-iso.org/dam/downloads/lists/list_one.xml
    'MTL' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'MTP' => null,
    'MVQ' => null,
    'MWK' => 2, // https://web.archive.org/web/20250928170142/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
    'MXP' => null,
    'MZE' => null,
    'MZM' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'NIC' => null,
    'NLG' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'PEH' => null,
    'PEI' => null,
    'PEN' => 2, // https://web.archive.org/web/20250928170142/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
    'PES' => null,
    'PLZ' => null,
    'PTE' => 0, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'RHD' => null,
    'ROK' => null,
    'ROL' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'RON' => 2, // https://web.archive.org/web/20250928170142/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
    'RUR' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'SDD' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'SDG' => 2, // https://web.archive.org/web/20250928170142/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
    'SDP' => null,
    'SIT' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'SKK' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'SLL' => 2, // https://web.archive.org/web/20230605125714/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
    'SRG' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'STD' => 2, // https://web.archive.org/web/20170912004601/https://www.currency-iso.org/dam/downloads/lists/list_one.xml
    'SUR' => null,
    'SZL' => 2, // https://web.archive.org/web/20250928170142/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
    'TJR' => null,
    'TMM' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'TPE' => 0, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'TRL' => 0, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'TRY' => 2, // https://web.archive.org/web/20250928170142/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
    'UAK' => null,
    'UGS' => null,
    'UGW' => null,
    'USS' => 2, // https://web.archive.org/web/20130703061233/http://www.currency-iso.org/dam/downloads/dl_iso_table_a1.xml
    'UYN' => null,
    'UYP' => null,
    'VEB' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'VEF' => 2, // https://web.archive.org/web/20180511154730/https://www.currency-iso.org/dam/downloads/lists/list_one.xml
    'VNC' => null,
    'XEU' => null,
    'XFO' => null,
    'XFU' => null,
    'XRE' => null,
    'YDD' => null,
    'YUD' => null,
    'YUM' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'YUN' => null,
    'ZAL' => null,
    'ZMK' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'ZRN' => null,
    'ZRZ' => null,
    'ZWC' => null,
    'ZWD' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
    'ZWL' => 2, // https://web.archive.org/web/20240722165054/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
    'ZWN' => null,
    'ZWR' => null,
    ];

    I'll be happy to reintroduce currencies on a case-by-case basis if we find sufficient supporting information.

    Anyone is welcome to open an issue or a PR if you need a historical currency that is not yet supported.

    I still stand by correctness over completeness, and I think it will be easier to add currencies in the future than to change existing data and break backwards compatibility.

    Thanks a lot for your time, @survik1. I understand that you've spent quite some time researching historical currencies, and you'll be more than welcome to share any data sources from your research that I may have missed here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions