# https://github.com/quantopian/zipline/issues/1579
import pandas_market_calendars as mcal
assets = ['XLB','XLE']
register('ETFs', assets)
etfs_bundle = load('US_stock_bundle')
start_dt = pd.Timestamp('2014-02-03', tz = 'utc')
end_dt = pd.Timestamp('2017-05-31', tz = 'utc')
etfs_data = DataPortal(etfs_bundle.asset_finder, mcal.get_calendar('NYSE'),
etfs_bundle.equity_daily_bar_reader.first_trading_day,
equity_minute_reader=etfs_bundle.equity_minute_bar_reader,
equity_daily_reader=etfs_bundle.equity_daily_bar_reader,
adjustment_reader=etfs_bundle.adjustment_reader)
etfs_symbols = []
for ticker in assets:
etfs_symbols.append(etfs_data.asset_finder.lookup_symbol(ticker,end_dt))
etfs_pricing = etfs_data.get_history_window(etfs_symbols,end_dt,1000,'1d','close','daily')
etfs_pricing.asfreq('D').dropna().plot(figsize=(15,10),grid=True)