Project 4: Stock Exchange Data
Problem Statement
You need simple summary information on three of your stocks: Apple, Microsoft, and IBM. What you have is an unsorted csv file listing the daily adjusted closing price for 10 years.
For each stock, print the following information to both the console and the file stock_summary.txt
:
- the max price and date it occurs
- the min price and date it occurs
- the average (mean) price
Add the following footer to both the console and the file stock_summary.txt
:
- The stock among the 3 with the highest overall closing price and its date
- The stock among the 3 with the lowest overall closing price and its date
Your input file (stocks_data.csv) covering the period from 01/02/2009 to 12/31/2018 is in the following format:
Symbol | Date | Adj. Close |
---|---|---|
MSFT | 4/16/2014 | 35.807358 |
MSFT | 6/21/2010 | 20.752356 |
IBM | 2/10/2009 | 68.930023 |
AAPL | 2/14/2018 | 164.227203 |
IBM | 6/13/2017 | 141.24379 |
IBM | 12/26/2017 | 142.835663 |
MSFT | 4/1/2009 | 15.053272 |
AAPL | 4/17/2009 | 15.445643 |
Directions
-
Develop your algorithm in detail before writing any code. Read the problem statement very closely several times to make sure you understand all the small details.
- Accept the assignment in GitHub by opening the Assignment Invitation URL link provided in your Canvas assignment.
- This video provides step-by-step directions for completing GitHub assignments.
-
From inside your GitHub repository, click the Work in Repl.it button.
-
Open the
exercise.py
file in thesrc
directory, and begin coding your solution. -
Update the module docstring with your information.
-
Test your program by running it and examining the output.
-
Format your output to both the output file and the console exactly as shown below. Replace the placeholders with specific values.
AAPL ---- Max: price date Min: price date Ave: mean IBM ---- Max: price date Min: price date Ave: mean MSFT ---- Max: price date Min: price date Ave: mean Highest: Symbol price date Lowest: Symbol price date
-
Click the Version Control icon in the left menu, type a memo in the What did you change text box, then click Commit & push
- Navigate back to your GitHub repository, open the Actions tab, and check your program for accuracy.
- A green icon indicates your code passed all test cases. Congratulations!
- A red icon indicates your code needs to be revised and resubmitted.