From a542f88f8dcb2e5380b133fa477599b3617b8c5b Mon Sep 17 00:00:00 2001 From: andrew Date: Wed, 25 Dec 2013 22:07:33 -0500 Subject: [PATCH] allow date type to be passed as a parameter in get_historical_prices --- ystockquote.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ystockquote.py b/ystockquote.py index 7cce2d2..142c38d 100644 --- a/ystockquote.py +++ b/ystockquote.py @@ -464,11 +464,15 @@ def get_short_ratio(symbol): def get_historical_prices(symbol, start_date, end_date): """ Get historical prices for the given ticker symbol. - Date format is 'YYYY-MM-DD' + Date format is 'YYYY-MM-DD' or datetime.date() Returns a nested dictionary (dict of dicts). outer dict keys are dates ('YYYY-MM-DD') """ + + start_date = str(start_date) + end_date = str(end_date) + params = urlencode({ 's': symbol, 'a': int(start_date[5:7]) - 1,