Objective: Write a program that will read and parse data from afile, then make use of lists to solve a problem.
Problem: Using python, write a program thatwill compute the maximum possible profit for a stock trade usinghistorical data on a selection of companies. We would like to findthe maximum possible profit that we could have gained, if we hadmade an ideal investment (if we ever finish that time machine). Wemust determine the largest increase in value from the purchase dateto the sell date, using historical information. We will use thedaily low price to purchase and the daily high price to sell astock. We will use actual freely-available stock data stored in.CSV (comma separated values) format. A significant part of theexercise is learning to read and parse data from files and toformat output.
1. You will have to run your program on all of the data sets togenerate the required results. If the program does not exist, printa warning message.
2. Read in all the data from the file and parse the data,extracting the useful bits, into one or more lists.
3. Determine the largest gain possible in a stock price bycomparing Low values as the purchase price and High values as thesale price.
4. Report for each stock symbol (AMZN, MSFT, TSLA, and AAPL) thepurchase and sale days, the purchase and sale prices, profit pershare, and the ratio of the change in value.
5. Continue to request file names until the user enters a blankname (empty string), then exit the program
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 tryagain.
Please enter the data file name: GOOG.csv
The maximum profit is 319.16 per share
Buy on (date) at a price of 970.11
Sell on (date) at a price of 1289.27
Change in value ratio: 1.329
Included a small sample table out of what is provided.
Without the use of panda or numpy please. Thankyou in advance
Answer to Objective: Write a program that will read and parse data from a file, then make use of lists to solve a problem. Problem…