Skip to content
All library documents

Installing Zipline on Windows and Running a Moving-Average Backtest

Article QuantInsti blog

Summary

This tutorial walks through setting up Zipline for backtesting on Windows. It covers creating a Conda environment, installing Jupyter and Zipline, configuring a Quandl data key, and ingesting historical data. It also describes using Pyfolio to produce a performance report. The backtest example uses a simple moving-average crossover: buy when price crosses above the average and close the position when it crosses below.

The article is primarily an installation guide, and its setup instructions use older software versions and a specific data source. It flags a Zipline date issue that requires changing a benchmark script, and notes that data ingestion must be adapted to each provider and market schedule. Backtest results and strategy performance are not reported, so the tutorial demonstrates a workflow rather than evidence that the example strategy is profitable. It also notes that Zipline does not readily support a transition to live trading.

Key ideas

  • Zipline and Pyfolio can provide a Python workflow for historical strategy backtests and return analysis.
  • A Conda environment isolates the Python and library versions used by a project.
  • The example strategy enters on an upward moving-average cross and exits on a downward cross.
  • Data ingestion depends on the provider and market schedule, and the article describes a date-related Zipline workaround.
  • A backtest workflow does not establish that a strategy will perform well in live markets.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.