The script below will download FREE Historical Stock Quotes from Yahoo Finance base on the list of stock quotes you entered.
Most of the websites out there offer you to Historical Quotes download but you have to pay for it. In eTraderZone, we are not only show you how to download FREE Historical Quotes, but also give you the source code so that you can modify it to suit to you own needs.
Historical Stock Quotes
Historical Quotes downloaded will be stored into a individual spreadsheet according to the stock symbol name. This is one of the many great option provided by Yahoo Finance, while many others service provider charge you for download but Yahoo Finance give it for free. You just need this little tool to help you to download in bulk.
Go to http://finance.yahoo.com/ and key in the stock quote and click on the Historical Prices on the left pane, scroll to the bottom and you should see the link “Download To Spreadsheet”.
By default 5 years daily data will be downloaded but you can alter the timeframes. The name of the file is “table.csv” and the data downloaded contains Date, Open, High, Low, Close, Volume and Adj Close, it’s in descending order by Date.
Login or Register to download this Excel Spreadsheet
In order to download historical quotes in batch, we need to understand and study the URL parameters provided by Yahoo Finance. Let’s take a look at the URL string below:
The URL string above will download daily historical data for INTC (Intel) from 6th of July 1986 (Intel went IPO) until 5th March 2008 into a file call table.csv.
Let’s break down the URL string and take a look of the parameter one by one.
http://ichart.finance.yahoo.com/table.csv – The default URL to download historical stock quotes, it won’t work if you change the ‘table.csv’ to something else.
s – This is where you can specify your stock quote, if you want to download stock quote for Microsoft, just enter it as ‘s=MSFT’
a – This parameter is to get the input for the start month. ’00′ is for January, ’01′ is for February and so on.
b – This parameter is to get the input for the start day, this one quite straight forward, ’1′ is for day one of the month, ’2′ is for second day of the month and so on.
c – This parameter is to get the input for the start year
d – This parameter is to get the input for end month, and again ’00′ is for January, ’02′ is for February and so on.
e – This parameter is to get the input for the end day
f – This parameter is to get the input for the end year
g – This parameter is to specify the interval of the data you want to download. ‘d’ is for daily, ‘w’ is for weekly and ‘m’ is for monthly prices. The default is ‘daily’ if you ignore this parameter.
With all the parameters above, you can now construct a URL to download historical prices for any stock quotes you want. But if you are going to download all historical prices for a stock quotes from day one onward (eg: Intel), you don’t need to crack your head to look for information such as when is Intel went IPO. You just need to ignore the start and end date as follow:
If you only specify the start date and ignore the end date, it will download everything right from the start date until the most current prices.