Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow date type to be passed as a parameter in get_historical_prices #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ystockquote.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down