Computers and Technology
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

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 10:20, vuqepete4528
Shown below is the start of a coding region within the fist exon of a gene. 5'--3' 3'--5' how many cas9 pam sequences are present?
Answers: 1
image
Computers and Technology, 22.06.2019 22:10, Metlife
Asequential circuit contains a register of four flip-flops. initially a binary number n (0000 ≤ n ≤ 1100) is stored in the flip-flops. after a single clock pulse is applied to the circuit, the register should contain n + 0011. in other words, the function of the sequential circuit is to add 3 to the contents of a 4-bit register. design and implement this circuit using j-k flip-flops.
Answers: 1
image
Computers and Technology, 23.06.2019 13:30, alannaamarriee
Jace needs to answer a question on square roots to win a quiz. how can he use a spreadsheet to find the square root of 786? a. use the functions round and count b. create a table and chart c. use the function sqrt d. use the function now
Answers: 3
image
Computers and Technology, 23.06.2019 14:30, naomi20044
Select the correct answer. andy received a potentially infected email that was advertising products. andy is at risk of which type of security threat? a. spoofing b. sniffing c. spamming d. phishing e. typo-squatting
Answers: 2
Do you know the correct answer?
Objective: Write a program that will read and parse data from a file, then make use of lists to solv...

Questions in other subjects: