Skip to content

Instantly share code, notes, and snippets.

@clholgat
Created March 11, 2011 21:34
Show Gist options
  • Save clholgat/866620 to your computer and use it in GitHub Desktop.
Save clholgat/866620 to your computer and use it in GitHub Desktop.
blarg
from datetime import datetime
def build_request_url(symbol, start_date, end_date):
"""
This function should take a stock symbol as a string
along with the start and end dates as Python dates
and return the yahoo csv download url.
"""
values = { 'symbol' : symbol,
'a' : start_date.month-1,
'b' : start_date.day,
'c' : start_date.year,
'd' : end_date.month-1,
'e' : end_date.day,
'f' : end_date.year }
return u'http://ichart.finance.yahoo.com/table.csv?s=%(symbol)s&a=%(a)i&b=%(b)i&c=%(c)i&d=%(d)i&e=%(e)i&f=%(f)i&g=d&ignore=.csv' % values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment