Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 715
Amit Kumar Jha Avatar asked Aug 22 '09 14:08

Amit Kumar Jha


People also ask

Are Yahoo Finance quotes real-time?

Finance users can now view their current brokerage portfolios with free, real-time quotes. To obtain a real-time quote on Yahoo! Finance, users simply need to select the "Real-time ECN" option from the quotes drop-down menu on the Yahoo!

How do I get Yahoo Finance stock price in Google Sheets?

=YHFINANCE is a spreadsheet formula that allows you to pull the Finance data directly into a Google Sheets spreadsheet. =YHFINANCE formula works in a similar way to =GOOGLEFINANCE for fetching current or historical securities information.

Where does GOOGLEFINANCE pull data from?

The Finance Data is obtained from various data providers and feeds into a unified format available for serving to users. Google Finance ranks search suggestions on the basis of three main elements: Exact matches to queries, Google Search impressions, and Google Finance impressions.

Does GOOGLEFINANCE API still work?

The Google Finance Gadget API has been officially deprecated since October 2012, but as of April 2014, it's still active. It is completely dead as of March 2022. Note that if your application is for public consumption, using the Google Finance API is against Google's terms of service.


1 Answers

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.

like image 152
dreeves Avatar answered Sep 20 '22 18:09

dreeves