Yahoo finance API seems to be the most popular since Google Finance API has been deprecated (have been discontinued in October 2012). If you want to try another provider, feel free to look at 96 Stocks APIs: Bloomberg, NASDAQ and E*TRADE article.

Legality of use of Yahoo! data on commercial website?

Yahoo Community Manager response

I had difficulties to understand if it’s allowed to use Yahoo Finance API for own project. A response of a Yahoo Community Manager on 2009 is NO:

2 The data that we provide is not available for distribution at all off of Yahoo!
Robyn Tippins
Community Manager, YDN

The same Robyn Tippins also mentioned on previous comment why the webservice is online:

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.

Yahoo-finance API terms

Yahoo APIs Terms of Use

Yahoo APIs Terms of Use prevent to “derive income from the use of the Yahoo APIs”, check Clause 1.7.4. below for details, but don’t seems to prevent the use for free purpose.

  1. Licensed Uses and Restrictions […]
    1. YOU SHALL NOT: […]
      1. Sell, lease, share, transfer, or sublicense the Yahoo APIs or access or access codes thereto or derive income from the use or provision of the Yahoo APIs, whether for direct commercial or monetary gain or otherwise, unless the API Documents specifically permit otherwise or Yahoo gives prior, express, written permission

Redistribution agreement with the exchanges

An interesting comment explains redistribution rights of Yahoo financial datas:

You cannot use their data for redistribution no matter what the case is (even if its a free website). I run three financial websites (including one free one) and can tell you that the issue is not with Yahoo! Finance, but with who they pull their data from, which is typically either straight from the exchanges or from a data aggregator (like Morningstar, Thomson Reuters, Interactive Data, etc.). You are required to sign redistribution agreements and pay redistribution fees with each exchange you display prices from even if you are pulling the data from a data aggregator and not directly from the exchange. Point being, you need to go directly to the exchanges or to a data aggregator that offers redistribution (still need to sign redistribution agreements). Note that your are still considered to be redistribution data even if you are just displaying the prices on your website and not actually allowing the users to download the data.
Its pretty unfortunate - especially when you are providing an educational service as one of our sites does (to schools), but its how the exchanges make money and it wouldn’t be fair to companies like ours that pay the redistribution fees for people to just be able to launch free financial apps.
Redistribution of delayed equities prices is actually free anyways, but you still have to sign a redistribution agreement with the exchanges. You will also need to purchase access to a web service that offers the prices. You wont be able to find a decent quality web service without paying a fee, which is typically based on the number of hits (and sometimes data points) you consume.

How to fetch Stock Quotes ?

Then, now you know the risks, let’s chat about how to fetch stock quotes. I know 3 ways to fetch Stock quotes from Yahoo API:

  • Yahoo YQL Finance API: use YQL (Yahoo Query Language) and data table from, see example
  • Yahoo CSV Finance API: get csv results from, see example
  • Yahoo webservice API: get json from see example

Yahoo YQL Finance API

Under the hood, the YQL Open Data Table is really just using the yahoo CSV API to actually get the stock prices. You can check on Github and YQL data table.

The interesting point on using YQL is that you can personalize your response format (json or xml) and properties. See Getting stock information with YQL and open data tables article from YQL Blog for more details.

You can use the YahooFinanceAPI.php implementation.

What is the query limit on Yahoo’s Finance API?

YQL Usage information and limits

What this means:

  • Using the Public API (without authentication), you are limited to 2,000 requests per hour per IP (or up to a total of 48,000 requests a day).
  • Using the Private API (with OAuth authentication using an API key), you are limited to 20,000 requests per hour per IP and you are limited to 100,000 requests per day per API Key.

Issues Using YQL and Open Data Tables

Unreachable raises HTTP/1.0 400 Bad Request

We’ve faced serious issues with YQL data tables. The main issue was the availability of When is unreachable, YQL is unable to retrieve data.

If you use the YQL console you’ll have the following response No definition found for Table

An older post on YQL Forum mention this issue in 2009.

When it occured, as temporary fix, we updated the url of YQL to fetch directly the table from yql-tables GitHub repository. To achieve it we use following YQL statement:

use "" as quotes;
select * from quotes where symbol in ("CIEL3.SA")

unstable Quotes delay

Another big issues we’ve found was the delay of quotes. I’ve personaly opened an issue to YDN about it:

When I check LastTradeTime property, it returns unconsistent hours of trade, for example “12:46pm”, next request returns “12:44pm” and next request “2:42pm”. All of these 3 requests ran on a period of 2 min.

Yahoo CSV Finance API

To make a request to the CSV API, you can either do that from here:{SYMBOLS}&f={DATA THAT WE WANT}



Yahoo webservice API

/!\ Update 2016-12-20: Seems that Yahoo has interrupted this webservice on middle of 2016

The Yahoo finance webservice API is pretty straight forward comparing to both solutions above. I’ve never found any official documentation about, but if you want to fetch stock quotes you’ll obtain following response:

            "issuer_name":"Cielo S.A.",
            "issuer_name_lang":"Cielo S.A.",
            "name":"CIELO       ON      NM",

You can request multiple quotes using separated commas params:,AAPL/quote?format=json&view=detail

Historical data

For historical data you can use something like:

where the FROM date is: &a=11&b=15&c=2016 and the TO date is: &d=11&e=19&f=2016 Be careful, fields a and d use index of month and not number, then for December use 11, and for January use 00.

This API does not provide quote of current day.

Creating a Yahoo Finance chart

Some nice posts provide tips and tricks to create Yahoo Finance charts. One of them is the “Yahoo Finance Chart” by Colin Eberhardt.

Yahoo-finance Chart

It uses the open source D3FC, a collection of components that make it easy to build interactive charts with D3. See an example of Candlestick series using D3FC.

I didn’t investigate yet but maybe the yuilibrary can provide nice tools to achieve it also.


There are plenty of Online Services to get quotes, but I don’t know any free and stable.

openexchangerates seems simple to integrate and has an affordable price.

Let me know on comment if you have other suggestions.

Victor Dias

Sharing mobile Experiences

Follow me