fetch stock quotes from google finance, yahoo finance or the exchange itself

Amit Kumar Jha picture Amit Kumar Jha · Aug 22, 2009 · Viewed 39.7k times · Source

I am building a web based trading system where buy and sell signals would be generated by reading quotes from either Yahoo finance, google finance or the exchange(NSE of India) itself.My first preference would be to fetch data from this url:

http://www.nseindia.com/content/equities/niftywatch.htm

the page on the site uses tables and i want to fetch data for a particular stock by using class/id of a particular row. Now the problem is I can't figure out how to fetch data from a diffrent domain on my server. I use jquery at the client side, on server-side I use ASP.Net in VB. So please help me out and suggest how do i fetch stock quotes from the above source. Even if i can get access to the table on the above url, my work will be done. Please help. Thanks a lot in advance.

P.S.: Just noticed on google finance that they stream real time quote for this particular exchange, so if it is easy to fetch data from google(I understand that they have apis for virtually their every service) then please explain the same.

Answer

dreeves picture dreeves · Aug 24, 2009

Here's how to grab historical daily stock prices (up through today) from Yahoo Finance in CSV format:

http://ichart.finance.yahoo.com/table.csv?s=AAPL

where AAPL is the ticker symbol.

You can limit what that returns with some additional parameters:

  • s - Ticker symbol. This is the only parameter that isn't optional.

    Start date for historical prices:

  • a - Month number, starting with 0 for January.

  • b - Day number, eg, 1 for the first of the month.

  • c - Year.

    End date for historical prices (default is the most current available closing price):

  • d - Month number, starting with 0 for January.

  • e - Day number, eg, 1 for the first of the month.

  • f - Year.

    And finally, the frequency of historical prices:

  • g - Possible values are 'd' for daily (the default), 'w' for weekly, and 'm' for monthly.