Created
December 29, 2020 00:35
-
-
Save madeleine68/44a70be79433dfd62b5050a402ae9be4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
start = dt.datetime(20XX, 1, 1) | |
end = dt.datetime.now() | |
for ticker in tickers: | |
if not os.path.exists('stock_dfs/{}.csv'.format(ticker)): | |
df = pdr.DataReader(ticker.replace('.', '-'), 'yahoo', start, end) | |
df.reset_index(inplace=True) | |
df.set_index("Date", inplace=True) | |
df.to_csv('stock_dfs/{}.csv'.format(ticker)) | |
else: | |
print('Already have {}'.format(ticker)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment