38

I've being using this feed for a long time, I believe Apple does it as well in one of the mac widgets. but what is really curious is that I simply can't find any documentation for it, I've tried google and everything.

http://finance.yahoo.com/webservice/v1/symbols/allcurrencies/quote

I can see people using different parameters like view=basic date=Ymd; currency=true but it's horrible there isn't anything official.

For now I am using these parameters:

format=json and callback=list sometimes...

But it is still a mystery for me. Does anyone know the real truth about it because it seems Yahoo is trying to hide it somewhere else :)

Rubén
  • 34,714
  • 9
  • 70
  • 166
zanona
  • 12,345
  • 25
  • 86
  • 141
  • Are you just looking for the documentation of the API call? – NT3RP Feb 27 '11 at 02:57
  • yes I am only looking for a documented API for this service which fits perfectly my needs by returning JSON or XML containing all currencies related to USD – zanona Feb 27 '11 at 21:21
  • 1
    i am dealing with the same problem here.i have a question can we get data from that yahoo link mentioned in your question? – ichanduu Oct 17 '12 at 12:12

8 Answers8

23

From the research that I've done, there doesn't appear to be any documentation available for the API you're using. Depending on the data you're trying to get, I'd recommend using Yahoo's YQL API for accessing Yahoo Finance (An example can be found here). Alternatively, you could try using this well documented way to get CSV data from Yahoo Finance.

EDIT:

There has been some discussion on the Yahoo developer forums and it looks like there is no documentation (emphasis mine):

The reason for the lack of documentation is that we don't have a Finance API. It appears some have reverse engineered an API that they use to pull Finance data, but they are breaking our Terms of Service (no redistribution of Finance data) in doing this so I would encourage you to avoid using these webservices.

At the same time, the URL you've listed can be accessed using the YQL console, though I'm not savvy enough to know how to extract URL parameters with it.

NT3RP
  • 15,262
  • 9
  • 61
  • 97
  • hi Nicholas, thanks for the information, as far as I could see the links you've provided only deal with stock information, unfortunately I think that won't solve my problem, since I need currency rates information like the link provided before, not stock :( – zanona Feb 27 '11 at 21:20
  • Apologies, I'll keep looking. :) – NT3RP Feb 27 '11 at 21:27
  • yes, thanks for digging deeper Nicolas, I really can't see why they would avoid the usage for the feed, anyway...it might be a good idea to create a bridge that will change the results based on custom parameters passed, at least for personal use. It still a bit frustrating have this kind of thing flying around the web without any support, but thanks again for your help – zanona Mar 04 '11 at 17:38
  • If you want a tutoral and C# example of using YQL take a look here: http://www.jarloo.com/get-yahoo-finance-api-data-via-yql/ . Also more info on the CSV API in C# can be found here http://www.jarloo.com/yahoo_finance/ – Kelly Feb 28 '12 at 16:57
  • 1
    To be clear, is it effectively **illegal** to access any Yahoo currency conversion data? – AmpT Mar 10 '14 at 19:33
18

ATTENTION !!!

SERVICE SUSPENDED BY YAHOO

I now use a free account at https://currencybeacon.com/ that lets me use the API commercially with up to 5000 free requests a month (that is around a request every 10 minutes).

Outdated solution (no longer valid)

Get from Yahoo a JSON or XML that you can parse from a REST query.

You can exchange from any to any currency and even get the date and time of the query using the YQL (Yahoo Query Language).

https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20csv%20where%20url%3D%22http%3A%2F%2Ffinance.yahoo.com%2Fd%2Fquotes.csv%3Fe%3D.csv%26f%3Dnl1d1t1%26s%3Dusdeur%3DX%22%3B&format=json&callback=

This will bring an example like below:

{
 "query": {
  "count": 1,
  "created": "2016-02-12T07:07:30Z",
  "lang": "en-US",
  "results": {
   "row": {
    "col0": "USD/EUR",
    "col1": "0.8835",
    "col2": "2/12/2016",
    "col3": "7:07am"
   }
  }
 }
}

You can try the console

I think this does not break any Term of Service as it is a 100% yahoo solution.

FedeKrum
  • 435
  • 1
  • 6
  • 15
  • excellent , I was struggling to achieve exactly like this . How did you get the display format of columns like f=nl1d1t1 this parameter. I tried various things but couldnt find any reference for this. Any thoughts? – user2695433 Oct 13 '17 at 07:15
  • looks like Yahoo deprecated this great service – walv Nov 05 '17 at 05:31
  • 2
    You are right !! I got this today. {"query":{"count":1,"created":"2017-11-12T22:50:18Z","lang":"en-us","results":{"row":{"col0":"Yahoo! - 403 Forbidden -- error 403It has come to our attention that this service is being used in violation of the Yahoo Terms of Service. As such","col1":" the service is being discontinued. For all future markets and equities data research","col2":" please refer to finance.yahoo.com."}}}} – FedeKrum Nov 12 '17 at 22:52
  • Console dead as well – Michael Chourdakis Aug 24 '18 at 07:31
  • yes !!!!. It looks that Yahoo is killing their children !!!! YQL Console The YQL Console is no longer available. You may continue to use YQL via our APIs. Please see the documentation here: https://developer.yahoo.com/yql/guide. – FedeKrum Aug 26 '18 at 17:28
9

This could help: http://finance.yahoo.com/d/quotes.csv?e=.csv&f=c4l1&s=EURUSD=X,GBPUSD=X It will return csv file:

"EUR",1.2972
"GBP",1.6034

Or if you need json: Yahoo csv parser

estrar
  • 1,373
  • 4
  • 12
  • 37
Sergey Dirin
  • 435
  • 6
  • 12
  • how to bind your two links, when I tap test button it works perfect) but how can I get json instead csv with direct link? – Matrosov Oleksandr Apr 07 '15 at 21:27
  • [This is a json query](https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20csv%20where%20url%3D%22http%3A%2F%2Ffinance.yahoo.com%2Fd%2Fquotes.csv%3Fe%3D.csv%26f%3Dc4l1%26s%3DUSDEUR%3DX%22%3B&format=json&diagnostics=true&callback=) I made it using [Yahoo csv parser](http://developer.yahoo.com/yql/console/?q=select%20%2a%20from%20csv%20where%20url%3D%22http%3A%2F%2Ffinance.yahoo.com%2Fd%2Fquotes.csv%3Fe%3D.csv%26f%3Dc4l1%26s%3DEURUSD%3DX%2CGBPUSD%3DX%22#h=select%20%2a%20from%20csv%20where%20url%3D%22http%3A//finance.yahoo.com/d/quotes.csv%3Fe%3D.csv%26f%3Dc4l1%26s%3DUSDEUR%3DX%22%3B) – Sergey Dirin Apr 10 '15 at 06:32
  • But how get direct link? – Matrosov Oleksandr Apr 10 '15 at 08:25
  • What do you mean by direct link? Why this link is not direct? – Sergey Dirin Apr 10 '15 at 10:20
  • ok I mean direct link like when you set that link to your address line in your browser and get JSON. using your link I need to navigate to parser and press test button, just then I receive JSON – Matrosov Oleksandr Apr 10 '15 at 11:26
  • [This](https://query.yahooapis.com/v1/public/yql?q=select%20%2A%20from%20csv%20where%20url%3D%22http%3A%2F%2Ffinance.yahoo.com%2Fd%2Fquotes.csv%3Fe%3D.csv%26f%3Dc4l1%26s%3DUSDEUR%3DX%22%3B&format=json&diagnostics=true&callback=) link does that – Sergey Dirin May 01 '15 at 06:28
7

I'm developing an application that needs currency conversion, and been using Open Exchange Rates because I wouldn't be paying since the app is in testing. But as of September 2012 Open Exchange Rates is gonna be paid for non-personal, so I checked out that they were using the Yahoo Finance Webservice (the one that "doesn't exist") and looking for documentation on it got here, and opted to use YQL.

Using YQL with the Yahoo Finance table (yahoo.finance.quotes) linked by NT3RP, currencies appear with symbol="ISOCODE=X", for example: "ARS=X" for Argentine Peso, "AUD=X" for Australian Dollar. "USD=X" doesn't exist, but it would be 1, since the rest are rates against USD.

The "price" value on the OP API is in the field "LastTradePriceOnly" of the table. For my application I used the "Ask" field.

Einacio
  • 3,502
  • 1
  • 17
  • 21
4

Updated query for Yahoo! Finance,

https://query1.finance.yahoo.com/v7/finance/quote?&symbols=USD,CAD,EUR,XMR&fields=regularMarketPrice

returns

{
"quoteResponse": {
    "result": [
        {
            "language": "en-US",
            "region": "US",
            "quoteType": "ETF",
            "quoteSourceName": "Delayed Quote",
            "triggerable": true,
            "exchange": "PCX",
            "exchangeTimezoneName": "America/New_York",
            "exchangeTimezoneShortName": "EDT",
            "gmtOffSetMilliseconds": -14400000,
            "market": "us_market",
            "esgPopulated": false,
            "firstTradeDateMilliseconds": 1170340200000,
            "priceHint": 2,
            "regularMarketTime": 1628712000,
            "regularMarketPrice": 35.56,
            "fullExchangeName": "NYSEArca",
            "tradeable": false,
            "sourceInterval": 15,
            "exchangeDataDelayedBy": 0,
            "marketState": "PRE",
            "symbol": "USD"
        },
        {
            "language": "en-US",
            "region": "US",
            "quoteType": "ETF",
            "quoteSourceName": "Delayed Quote",
            "triggerable": true,
            "exchange": "PCX",
            "exchangeTimezoneName": "America/New_York",
            "exchangeTimezoneShortName": "EDT",
            "gmtOffSetMilliseconds": -14400000,
            "market": "us_market",
            "esgPopulated": false,
            "firstTradeDateMilliseconds": 1320935400000,
            "priceHint": 2,
            "regularMarketTime": 1411675200,
            "regularMarketPrice": 95.879,
            "fullExchangeName": "NYSEArca",
            "tradeable": false,
            "sourceInterval": 15,
            "exchangeDataDelayedBy": 0,
            "marketState": "PRE",
            "symbol": "CAD"
        },
        {
            "language": "en-US",
            "region": "US",
            "quoteType": "INDEX",
            "triggerable": false,
            "exchange": "NYS",
            "exchangeTimezoneName": "America/New_York",
            "exchangeTimezoneShortName": "EDT",
            "gmtOffSetMilliseconds": -14400000,
            "market": "us_market",
            "esgPopulated": false,
            "firstTradeDateMilliseconds": 1543501800000,
            "priceHint": 4,
            "regularMarketTime": 0,
            "regularMarketPrice": 0.0,
            "fullExchangeName": "NYSE",
            "tradeable": false,
            "sourceInterval": 15,
            "exchangeDataDelayedBy": 0,
            "marketState": "PRE",
            "symbol": "EUR"
        },
        {
            "language": "en-US",
            "region": "US",
            "quoteType": "ECNQUOTE",
            "quoteSourceName": "Delayed Quote",
            "triggerable": true,
            "exchange": "NMS",
            "exchangeTimezoneName": "America/New_York",
            "exchangeTimezoneShortName": "EDT",
            "gmtOffSetMilliseconds": -14400000,
            "market": "us_market",
            "esgPopulated": false,
            "firstTradeDateMilliseconds": 1493213400000,
            "fullExchangeName": "NasdaqGS",
            "tradeable": false,
            "sourceInterval": 15,
            "exchangeDataDelayedBy": 0,
            "marketState": "PRE",
            "symbol": "XMR"
        }
    ],
    "error": null
}

}

pingle60
  • 726
  • 7
  • 9
  • 1
    For currency pairs like USD-XMR, https://query1.finance.yahoo.com/v7/finance/quote?&symbols=XMR-USD, – pingle60 Aug 12 '21 at 12:41
  • 1
    This is actually working, but keep in mind this is against their policy. Those APIs are reverse engineered and should no longer be used according to Yahoo. Therefore there existing NO official docs anymore. – Melroy van den Berg Jul 13 '22 at 20:38
4

As NT3RP told us that:

... we (Yahoo!) don't have a Finance API. It appears some have reverse engineered an API that they use to pull Finance data, but they are breaking our Terms of Service...

So I just thought of sharing this site with you:
http://josscrowcroft.github.com/open-exchange-rates/
[update: site has moved to - http://openexchangerates.org]

This site says:

No access fees, no rate limits, no ugly XML - just free, hourly updated exchange rates in JSON format
[update: Free for personal use, a bargain for your business.]

I hope I've helped and this is of some use to you (and others too). : )

zeFree
  • 2,129
  • 2
  • 31
  • 39
2

As of 2022, I was successful using:

You can also request multiples pairs in a single call:

Notes:

  • Delayed. Not to be used for realtime quotes or trading information;
  • Check ['spark']['result'][0]['meta']['regularMarketTime'] to get the quote timestamp;
  • If yahoo is not a requirement, you can use https://assets.ino.com/data/quote/?format=json&s=FOREX_EURGBP;
  • Links found sniffing XHR network requests while browsing Forex websites;
Pedro Lobito
  • 94,083
  • 31
  • 258
  • 268
1

I have used this URL to obtain multiple currency market quotes.

http://finance.yahoo.com/d/quotes.csv?e=.csv&f=c4l1&s=USD=X,CAD=X,EUR=X

"USD",1.0000
"CAD",1.2458
"EUR",0.8396

They can be parsed in PHP like this:

$symbols = ['USD=X', 'CAD=X', 'EUR=X'];
$url = "http://finance.yahoo.com/d/quotes.csv?e=.csv&f=c4l1&s=".join($symbols, ',');

$quote = array_map( 'str_getcsv', file($url) );

foreach ($quote as $key => $symb) {
    $symbol = $quote[$key][0];
    $value = $quote[$key][1];
}
Liam Hogan
  • 324
  • 4
  • 13