Photo by Rodion Kutsaev on Unsplash
Quantopian is one of the most popular online algo trading platforms and communities today. It provides the great backtesting environment where you can experiment with your idea, build algorithms and even participate in the contest, as well as share the idea and discuss it with smart people there.
One of the things many people have asked Alpaca during the beta program is how to run the algorithms that they built in Quantopian platform for their own purpose, not just for the contest. While Quantopian has built so much in the platform, they are so great to share the internal framework as open source zipline.
Today, I wanted to share our newest open source libraries for Quantopian users; pylivetrader and pipeline-live.
alpacahq/pylivetrader_Python live trade execution library with zipline interface. - alpacahq/pylivetrader_github.com
alpacahq/pipeline-live_Pipeline Extension for Live Trading. Contribute to alpacahq/pipeline-live development by creating an account on GitHub._github.com
pylivetrader is a zipline API compatible trading framework in python which again focuses on live trading, with much less overhead and dependency problems. It is written from the ground up for live trading use cases, so it removes a lot of heavy lifting that zipline had to do such as price adjustment etc.
This means, you don’t need to build your data bundle to kick off your algorithm in live, but instead you can just start your live trading from the Quantopian algorithm source right away.
At the moment, the supported backend is only Alpaca, but we are happy to connect to IB etc. if someone contributes the code.
Pipeline API is the core piece of Quantopian algorithm framework that allows easy stock selection based on the different metrics, much in a pythonic way, and this differentiates the platform from others. I found Pipeline is providing a tremendous value when it comes to trading wide range of universe. Unfortunately, it is not so easy for most people to use this great feature outside of the Quantopian platform.
pipeline-live is a python tool that allows you to do something similar anywhere so that you can do your research somewhere else as well as use it with existing python trading framework such as zipline-live or backtrader, including pylivetrader which I am introducing below. pipeline-live primarily uses IEX public API for pricing and basic fundamental information.
As you know, IEX provides market-wide volume data for daily OHLCV which makes it a perfect choice for pipeline usage. Since pipeline-live focuses on live trading use cases, it does not provide historical view unlike inside Quantopian, but the upside is it is fairly independent and easy to use. It is also very extensible so you can hook up with other paid data sources if you would find useful.
We also put some practices together about how you could convert your Quantopian algorithms to run in live trading. You may want to take a look at these documents if you are interested in.
https://github.com/alpacahq/pipeline-live/blob/master/migration.mdhttps://github.com/alpacahq/pylivetrader/blob/master/migration.md
I also posted in Quantopian forum with the real example, and you may take a look at it, too.
Long-only non-day trading algorithm for live_This is a modified version of the algorithm presented in…_www.quantopian.com
Feel free to give me any feedback/questions/criticism. Happy to help you get started with live trading with these tools too.
Below is the example code migrated from the post above.
If you’re a hacker and can create something cool that works in the financial market, please check out our project “Commission Free Stock Trading API” where we provide simple REST Trading API and real-time market data for free.
Brokerage services are provided by Alpaca Securities LLC (alpaca.markets), member FINRA/SIPC. Alpaca Securities LLC is a wholly-owned subsidiary of AlpacaDB, Inc.