Python Function named get_loss_dates Daily Stock Price Assignment
Question Description
(4 pts) Write a Python function named get_loss_dates. This function will read in a file containing information about the daily stock price for a specific company (e.g. APPL.txt would contain the daily stock prices for Apple). This function should return a list of the dates in which the stock price decreased (e.g. closed lower than it opened). It will have a single parameter named filename, the name of the file containing the stock data (e.g. “AAPL.txt”).
The format of the file is given below. Note that the first line will always be a “header” that contains the names of the columns, not actual data.
timestamp,open,high,low,close,volume
2018-10-26,83.7200,84.2600,81.8100,81.9600,5229616
2018-10-25,83.1800,84.5800,82.6500,83.8300,5259008
2018-10-24,82.5900,84.3000,82.1100,82.2700,5098796
def get_loss_dates(filename):
“` Returns list of dates when stock closed lower than it opened. “`
“Place your order now for a similar assignment and have exceptional work written by our team of experts, guaranteeing you A results.”
Recent Comments