a guest Aug 19th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- import pandas as pd
- import quandl
- import datetime
- import matplotlib.pyplot as plt
- import numpy as np
- import seaborn as sns
- %matplotlib widget
- sns.set(palette = 'bright',color_codes=True)
- start = datetime.datetime(2010,1,1)
- end = datetime.date.today()
- quandl.ApiConfig.api_key = "xmMnhixLSRSxxd24G_cU"
- a = "AAPL"
- aapl = quandl.get("WIKI/" + a, start_date = start, end_date = end)
- i = "IBM"
- ibm = quandl.get("WIKI/" + i, start_date = start, end_date = end)
- am = "AMZN"
- amzn = quandl.get("WIKI/" + am, start_date = start, end_date = end)
- stocks = pd.concat([aapl['Adj. Close'], ibm['Adj. Close'], amzn['Adj. Close']], axis=1)
- log_ret = np.log(stocks/stocks.shift(1))
- log_ret = log_ret.dropna()
RAW Paste Data