fetch stock quotes from google finance, yahoo finance or the exchange itself
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.
Google does indeed offer an API for Google Finance, documented here: http://code.google.com/apis/finance/
It looks like it's designed around the idea of a portfolio, and I don't offhand see a way to request a quote for a specific stock. The closest fit seems to be "Retrieving specific positions."
In any case, this is not something you want to tackle with jQuery. For one thing, you will not be able to read any data from another site (e.g., that nseindia.com
site), unless there's a JSONP
script setup on the site you could exploit.
I have been using a simple REST service for getting stock quote from yahoo and i have just posted in my site for my reference. People can just go through it.