script to download Yahoo Finance data

dan roberts bro092 at
Wed Jun 30 04:38:06 CEST 2004


This is my first Python project so please bear with me. I need to
download data from Yahoo Finance in CSV format. The symbols are
provided in a text file, and the project details are included below.
Does anyone have some sample code that I could adapt?

Many thanks in advance,

/*---NEED TO DO------*/
Considering IBM as an example, the steps are as follows.

A. Part 1 - download 'Historical Prices' from
1. Get the Start Date from the form at the top of this page,
(I can provide the end date.)
2. Click on Get Prices
3. Then finally click on Download to Spreadsheet and save the file
with a name like IBM_StartDate_EndDate.csv.
(2) and (3) are equivalent to using this link directly,
Can you please post an example of a loop that would do the above for a
series of company symbols, saved in a text file?

B. Part 2 - download 'Options' from
This seems more difficult because the data is in html format (there's
no option to download CSV files). What's the easiest/best way to take
care of this?

More information about the Python-list mailing list