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, 23.06.2019 01:50
Write a program that uses a random number generator to generate a two digit positive integer and allows the user to perform one or more of the following operations: a. double the number. b. reverse the digits of the number. c. raise the number to the power of 2, 3, or 4. d. sum the digits of the number. e. if the number is a two-digit number, then raise the first digit to the power of the second digit. f. if the number is a three-digit number and the last digit is less than or equal to 4, then raise the first two digits to the power of the last digit. after performing an operation if the number is less than 10, add 10 to the number. also, after each operation determine if the number is prime. each successive operation should be performed on the number generated by the last operation. your program should not contain any global variables and each of these operations must be implemented by a separate function. also, your program should be menu driven. 7. (fraction calculator) write a program that
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
How do you write an argumentative essay about the importance of free enterprise ?
Answers: 1
question
Computers and Technology, 23.06.2019 07:00
To produce a starlight effect in her photograph, lina should choose the filter for her camera.
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
*! 20 points! *jeff wants to create a website with interactive and dynamic content. which programming language will he use? a. dhtml b. html c. css d. javascript
Answers: 1
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
question
Chemistry, 07.12.2019 23:31
question
Spanish, 07.12.2019 23:31