bengourley / currency-symbol-map

A function to lookup the currency symbol for a given currency code
BSD 2-Clause "Simplified" License
326 stars 112 forks source link

➕ add missing currencies #61

Closed namenyi closed 3 years ago

namenyi commented 3 years ago

This currency map has not been updated for a while and there were several issues / PRs about missing currencies.

Instead of reviewing and merging them one-by-one, I tried to find an official source of currencies and all the missing ones.


I chose the ISO 4217 standard about currency codes: https://www.iso.org/iso-4217-currency-codes.html

This standard establishes internationally recognized codes for the representation of currencies that enable clarity and reduce errors.

Here's their full list in XML format: https://www.currency-iso.org/dam/downloads/lists/list_one.xml

Thank you @davidporos92 for your ideas!


I also checked this site for symbols: https://www.foreignexchangelive.com/currency-codes-symbols/

namenyi commented 3 years ago

This will resolve these issues:

namenyi commented 3 years ago

The ISO 4217 contains some extra currencies that we could potentially add in the future:

  'USN': '$', // UNITED STATES OF AMERICA - US Dollar (Next day)
  'XAG': 'XAG', // ZZ11 Silver
  'XAU': 'XAU', // ZZ08 Gold
  'XBA': 'XBA', // ZZ01 Bond Markets Unit European Composite Unit (EURCO)
  'XBB': 'XBB', // ZZ02 Bond Markets Unit European Monetary Unit (E.M.U.-6)
  'XBC': 'XBC', // ZZ03 Bond Markets Unit European Unit of Account 9 (E.U.A.-9)
  'XBD': 'XBD', // ZZ04 Bond Markets Unit European Unit of Account 17 (E.U.A.-17)
  'XDR': 'XDR', // INTERNATIONAL MONETARY FUND (IMF) - SDR (Special Drawing Right)
  'XPD': 'XPD', // ZZ09 Palladium
  'XPT': 'XPT', // ZZ10 Platinum
  'XTS': 'XTS', // ZZ06 Codes specifically reserved for testing purposes
  'XXX': '', // ZZ07 The codes assigned for transactions where no currency is involved

I'm not 100% sure about the usefulness of these, so I'm not adding these in this current PR, but I'm open for opinions / suggestions.

namenyi commented 3 years ago

Released in v5.0.0