Homework Assignment 11

A Program to Analyze Stock Data

CS 1510
Introduction to Computing
Fall Semester 2014

Due: Friday, December 5, at 5:00 PM


This assignment asks you to write a program from scratch. The focus is on breaking a problem down and using the tools you have learned -- strings, functions, files, and lists -- to implement solutions to the problem.

Spec: Data Mining Stock Prices

Data mining is the process of sifting through data to find information and patterns. In the business world, it is used in an effort to make better management decisions. In the last decade, many sports organizations have begun to use it in an effort to find undervalued players. For this project, you will do basic data mining for financial analysis related to stock prices.

Write a program that finds the best six months and worst six months for a company, in terms of monthly average stock price.

What follows are instructions for getting stock data and advice for designing your program.

Getting Data.

  1. Go to http://finance.yahoo.com/.
  2. Enter a company name or stock ticker symbol in the search field, and press "Search Finance".
  3. On the landing page, select "Historical Prices" from the menu on the left.
  4. At the bottom of the next page, below the table of prices, select "Download to Spreadsheet".
  5. Save this page using your browser's "Save as..." option. Name the file company-data.csv.
  6. Put this file in the folder where your program file will live.

The file should contain data that looks like this:

    Date,Open,High,Low,Close,Volume,Adj Close

Designing Your Program.

The main program can follow the simple input-process-output pattern that we've seen throughout the course. Each step in the pattern should be a function.

Some Python advice:

Name your program mine_stock_prices.py.

Demonstration of Correctness

Start a fresh Python shell. Run the final version of your program on at least input files retrived from Yahoo! Finance.

Save your shell to a text file named interactions.py.


By the due date and time, submit:

Use the on-line submission system.

Make sure that your program meets the course programming standards.

Eugene Wallingford ..... wallingf@cs.uni.edu ..... November 28, 2014