import pandas as pd
import matplotlib.pyplot as plt
small_avg = 30
large_avg = 60
start_date = '2014-01-03'
end_date = '2015-08-20'
pricing = get_pricing(['SPY'], start_date=start_date, end_date=end_date, frequency='daily', fields='close_price')
# panda.Panel.iloc allows me to cut off the beginning of the algo.
# An easier to read version without the iloc:
# plt.plot(pricing, '-',
# pd.rolling_mean(pricing, small_avg), '-',
# pd.rolling_mean(pricing, large_avg), '-')
plt.plot(pricing.iloc[large_avg::], '-',
pd.rolling_mean(pricing, small_avg).iloc[large_avg::], '-',
pd.rolling_mean(pricing, large_avg).iloc[large_avg::], '-')