Archive

Posts Tagged ‘money’

Euro foreign exchange reference rates + historical data

February 4, 2011 Leave a comment

If you want to know how foreign currencies relate to euro, you can use the database of the European Central Bank (ECB). The good thing is that they also offer historical data, for free.

Reference rates for today in HTML

Visit http://www.ecb.int/euro.html.

Example: the line “Hungarian forint (HUF) = 270.35” means that 1 euro = 270.35 HUF.

Reference rates for today in XML

Visit http://www.ecb.int/stats/exchange/eurofxref/html/index.en.html. Here, under Latest rates, check out the link http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml.

Historical reference rates in XML, for the last 90 days

Visit http://www.ecb.int/stats/exchange/eurofxref/html/index.en.html, then http://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist-90d.xml.

Historical reference rates in XML, since 1999

Warning! This XML is quite big, don’t open it in your browser! :)

Visit http://www.ecb.int/stats/exchange/eurofxref/html/index.en.html, then http://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.xml.

How to parse the XMLs

Under http://www.ecb.int/stats/exchange/eurofxref/html/index.en.html you will find some help.

Problem with the XMLs

The only problem that I noticed is that some days (like weekends) are missing. I think these are the dates when exchanges are closed. A possible solution is to step back one day (or more) until you find an existing day and use those values.

Example: Jan 2, 2011 is missing -> step back to Jan 1, 2011 -> missing, step back to Dec 31, 2010 -> OK, exists -> use these values for Jan 2, 2011.

Credits

I read about this ECB database in this thread.

Currency converters

December 9, 2010 Leave a comment

Here I collect some links that are related to currency conversions.

In another post I will explain how to get conversion rates from PHP using the Yahoo API.

Currency names and codes [PHP]

December 3, 2010 Leave a comment

Problem

You want a combo box in your HTML page with all the currency names and codes.

Solution

The standard ISO codes can be found here. For collecting my list, I used this page. This latter page also provides the data in CSV format. I took this CSV data and transformed into PHP code:

 "UAE Dirham",
"AFN" => "Afghanistan Afghani",
"ALL" => "Albanian Lek",
"AMD" => "Armenian Dram",
"ANG" => "Netherlands Antillian Guilder",
"AOA" => "Angolan Kwanza",
"ARS" => "Argentine Peso",
"AUD" => "Australian Dollar",
"AWG" => "Aruban Guilder",
"AZM" => "Azerbaijanian Manat",
"BAM" => "Bosnia and Herzegovina Convertible Marks",
"BBD" => "Barbados Dollar",
"BDT" => "Bangladesh Taka",
"BGN" => "Bulgarian Lev",
"BHD" => "Bahraini Dinar",
"BIF" => "Burundi Franc",
"BMD" => "Bermudian Dollar",
"BND" => "Brunei Dollar",
"BOB" => "Bolivian Boliviano",
"BRL" => "Brazilian Real",
"BSD" => "Bahamian Dollar",
"BTN" => "Bhutan Ngultrum",
"BWP" => "Botswana Pula",
"BYR" => "Belarussian Ruble",
"BZD" => "Belize Dollar",
"CAD" => "Canadian Dollar",
"CDF" => "Franc Congolais",
"CHF" => "Swiss Franc",
"CLP" => "Chilean Peso",
"CNY" => "Chinese Yuan Renminbi",
"COP" => "Colombian Peso",
"CRC" => "Costa Rican Colon",
"CSD" => "Serbian Dinar",
"CUP" => "Cuban Peso",
"CVE" => "Cape Verde Escudo",
"CYP" => "Cyprus Pound",
"CZK" => "Czech Koruna",
"DJF" => "Djibouti Franc",
"DKK" => "Danish Krone",
"DOP" => "Dominican Peso",
"DZD" => "Algerian Dinar",
"EEK" => "Estonian Kroon",
"EGP" => "Egyptian Pound",
"ERN" => "Eritrea Nafka",
"ETB" => "Ethiopian Birr",
"EUR" => "euro",
"FJD" => "Fiji Dollar",
"FKP" => "Falkland Islands Pound",
"GBP" => "Pound Sterling",
"GEL" => "Georgian Lari",
"GHC" => "Ghana Cedi",
"GIP" => "Gibraltar Pound",
"GMD" => "Gambian Dalasi",
"GNF" => "Guinea Franc",
"GTQ" => "Guatemala Quetzal",
"GYD" => "Guyana Dollar",
"HKD" => "Hong Kong Dollar",
"HNL" => "Honduras Lempira",
"HRK" => "Croatian Kuna",
"HTG" => "Haiti Gourde",
"HUF" => "Hungarian Forint",
"IDR" => "Indonesian Rupiah",
"ILS" => "New Israeli Shekel",
"INR" => "Indian Rupee",
"IQD" => "Iraqi Dinar",
"IRR" => "Iranian Rial",
"ISK" => "Iceland Krona",
"JMD" => "Jamaican Dollar",
"JOD" => "Jordanian Dinar",
"JPY" => "Japanese Yen",
"KES" => "Kenyan Shilling",
"KGS" => "Kyrgyzstan Som",
"KHR" => "Cambodia Riel",
"KMF" => "Comoro Franc",
"KPW" => "North Korean Won",
"KRW" => "Korean Won",
"KWD" => "Kuwaiti Dinar",
"KYD" => "Cayman Islands Dollar",
"KZT" => "Kazakhstan Tenge",
"LAK" => "Lao Kip",
"LBP" => "Lebanese Pound",
"LKR" => "Sri Lanka Rupee",
"LRD" => "Liberian Dollar",
"LSL" => "Lesotho Loti",
"LTL" => "Lithuanian Litas",
"LVL" => "Latvian Lats",
"LYD" => "Libyan Dinar",
"MAD" => "Moroccan Dirham",
"MDL" => "Moldovan Leu",
"MGA" => "Malagasy Ariary",
"MKD" => "Macedonian Denar",
"MMK" => "Myanmar Kyat",
"MNT" => "Mongolian Tugrik",
"MOP" => "Macau Pataca",
"MRO" => "Mauritania Ouguiya",
"MTL" => "Maltese Lira",
"MUR" => "Mauritius Rupee",
"MVR" => "Maldives Rufiyaa",
"MWK" => "Malawi Kwacha",
"MXN" => "Mexican Peso",
"MYR" => "Malaysian Ringgit",
"MZM" => "Mozambique Metical",
"NAD" => "Namibia Dollar",
"NGN" => "Nigerian Naira",
"NIO" => "Nicaragua Cordoba Oro",
"NOK" => "Norwegian Krone",
"NPR" => "Nepalese Rupee",
"NZD" => "New Zealand Dollar",
"OMR" => "Rial Omani",
"PAB" => "Panama Balboa",
"PEN" => "Peruvian Nuevo Sol",
"PGK" => "Papua New Guinea Kina",
"PHP" => "Philippine Peso",
"PKR" => "Pakistan Rupee",
"PLN" => "Polish Zloty",
"PYG" => "Paraguayan Guarani",
"QAR" => "Qatari Rial",
"RON" => "Romanian Leu",
"RUB" => "Russian Ruble",
"RWF" => "Rwanda Franc",
"SAR" => "Saudi Riyal",
"SBD" => "Solomon Islands Dollar",
"SCR" => "Seychelles Rupee",
"SDD" => "Sudanese Dinar",
"SEK" => "Swedish Krona",
"SGD" => "Singapore Dollar",
"SHP" => "St Helena Pound",
"SIT" => "Slovenian Tolar",
"SKK" => "Slovak Koruna",
"SLL" => "Sierra Leone Leone",
"SOS" => "Somali Shilling",
"SRD" => "Surinam Dollar",
"STD" => "São Tome and Principe Dobra",
"SVC" => "El Salvador Colon",
"SYP" => "Syrian Pound",
"SZL" => "Swaziland Lilangeni",
"THB" => "Thai Baht",
"TJS" => "Tajik Somoni",
"TMM" => "Turkmenistan Manat",
"TND" => "Tunisian Dinar",
"TOP" => "Tonga Pa'anga",
"TRY" => "Turkish Lira",
"TTD" => "Trinidad and Tobago Dollar",
"TWD" => "New Taiwan Dollar",
"TZS" => "Tanzanian Shilling",
"UAH" => "Ukraine Hryvnia",
"UGX" => "Uganda Shilling",
"USD" => "US Dollar",
"UYU" => "Peso Uruguayo",
"UZS" => "Uzbekistan Sum",
"VEB" => "Venezuelan Bolivar",
"VND" => "Vietnamese Dong",
"VUV" => "Vanuatu Vatu",
"WST" => "Samoa Tala",
"XAF" => "CFA Franc BEAC",
"XCD" => "East Caribbean Dollar",
"XDR" => "SDR (Special Drawing Rights)",
"XOF" => "CFA Franc BCEAO",
"XPF" => "CFP Franc",
"YER" => "Yemeni Rial",
"ZAR" => "South African Rand",
"ZMK" => "Zambian Kwacha",
"ZWD" => "Zimbabwe Dollar",
);
?>

Links

The page http://www.jhall.demon.co.uk/currency/by_country.html contains some additional information. It’s very useful to find out the local currency of a given country.

Example:


Country; Co. Code; Currency; Curr. Code
Hungary; HU;       Forint;   HUF

Categories: finance, html, php Tags: ,
Follow

Get every new post delivered to your Inbox.

Join 61 other followers