QuantRocket logo

Disclaimer

Interactive Strategy Development

Before moving to a backtest, we can stay in a notebook a little longer and develop our code for identifying gaps.

To start with, we import and re-run our pipeline from the previous notebook:

Then we select a particular day to look at in more detail:

And we load the corresponding data object as of 9:31 that day:

Note that in Zipline, bars contain data from the previous minute. The 9:31 bar contains the 09:30:00-09:30:59 OHLCV data. Thus, this bar contains the day's opening price.

We are looking for gaps where the opening price is at least 1 standard deviation below the prior day's low and is also below the 20-day moving average. Using the pipeline output and the data object, we identify the gaps:

On this particular day, CSCO gapped down. We can check the opening price and validate it against other sources to make sure our logic was correct:


Next Up

Part 4: Zipline Strategy Code