Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 2: Stocks (Again) [6 points] Recall the stocks question from lab 4: Let's assume I'm playing the stock market buy low, sell high. I'm
Question 2: Stocks (Again) [6 points] Recall the stocks question from lab 4: Let's assume I'm playing the stock market buy low, sell high. I'm a day trader, so I want to get in and out of a stock before the day is done, and Write a function stocks(s) that emits the two trades in chronological order what you think I should buy at and sell at in order to maximize my profit. Repeat this question, but load your data from a.csv file on a remote server. The.csv file will be formatted like so: Date, Open, High, Low, Close,Adj Close, volume 2013-12-24, 16295780195, 16360.599689, 16 295780195, 16357 . 5498e5, 16357 . 549825, 3364000e 2013-12-26,16370.969727,16483.800320,16370.969727,16479.880859,16479.880859, 50160e 2013-12-27,16486.369141,16529.e09766,16461.230469,16478.410156,16478.410156,47230e 2013-12-30, 16484.5097%, 16504. 3496es,16476. 869141,16504,289e63,16524.2sse 53,5420288 Assume that you buy at the value in the "Low" column, and sell at the value in "High". You may not buy and sell on the same day. Your functions, stocks(s) should take in a string of the filename of a CSV file containing the data. You may assume the file is in chronological order. In [ ] : | # Write your answer here. This cell should print the values of the trades. They should be [15340.69043, 26616.710938] In I J: trades stocks("D3I.csv") print (trades) The cell below is how the autograder will be evaluating your answer. It only needs to be correct to two decimal places. Make sure you return a list of floating point numbers. In [ ]: | assert round(trades[e], assert round(trades[1], 2) 2) 15348.69 26616.71
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started