from zipline.pipeline import Pipeline from zipline.pipeline.data import USEquityPricing from zipline.pipeline.factors import SimpleMovingAverage # Create a pipeline that computes the 30-day moving average of close price def make_pipeline(): close_price = USEquityPricing.close.latest ma_30 = SimpleMovingAverage(inputs=[close_price], window_length=30) return Pipeline(columns={'ma_30': ma_30}) # Add the pipeline to the engine and run it from zipline.pipeline.engine import SimplePipelineEngine from zipline.pipeline.loaders import USEquityPricingLoader from zipline.pipeline.data import EquityPricing from zipline.pipeline.domain import US_EQUITIES from zipline.data import bundles loader = USEquityPricingLoader( bundle=bundles.load('quandl'), equity_calendar=US_EQUITIES.calendar, adjust_for_dividends=True, ) engine = SimplePipelineEngine( get_loader=lambda col: loader, calendar=US_EQUITIES.calendar.all_sessions, asset_finder=bundles.load('quandl').asset_finder, ) start_date = pd.Timestamp('2015-01-01', tz='utc') end_date = pd.Timestamp('2019-01-01', tz='utc') pipeline = make_pipeline() results = engine.run_pipeline(pipeline, start_date, end_date)In this example, we create a pipeline that computes the 30-day moving average of close price for all US equities available in a dataset. We then add the pipeline to a engine and run it over a specific time period. The results of the pipeline will be returned in a pandas DataFrame. The package library used is `zipline.pipeline`.