Skip to content

Instantly share code, notes, and snippets.

@txthai
Last active July 28, 2016 06:07
Show Gist options
  • Save txthai/8647fd74aedfbe5b888c5d64380af3c9 to your computer and use it in GitHub Desktop.
Save txthai/8647fd74aedfbe5b888c5d64380af3c9 to your computer and use it in GitHub Desktop.
def pull_data():
ticker_symbols, start_date, end_date, data_source, directory, file_extension = set_variables()
start = string_to_date_time(start_date)
end = string_to_date_time(end_date)
for ticker_symbol in ticker_symbols:
df = web.DataReader(ticker_symbol, data_source, start, end)
save_data(df, directory, ticker_symbol, start_date, end_date, file_extension)
def string_to_date_time(s):
sy = int(s[:4])
sm = int(s[5:7])
sd = int(s[8:])
return datetime.datetime(sy, sm, sd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment