Stocks

Introduction

In this project you will practice

Problem Description

You need to process daily stock prices that are stored in CSV files. Each stock is stored in a CSV file named after the stock’s ticker symbol. For example, the stock prices for Alphabet, Inc are stored in a file named GOOG.csv.

Solution Description

Write a module named stocks that includes two classes:

Finally, your stocks module should be runnable as a script that takes three command line arguments: a company’s stock symbol, a start date, and an end date.

Your script should:

Your stocks module not perform any of the script actions listed above when imported as a module.

Your program should work with CSV files formatted and named like the ones you can download from Yahoo Finace, e.g., Alphabet, Inc historical data. For your convenience you may use the following files: AAPL.csv, BAC.csv, C.csv, CSCO.csv, F.csv, FB.csv, FCAU.csv, GM.csv, GOOG.csv, JPM.csv, ORCL.csv, WFC.csv.

Here are some sample program runs:

$ python stocks.py GOOG
Stock performance of None (GOOG) from 2004-08-19 to 2017-09-21: 1777.0%.
$ python stocks.py GOOG 2017-01-01
Stock performance of None (GOOG) from 2017-01-01 to 2017-09-21: 19.7%.
$ python stocks.py GOOG 2015-01-01 2017-09-21
Stock performance of None (GOOG) from 2015-01-01 to 2017-09-21: 77.2%.

Tips and Considerations