Downloading Stock Quotes using Yahoo API in Excel VBA

This is quite interesting. Yahoo provides user free online access to company stock listed on Stock Exchange via Yahoo Finance. It is easy and very simple to download free stock quotes, closing, opening prices and other important figures. Whenever requested, Yahoo Finance returns a .csv file (Comma separated values).

This is how we replicate the same in Excel VBA.






In the above code, replace Stocks(i) , with the desired stock symbol. StartDate &  EndDate specifies time frame of the data.

In case, if one is interested to download data for stock A listed on particular stock exchange. In that case, get the stock symbol and suffix a code (given in the table) and use it in place of Stocks(i).

More information can be obtained from following two places.
http://www.gummy-stuff.org/Yahoo-data.htm
http://www.jarloo.com/yahoo_finance/

Having gone through the websites, I found something very interesting. Let me share this with everybody.
chart.yahoo.com/table.csv?s=MSFT 
If we click on the above link, we get a table.csv file with Microsoft Stock quotes from the last trading date. This will be helpful in getting historical data and is static.

http://finance.yahoo.com/d/quotes.csv?s=AAPL+GOOG+MSFT&f=[bunch of special tags]
If one wishes to download and get, dynamic changing data, then he or she should try the above link. Refer gummy or jarloo to get the list of special tags.

Happy VBAing