Last active
July 28, 2016 06:07
-
-
Save txthai/8647fd74aedfbe5b888c5d64380af3c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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