Home > finance, php > Currencies of Yahoo exchanges

Currencies of Yahoo exchanges

Problem

Using Yahoo! Finance, we can ask info about a given stock, e.g. MSFT. The current price is, for instance, 27.98. But it is given in what currency? USD, EUR, CAD? Unfortunately it’s not indicated…

Solution

As I figured it out, these values are given in local currencies. Thus, we need to know in which country the exchange is located. Using Yahoo! Finance, the exchanges are indicated with a suffix. See http://finance.yahoo.com/exchanges for a list of all suffixes.

Example: let’s take the stock name “UG.PA” with value 30.04. “.PA” stands for “Paris Stock Exchange”, thus 30.04 is given in euro (EUR).

To facilitate life, using the page http://finance.yahoo.com/exchanges, I collected all the necessary information in an array structure. I also added the currencies. So, using this structure, you can easily figure out the currency, once you have the suffix of the exchange. If there is no suffix, we can suppose it’s in USD.

```<?php
# id  => description, country, currency
# source: http://finance.yahoo.com/exchanges
# collected by Jabba Laci (https://ubuntuincident.wordpress.com/2010/12/17/currencies-of-yahoo-exchanges/)
\$financeSymbolMoney = array(
".CBT" => array("Chicago Board of Trade", "United States of America", "USD"),
".CME" => array("Chicago Mercantile Exchange", "United States of America", "USD"),
".NYB" => array("New York Board of Trade", "United States of America", "USD"),
".CMX" => array("New York Commodities Exchange", "United States of America", "USD"),
".NYM" => array("New York Mercantile Exchange", "United States of America", "USD"),
".OB"  => array("OTC Bulletin Board Market", "United States of America", "USD"),
".PK"  => array("Pink Sheets", "United States of America", "USD"),
".BA"  => array("Buenos Aires Stock Exchange", "Argentina", "ARS"),
".VI"  => array("Vienna Stock Exchange", "Austria", "EUR"),
".AX"  => array("Australian Stock Exchange", "Australia", "AUD"),
".SA"  => array("BOVESPA - Sao Paolo Stock Exchange", "Brazil", "BRL"),
".SN"  => array("Santiago Stock Exchange", "Chile", "CLP"),
".SS"  => array("Shanghai Stock Exchange", "China", "CNY"),
".SZ"  => array("Shenzhen Stock Exchange", "China", "CNY"),
".CO"  => array("Copenhagen Stock Exchange", "Denmark", "DKK"),
".NX"  => array("Euronext", "France", "EUR"),
".PA"  => array("Paris Stock Exchange", "France", "EUR"),
".BE"  => array("Berlin Stock Exchange", "Germany", "EUR"),
".BM"  => array("Bremen Stock Exchange", "Germany", "EUR"),
".DU"  => array("Dusseldorf Stock Exchange", "Germany", "EUR"),
".F"   => array("Frankfurt Stock Exchange", "Germany", "EUR"),
".HM"  => array("Hamburg Stock Exchange", "Germany", "EUR"),
".HA"  => array("Hanover Stock Exchange", "Germany", "EUR"),
".MU"  => array("Munich Stock Exchange", "Germany", "EUR"),
".SG"  => array("Stuttgart Stock Exchange", "Germany", "EUR"),
".DE"  => array("XETRA Stock Exchange", "Germany", "EUR"),
".HK"  => array("Hong Kong Stock Exchange", "Hong Kong", "HKD"),
".BO"  => array("Bombay Stock Exchange", "India", "INR"),
".NS"  => array("National Stock Exchange of India", "India", "INR"),
".JK"  => array("Jakarta Stock Exchange", "Indonesia", "IDR"),
".TA"  => array("Tel Aviv Stock Exchange", "Israel", "ILS"),
".MI"  => array("Milan Stock Exchange", "Italy", "EUR"),
".MX"  => array("Mexico Stock Exchange", "Mexico", "MXN"),
".AS"  => array("Amsterdam Stock Exchange", "Netherlands", "EUR"),
".NZ"  => array("New Zealand Stock Exchange", "New Zealand", "NZD"),
".OL"  => array("Oslo Stock Exchange", "Norway", "NOK"),
".SI"  => array("Singapore Stock Exchange", "Singapore", "SGD"),
".KS"  => array("Korea Stock Exchange", "South Korea", "KRW"),
".KQ"  => array("KOSDAQ", "South Korea", "KRW"),
".BC"  => array("Barcelona Stock Exchange", "Spain", "EUR"),
".BI"  => array("Bilbao Stock Exchange", "Spain", "EUR"),
".MF"  => array("Madrid Fixed Income Market", "Spain", "EUR"),
".MC"  => array("Madrid SE C.A.T.S.", "Spain", "EUR"),
".MA"  => array("Madrid Stock Exchange", "Spain", "EUR"),
".ST"  => array("Stockholm Stock Exchange", "Sweden", "SEK"),
".SW"  => array("Swiss Exchange", "Switzerland", "CHF"),
".TWO" => array("Taiwan OTC Exchange", "Taiwan", "TWD"),
".TW"  => array("Taiwan Stock Exchange", "Taiwan", "TWD"),
".L"   => array("London Stock Exchange", "United Kingdom", "GBP"),
);
?>
```
Categories: finance, php Tags: , ,