I am not sure whether this take-home assessment is the same as an online assessment.
Implement a single function that returns a list containing every date between first_date and last_date, together with the stock's opening and closing prices for each date.
The rough interface was:
def solution(first_date, last_date): # both inputs are strings and must be parsed
...
The output looked roughly like this:
["1928-02-07 200.00 203.00", "1928-02-08 204.00 205.00"]
All of this information had to be obtained through real HTTP requests. The prompt supplied a URL, along with documentation where I could inspect an example response.
There were bonus points for improving efficiency. My interpretation was to add a cache so that data already requested would not be requested again.
The function also needed to handle cases such as request failures, request timeouts, and bad data.
I had not written much Python code for handling bare HTTP requests before, so I got stuck for a while. It may help to become a little familiar with that beforehand.
Discussion
Loading comments…