SHARE
TWEET

Untitled

a guest Aug 19th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import pandas as pd
  2. import quandl
  3. import datetime
  4. import matplotlib.pyplot as plt
  5. import numpy as np
  6. import seaborn as sns
  7. %matplotlib widget
  8. sns.set(palette = 'bright',color_codes=True)
  9.  
  10. start = datetime.datetime(2010,1,1)
  11. end = datetime.date.today()
  12. quandl.ApiConfig.api_key = "xmMnhixLSRSxxd24G_cU"
  13.  
  14. a = "AAPL"
  15. aapl = quandl.get("WIKI/" + a, start_date = start, end_date = end)
  16.  
  17. i = "IBM"
  18. ibm = quandl.get("WIKI/" + i, start_date = start, end_date = end)
  19.  
  20. am = "AMZN"
  21. amzn = quandl.get("WIKI/" + am, start_date = start, end_date = end)
  22.  
  23. stocks = pd.concat([aapl['Adj. Close'], ibm['Adj. Close'], amzn['Adj. Close']], axis=1)
  24. log_ret = np.log(stocks/stocks.shift(1))
  25. log_ret = log_ret.dropna()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top