1 | """Currencies |
---|
2 | """ |
---|
3 | #: Currencies according to ISO 4217 |
---|
4 | #: |
---|
5 | #: Compiled from: |
---|
6 | #: http://www.currency-iso.org/dam/downloads/table_a1.xml |
---|
7 | #: Entries without decimal units (such as funds or not officially |
---|
8 | #: traded currencies) were removed. |
---|
9 | #: |
---|
10 | #: Data published: 2014-08-15 |
---|
11 | #: |
---|
12 | #: Keys are the currency codes (as given by ISO) |
---|
13 | #: Entries have four items: |
---|
14 | #: 0: Authority maintaining the currency (normally a country) |
---|
15 | #: 1: Name of currency |
---|
16 | #: 2: Number of decimals after decimal separator |
---|
17 | #: 3: Currency nuber in ISO listing |
---|
18 | #: |
---|
19 | ISO_4217_CURRENCIES = { |
---|
20 | 'AED': ('UNITED ARAB EMIRATES', 'UAE Dirham', 2, '784'), |
---|
21 | 'AFN': ('AFGHANISTAN', 'Afghani', 2, '971'), |
---|
22 | 'ALL': ('ALBANIA', 'Lek', 2, '008'), |
---|
23 | 'AMD': ('ARMENIA', 'Armenian Dram', 2, '051'), |
---|
24 | 'ANG': ('SINT MAARTEN (DUTCH PART)', |
---|
25 | 'Netherlands Antillean Guilder', |
---|
26 | 2, |
---|
27 | '532'), |
---|
28 | 'AOA': ('ANGOLA', 'Kwanza', 2, '973'), |
---|
29 | 'ARS': ('ARGENTINA', 'Argentine Peso', 2, '032'), |
---|
30 | 'AUD': ('TUVALU', 'Australian Dollar', 2, '036'), |
---|
31 | 'AWG': ('ARUBA', 'Aruban Florin', 2, '533'), |
---|
32 | 'AZN': ('AZERBAIJAN', 'Azerbaijanian Manat', 2, '944'), |
---|
33 | 'BAM': ('BOSNIA AND HERZEGOVINA', 'Convertible Mark', 2, '977'), |
---|
34 | 'BBD': ('BARBADOS', 'Barbados Dollar', 2, '052'), |
---|
35 | 'BDT': ('BANGLADESH', 'Taka', 2, '050'), |
---|
36 | 'BGN': ('BULGARIA', 'Bulgarian Lev', 2, '975'), |
---|
37 | 'BHD': ('BAHRAIN', 'Bahraini Dinar', 3, '048'), |
---|
38 | 'BIF': ('BURUNDI', 'Burundi Franc', 0, '108'), |
---|
39 | 'BMD': ('BERMUDA', 'Bermudian Dollar', 2, '060'), |
---|
40 | 'BND': ('BRUNEI DARUSSALAM', 'Brunei Dollar', 2, '096'), |
---|
41 | 'BOB': ('BOLIVIA, PLURINATIONAL STATE OF', 'Boliviano', 2, '068'), |
---|
42 | 'BOV': ('BOLIVIA, PLURINATIONAL STATE OF', 'Mvdol', 2, '984'), |
---|
43 | 'BRL': ('BRAZIL', 'Brazilian Real', 2, '986'), |
---|
44 | 'BSD': ('BAHAMAS', 'Bahamian Dollar', 2, '044'), |
---|
45 | 'BTN': ('BHUTAN', 'Ngultrum', 2, '064'), |
---|
46 | 'BWP': ('BOTSWANA', 'Pula', 2, '072'), |
---|
47 | 'BYR': ('BELARUS', 'Belarussian Ruble', 0, '974'), |
---|
48 | 'BZD': ('BELIZE', 'Belize Dollar', 2, '084'), |
---|
49 | 'CAD': ('CANADA', 'Canadian Dollar', 2, '124'), |
---|
50 | 'CDF': ('CONGO, DEMOCRATIC REPUBLIC OF THE ', 'Congolese Franc', 2, '976'), |
---|
51 | 'CHE': ('SWITZERLAND', 'WIR Euro', 2, '947'), |
---|
52 | 'CHF': ('SWITZERLAND', 'Swiss Franc', 2, '756'), |
---|
53 | 'CHW': ('SWITZERLAND', 'WIR Franc', 2, '948'), |
---|
54 | 'CLF': ('CHILE', 'Unidad de Fomento', 4, '990'), |
---|
55 | 'CLP': ('CHILE', 'Chilean Peso', 0, '152'), |
---|
56 | 'CNY': ('CHINA', 'Yuan Renminbi', 2, '156'), |
---|
57 | 'COP': ('COLOMBIA', 'Colombian Peso', 2, '170'), |
---|
58 | 'COU': ('COLOMBIA', 'Unidad de Valor Real', 2, '970'), |
---|
59 | 'CRC': ('COSTA RICA', 'Costa Rican Colon', 2, '188'), |
---|
60 | 'CUC': ('CUBA', 'Peso Convertible', 2, '931'), |
---|
61 | 'CUP': ('CUBA', 'Cuban Peso', 2, '192'), |
---|
62 | 'CVE': ('CABO VERDE', 'Cabo Verde Escudo', 2, '132'), |
---|
63 | 'CZK': ('CZECH REPUBLIC', 'Czech Koruna', 2, '203'), |
---|
64 | 'DJF': ('DJIBOUTI', 'Djibouti Franc', 0, '262'), |
---|
65 | 'DKK': ('GREENLAND', 'Danish Krone', 2, '208'), |
---|
66 | 'DOP': ('DOMINICAN REPUBLIC', 'Dominican Peso', 2, '214'), |
---|
67 | 'DZD': ('ALGERIA', 'Algerian Dinar', 2, '012'), |
---|
68 | 'EGP': ('EGYPT', 'Egyptian Pound', 2, '818'), |
---|
69 | 'ERN': ('ERITREA', 'Nakfa', 2, '232'), |
---|
70 | 'ETB': ('ETHIOPIA', 'Ethiopian Birr', 2, '230'), |
---|
71 | 'EUR': ('SPAIN', 'Euro', 2, '978'), |
---|
72 | 'FJD': ('FIJI', 'Fiji Dollar', 2, '242'), |
---|
73 | 'FKP': ('FALKLAND ISLANDS (MALVINAS)', 'Falkland Islands Pound', 2, '238'), |
---|
74 | 'GBP': ('UNITED KINGDOM', 'Pound Sterling', 2, '826'), |
---|
75 | 'GEL': ('GEORGIA', 'Lari', 2, '981'), |
---|
76 | 'GHS': ('GHANA', 'Ghana Cedi', 2, '936'), |
---|
77 | 'GIP': ('GIBRALTAR', 'Gibraltar Pound', 2, '292'), |
---|
78 | 'GMD': ('GAMBIA', 'Dalasi', 2, '270'), |
---|
79 | 'GNF': ('GUINEA', 'Guinea Franc', 0, '324'), |
---|
80 | 'GTQ': ('GUATEMALA', 'Quetzal', 2, '320'), |
---|
81 | 'GYD': ('GUYANA', 'Guyana Dollar', 2, '328'), |
---|
82 | 'HKD': ('HONG KONG', 'Hong Kong Dollar', 2, '344'), |
---|
83 | 'HNL': ('HONDURAS', 'Lempira', 2, '340'), |
---|
84 | 'HRK': ('CROATIA', 'Croatian Kuna', 2, '191'), |
---|
85 | 'HTG': ('HAITI', 'Gourde', 2, '332'), |
---|
86 | 'HUF': ('HUNGARY', 'Forint', 2, '348'), |
---|
87 | 'IDR': ('INDONESIA', 'Rupiah', 2, '360'), |
---|
88 | 'ILS': ('ISRAEL', 'New Israeli Sheqel', 2, '376'), |
---|
89 | 'INR': ('INDIA', 'Indian Rupee', 2, '356'), |
---|
90 | 'IQD': ('IRAQ', 'Iraqi Dinar', 3, '368'), |
---|
91 | 'IRR': ('IRAN, ISLAMIC REPUBLIC OF', 'Iranian Rial', 2, '364'), |
---|
92 | 'ISK': ('ICELAND', 'Iceland Krona', 0, '352'), |
---|
93 | 'JMD': ('JAMAICA', 'Jamaican Dollar', 2, '388'), |
---|
94 | 'JOD': ('JORDAN', 'Jordanian Dinar', 3, '400'), |
---|
95 | 'JPY': ('JAPAN', 'Yen', 0, '392'), |
---|
96 | 'KES': ('KENYA', 'Kenyan Shilling', 2, '404'), |
---|
97 | 'KGS': ('KYRGYZSTAN', 'Som', 2, '417'), |
---|
98 | 'KHR': ('CAMBODIA', 'Riel', 2, '116'), |
---|
99 | 'KMF': ('COMOROS', 'Comoro Franc', 0, '174'), |
---|
100 | 'KPW': (u"KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF", |
---|
101 | 'North Korean Won', |
---|
102 | 2, |
---|
103 | '408'), |
---|
104 | 'KRW': ('KOREA, REPUBLIC OF', 'Won', 0, '410'), |
---|
105 | 'KWD': ('KUWAIT', 'Kuwaiti Dinar', 3, '414'), |
---|
106 | 'KYD': ('CAYMAN ISLANDS', 'Cayman Islands Dollar', 2, '136'), |
---|
107 | 'KZT': ('KAZAKHSTAN', 'Tenge', 2, '398'), |
---|
108 | 'LAK': (u"LAO PEOPLE'S DEMOCRATIC REPUBLIC", 'Kip', 2, '418'), |
---|
109 | 'LBP': ('LEBANON', 'Lebanese Pound', 2, '422'), |
---|
110 | 'LKR': ('SRI LANKA', 'Sri Lanka Rupee', 2, '144'), |
---|
111 | 'LRD': ('LIBERIA', 'Liberian Dollar', 2, '430'), |
---|
112 | 'LSL': ('LESOTHO', 'Loti', 2, '426'), |
---|
113 | 'LTL': ('LITHUANIA', 'Lithuanian Litas', 2, '440'), |
---|
114 | 'LYD': ('LIBYA', 'Libyan Dinar', 3, '434'), |
---|
115 | 'MAD': ('WESTERN SAHARA', 'Moroccan Dirham', 2, '504'), |
---|
116 | 'MDL': ('MOLDOVA, REPUBLIC OF', 'Moldovan Leu', 2, '498'), |
---|
117 | 'MGA': ('MADAGASCAR', 'Malagasy Ariary', 2, '969'), |
---|
118 | 'MKD': ('MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF', 'Denar', 2, '807'), |
---|
119 | 'MMK': ('MYANMAR', 'Kyat', 2, '104'), |
---|
120 | 'MNT': ('MONGOLIA', 'Tugrik', 2, '496'), |
---|
121 | 'MOP': ('MACAO', 'Pataca', 2, '446'), |
---|
122 | 'MRO': ('MAURITANIA', 'Ouguiya', 2, '478'), |
---|
123 | 'MUR': ('MAURITIUS', 'Mauritius Rupee', 2, '480'), |
---|
124 | 'MVR': ('MALDIVES', 'Rufiyaa', 2, '462'), |
---|
125 | 'MWK': ('MALAWI', 'Kwacha', 2, '454'), |
---|
126 | 'MXN': ('MEXICO', 'Mexican Peso', 2, '484'), |
---|
127 | 'MXV': ('MEXICO', 'Mexican Unidad de Inversion (UDI)', 2, '979'), |
---|
128 | 'MYR': ('MALAYSIA', 'Malaysian Ringgit', 2, '458'), |
---|
129 | 'MZN': ('MOZAMBIQUE', 'Mozambique Metical', 2, '943'), |
---|
130 | 'NAD': ('NAMIBIA', 'Namibia Dollar', 2, '516'), |
---|
131 | 'NGN': ('NIGERIA', 'Naira', 2, '566'), |
---|
132 | 'NIO': ('NICARAGUA', 'Cordoba Oro', 2, '558'), |
---|
133 | 'NOK': ('SVALBARD AND JAN MAYEN', 'Norwegian Krone', 2, '578'), |
---|
134 | 'NPR': ('NEPAL', 'Nepalese Rupee', 2, '524'), |
---|
135 | 'NZD': ('TOKELAU', 'New Zealand Dollar', 2, '554'), |
---|
136 | 'OMR': ('OMAN', 'Rial Omani', 3, '512'), |
---|
137 | 'PAB': ('PANAMA', 'Balboa', 2, '590'), |
---|
138 | 'PEN': ('PERU', 'Nuevo Sol', 2, '604'), |
---|
139 | 'PGK': ('PAPUA NEW GUINEA', 'Kina', 2, '598'), |
---|
140 | 'PHP': ('PHILIPPINES', 'Philippine Peso', 2, '608'), |
---|
141 | 'PKR': ('PAKISTAN', 'Pakistan Rupee', 2, '586'), |
---|
142 | 'PLN': ('POLAND', 'Zloty', 2, '985'), |
---|
143 | 'PYG': ('PARAGUAY', 'Guarani', 0, '600'), |
---|
144 | 'QAR': ('QATAR', 'Qatari Rial', 2, '634'), |
---|
145 | 'RON': ('ROMANIA', 'New Romanian Leu', 2, '946'), |
---|
146 | 'RSD': ('SERBIA', 'Serbian Dinar', 2, '941'), |
---|
147 | 'RUB': ('RUSSIAN FEDERATION', 'Russian Ruble', 2, '643'), |
---|
148 | 'RWF': ('RWANDA', 'Rwanda Franc', 0, '646'), |
---|
149 | 'SAR': ('SAUDI ARABIA', 'Saudi Riyal', 2, '682'), |
---|
150 | 'SBD': ('SOLOMON ISLANDS', 'Solomon Islands Dollar', 2, '090'), |
---|
151 | 'SCR': ('SEYCHELLES', 'Seychelles Rupee', 2, '690'), |
---|
152 | 'SDG': ('SUDAN', 'Sudanese Pound', 2, '938'), |
---|
153 | 'SEK': ('SWEDEN', 'Swedish Krona', 2, '752'), |
---|
154 | 'SGD': ('SINGAPORE', 'Singapore Dollar', 2, '702'), |
---|
155 | 'SHP': ('SAINT HELENA, ASCENSION AND TRISTAN DA CUNHA', |
---|
156 | 'Saint Helena Pound', |
---|
157 | 2, |
---|
158 | '654'), |
---|
159 | 'SLL': ('SIERRA LEONE', 'Leone', 2, '694'), |
---|
160 | 'SOS': ('SOMALIA', 'Somali Shilling', 2, '706'), |
---|
161 | 'SRD': ('SURINAME', 'Surinam Dollar', 2, '968'), |
---|
162 | 'SSP': ('SOUTH SUDAN', 'South Sudanese Pound', 2, '728'), |
---|
163 | 'STD': ('SAO TOME AND PRINCIPE', 'Dobra', 2, '678'), |
---|
164 | 'SVC': ('EL SALVADOR', 'El Salvador Colon', 2, '222'), |
---|
165 | 'SYP': ('SYRIAN ARAB REPUBLIC', 'Syrian Pound', 2, '760'), |
---|
166 | 'SZL': ('SWAZILAND', 'Lilangeni', 2, '748'), |
---|
167 | 'THB': ('THAILAND', 'Baht', 2, '764'), |
---|
168 | 'TJS': ('TAJIKISTAN', 'Somoni', 2, '972'), |
---|
169 | 'TMT': ('TURKMENISTAN', 'Turkmenistan New Manat', 2, '934'), |
---|
170 | 'TND': ('TUNISIA', 'Tunisian Dinar', 3, '788'), |
---|
171 | 'TOP': ('TONGA', u"Pa'anga", 2, '776'), |
---|
172 | 'TRY': ('TURKEY', 'Turkish Lira', 2, '949'), |
---|
173 | 'TTD': ('TRINIDAD AND TOBAGO', 'Trinidad and Tobago Dollar', 2, '780'), |
---|
174 | 'TWD': ('TAIWAN, PROVINCE OF CHINA', 'New Taiwan Dollar', 2, '901'), |
---|
175 | 'TZS': ('TANZANIA, UNITED REPUBLIC OF', 'Tanzanian Shilling', 2, '834'), |
---|
176 | 'UAH': ('UKRAINE', 'Hryvnia', 2, '980'), |
---|
177 | 'UGX': ('UGANDA', 'Uganda Shilling', 0, '800'), |
---|
178 | 'USD': ('VIRGIN ISLANDS (U.S.)', 'US Dollar', 2, '840'), |
---|
179 | 'USN': ('UNITED STATES', 'US Dollar (Next day)', 2, '997'), |
---|
180 | 'UYI': ('URUGUAY', |
---|
181 | 'Uruguay Peso en Unidades Indexadas (URUIURUI)', |
---|
182 | 0, |
---|
183 | '940'), |
---|
184 | 'UYU': ('URUGUAY', 'Peso Uruguayo', 2, '858'), |
---|
185 | 'UZS': ('UZBEKISTAN', 'Uzbekistan Sum', 2, '860'), |
---|
186 | 'VEF': ('VENEZUELA, BOLIVARIAN REPUBLIC OF', 'Bolivar', 2, '937'), |
---|
187 | 'VND': ('VIET NAM', 'Dong', 0, '704'), |
---|
188 | 'VUV': ('VANUATU', 'Vatu', 0, '548'), |
---|
189 | 'WST': ('SAMOA', 'Tala', 2, '882'), |
---|
190 | 'XAF': ('GABON', 'CFA Franc BEAC', 0, '950'), |
---|
191 | 'XCD': ('SAINT VINCENT AND THE GRENADINES', |
---|
192 | 'East Caribbean Dollar', |
---|
193 | 2, |
---|
194 | '951'), |
---|
195 | 'XOF': ('TOGO', 'CFA Franc BCEAO', 0, '952'), |
---|
196 | 'XPF': ('WALLIS AND FUTUNA', 'CFP Franc', 0, '953'), |
---|
197 | 'YER': ('YEMEN', 'Yemeni Rial', 2, '886'), |
---|
198 | 'ZAR': ('SOUTH AFRICA', 'Rand', 2, '710'), |
---|
199 | 'ZMW': ('ZAMBIA', 'Zambian Kwacha', 2, '967'), |
---|
200 | 'ZWL': ('ZIMBABWE', 'Zimbabwe Dollar', 2, '932') |
---|
201 | } |
---|
202 | |
---|
203 | |
---|
204 | def get_decimal_units(currency_code): |
---|
205 | """Get the number of decimals after decimal separator for a currency. |
---|
206 | |
---|
207 | Pass in a three-letter currency code. Returns a number. |
---|
208 | """ |
---|
209 | return ISO_4217_CURRENCIES[currency_code][2] |
---|