Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Research environment: list stocks charts in grid plot

from datetime import datetime

I do not know how to post figures. The following code lists a basket of stocks' price history and take log(price), plot each in the grid of plots #to eyebow the trends.

import math
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

def print_all(dataset):
if len(dataset.index)<60:
print dataset[:60]
else:
print dataset[:60]
print dataset[60:len(dataset.index)]

listspy=['AAPL','MSFT','AMZN','FB','GOOG','CMCSA','INTC','CSCO','AMGN','KHC','CELG','WBA','CHTR','GILD','PCLN','AVGO']
df=pd.DataFrame(get_pricing(listspy, start_date='2016-12-1', end_date='2017-5-25')["price"])
df.columns = listspy
df=np.log(df)
df2=df-df.ix[0]

print df2.head()
plt.close()
plt.figure(figsize=(10,10),dpi=1000)
n=4
m=int(math.ceil(len(listspy)/(n*1.0)))
print m
f,pltarr=plt.subplots(m+1,n)
for i in range(0,m):
for j in range(0,n):
k=i*n+j
if k>=len(listspy):
break
pltarr[i,j].plot(df2[[k]])
pltarr[i,j].set_title(listspy[k])