Today we want to introduce you to the Pipeline. This new API opens up a world of new algorithm opportunities. You can now dynamically select portfolios from the entire universe of 8000+ securities enabling larger portfolios and easy evaluation of both long and short positions.
The Pipeline enables you to evaluate 8000+ securities on a daily basis, using price, volume, fundamental data, and soon will include all data purchased from the Quantopian Store. You can calculate factors (scalar values) and filters (boolean values) to rank and select the stocks you want to track in real time throughout the day. All of the data calculated in your pipeline can be used during the day's trading.
The full documentation is here. Some highlights that you should know:
- Factors and filters are calculated using daily pricing, volume and fundamentals data. In backtesting, they are calculated in bulk, once per year. Although the values are calculated in advance, the platform passes the values needed, when they are needed, to avoid any look ahead bias. This allows the system to be performant in the face of thousands of calculations each day.
- We've started working on a library of factors for you to get started with. These include simple moving average, VWAP and RIS. This library will continue to grow, and as everything is in Zipline, you should feel free to contribute. The more factors you share, the faster the library will grow.
- Custom factors can also be calculated using pricing, volume, fundamentals data, and soon will include data purchased from the Quantopian Store.
- Factors and filters are passed via pipeline_output and are given to you as a dataframe. The index is all securities that pass any screens set, the columns are any factor or filter added to the pipeline.
- There is currently no limit to the number of factors and filters you can pass, however there is a limit on processing time available to you in handle_data (50 seconds) and before_trading_start (5 minutes). We have increased the amount of time allotted to before_trading_start as part of this new API. Your pipeline will begin to generate data when pipeline_output is called the first time. We recommend doing this in before_trading_start, and then passing the results as needed via context.
- An algorithm's real time updates are still limited to 500 securities. You should use the pipeline API in conjunction with update_universe to narrow down to the securities that you need minutely data on each day. We anticipate increasing this limit in the future as well.
- The pipeline API is a work in progress. We wanted to get it to you as soon as possible, but there are known limitations. All of these are in progress and will be completed as soon as possible.
- The pipeline API is not currently available in research, Quantopian paper trading, or IB paper or live trading.
- Open price does not currently work when creating factors (high, low, close and volume do.)
- All price data available to the pipeline API is split and dividend adjusted. This has shed some light on dividend data issues, including some dividends in foreign currencies.
- The pipeline API is not currently available in research, Quantopian paper trading, or IB paper or live trading.
- We have a number of examples to help explain the details. More will be coming. To get you started, attached is a price and volume ranking example that I wrote based on this forum post. This has been a guide post user request as it calculates a couple of custom factors, filters the universe and then longs the top 5% and shorts the bottom 5%.
- I will be hosting a webinar on the API on Thursday, October 8th to walk through the details of the API and answer questions. Sign up to join and learn more.
This is the API I first talked about back in May. Over the past months, I’ve tested it with a full range of quants — from novices in the community to some of the contest winners all the way to professional quants. To all of you who’ve helped out along the way, your feedback was invaluable. Thank you.