subject
Computers and Technology, 20.11.2020 16:40 krlx

Objective: Write a program that will read and parse data from a file, then make use of lists to solve a problem. Problem: Using python, write a program that will compute the maximum possible profit for a stock trade using historical data on a selection of companies. We would like to find the maximum possible profit that we could have gained, if we had made an ideal investment (if we ever finish that time machine). We must determine the largest increase in value from the purchase date to the sell date, using historical information. We will use the daily low price to purchase and the daily high price to sell a stock. For this assignment, we will use actual freelyavailable stock data stored in .CSV (comma separated values) format from Yahoo finance. A significant part of the exercise is learning to read and parse data from files and to format output.
1. Request the name for the input data file to be used to determine the results. You will have to run your program on all of the data sets to generate the required results. If the program does not exist, print a warning message and allow the user to try again.
2. Read in all the data from the requested file and parse the data; extracting the useful bits into one or more lists.
3. Use the data to determine the largest gain possible in a stock price by comparing Low values as the purchase price and High values as the sale price.
4. Report for each stock symbol (AAPL, AMZN, GOOG, MSFT, and TSLA) the purchase and sale days, the purchase and sale prices, profit per share, and the ratio of the change in value. Enter these results as submission comments in Blackboard.
5. Continue to request file names until the user enters a blank name (empty string), then exit the program.
6. Use good functional style and suitable variable names.
7. In the submission comment, answer the question: If you could travel back in time and invest in one of the five stocks listed, which stock would you pick?
Note: Assume that you must keep stocks for at least one day, no buying and selling on the same day. The data files contain more data than is needed, be sure to use the correct values. Be sure to move the data files into the same folder as your code so that your program can find the data files.
Example Output and Results: Please enter the data file name: BLARG. csv
Error Reading data ...
The file does not exist. Please check the name and try again.
Please enter the data file name: GOOG. csv
Reading data ...

The maximum profit is 1045.88 per share
Buy on 2015-01-12 at a price of 486.23
Sell on 2020-02-19 at a price of 1532.11
Change in value ratio: 3.151

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:30
List the five on-board vehicle subsystems
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
Which one of the following is the most accurate definition of technology? a electronic tools that improve functionality b electronic tools that provide entertainment or practical value c any type of tool that serves a practical function d any type of tool that enhances communication
Answers: 1
question
Computers and Technology, 23.06.2019 15:20
An ou structure in your domain has one ou per department, and all the computer and user accounts are in their respective ous. you have configured several gpos defining computer and user policies and linked the gpos to the domain. a group of managers in the marketing department need different policies that differ from those of the rest of the marketing department users and computers, but you don't want to change the top-level ou structure. which of the following gpo processing features are you most likely to use? a, block inheritance b, gpo enforcement c, wmi filtering d, loopback processing
Answers: 3
question
Computers and Technology, 24.06.2019 13:10
Write a program that has a conversation with the user. the program must ask for both strings and numbers as input. the program must ask for at least 4 different inputs from the user. the program must reuse at least 3 inputs in what it displays on the screen. the program must perform some form of arithmetic operation on the numbers the user inputs. turn in your .py file as well as a screenshot of your program's output. include comments in your code to explain how it works an example program run might look like (have fun with this and be creative): ‘what is your name? ’ “josh” ‘, josh. what is your favorite color? ’ “green” ‘mine too. do you also like ice cream? ’ “no” ‘josh, how old are you? ’ “40” ‘ and how many siblings do you have? ’’ “3” ‘that means you are one of 4 kid(s). is green the favorite color of anyone else in your house? ’
Answers: 3
You know the right answer?
Objective: Write a program that will read and parse data from a file, then make use of lists to solv...
Questions
Questions on the website: 13722361