Created
November 11, 2017 03:14
-
-
Save kanzitelli/66ddfb8860267f66ca8e6243b771af31 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
tickers = ['AAPL', 'AMZN', 'GOOGL', 'IBM'] | |
data_source = 'yahoo' | |
date_2016 = (datetime.datetime(2016, 1, 1), datetime.datetime(2016, 12, 31)) | |
all_weekdays_2016 = pd.date_range(start = date_2016[0], end = date_2016[1], freq='B') # here we get all business days from 1.JAN.2016 to 31.DEC.2016 | |
data_2016 = data.DataReader(tickers, data_source, date_2016[0], date_2016[1]) | |
close_prices_2016 = data_2016.ix['Adj Close'].reindex(all_weekdays_2016).dropna() # here we take Adjusted Close Price, take business days and drop NA values | |
close_prices_2016.head() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment