(Solved) : Objective Write Program Read Parse Data File Make Use Lists Solve Problem Problem Using Py Q41874635 . . .

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

Reading data…

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


DateOpenHighLowCloseAdj. CloseVolume10/24/20181104.251106.121048.741050.711050.71198240010/25/20181071.791110.981069.551095.571095.57



Included a small sample table out of what is provided.

Without the use of panda or numpy please. Thankyou in advance

Expert Answer

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…

Leave a Comment


We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us