subject

Python

Problem

Expected Duration: 3-6 hours

A comma-separated value file stocks_data. csv contains historical data on the Adjusted Closing Price for 3 stocks daily from Jan 2, 2009 to Dec 31,2018. The stocks are Apple (APPL), Microsoft (MSFT) and IBM (IBM).

A snippet from the data file looks like the following:

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

You can see that each row has a symbol, date and closing price, but the stock data is not sorted by symbol, date or price.

Your task has two main parts:

Part I

For each stock, print the following information to the console and to a text file called stock_summary. txt:

the max price and date it occurs
the min price and date it occurs
the average (mean) price
Part 2

Print to the console and append to the output 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
Example output looks like the following:

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

Submission

Submit the source code for your program in Canvas as main. py, and your output file as stock_summary. txt. Submit these two in a file called stock. zip.

Be sure to use the file names specified here. No other names are acceptable.

Grading

Late submissions receive 50 points and no feedback.

0-20 points: design doc is correct and complete
21-100: all automated and manual tests pass

Tests

load data from csv input file
generate summary data for each stock (counts as 3 test cases)
compute the highest of all stocks
compute the lowest of all the stocks
use functions to minimize obvious repeated code
write output to file txt
writes output to console (same data and format as #6)
use loops in code
use appropriate modules and builtin functions to simplify code
code quality test passes with 0 errors
Points to Ponder

Thinking about files and the program:

What does your program do if the input file does not exist?
What does your program do if the output file does not exist?
What mathematical equations, forms or libraries did you use in your program?
If you worked on this program again, what would you do differently?

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 14:30
Create a pseudocode design to prompt a student for their student id and the titles of the three classes they want to add. the solution should display the student’s id and a total bill. • bill a student using the following rules: o students can only add up to 3 classes at a time.
Answers: 3
question
Computers and Technology, 23.06.2019 09:00
Design a class tictactoe that: holds the following information about the game: two-dimensional array (3 by 3), and winner. add additional variables as needed. includes the functions to perform the various operations on objects. for example, function to print the board, getting the move, checking if move is valid, determining if there is a winner after each move. add additional operations as needed. includes constructor(s). write the functions of the class, and write a program that uses the class. the program should declare an object of type tictactoe. the program will create the board and store it in the array. the program will allow two players to play the tic-tac-toe game. after every valid move update the array, check if there is a winner. if there is no winner and no tie, then print the board again to continue.
Answers: 2
question
Computers and Technology, 23.06.2019 14:30
Open this link after reading about ana's situation. complete each sentence using the drop-downs. ana would need a minimum of ato work as a translator. according to job outlook information, the number of jobs for translators willin the future.
Answers: 3
question
Computers and Technology, 23.06.2019 21:20
For positive constants a and b, the force between two atoms in a molecule is given f(r) = −a r2 + b r3 , where r > 0 is the distance between the atoms. note: a and b are upper case letters. (a) find f '(r) = (b) find the critical point for f(r). r = (c) find f ''(r) = (d) find the value of r so that f ''(r) = 0.
Answers: 1
You know the right answer?
Python

Problem

Expected Duration: 3-6 hours

A comma-separated...
Questions
question
Mathematics, 12.11.2020 16:10
Questions on the website: 13722366