Python Library To Run Quantopian Algorithm In Live
Quantopian — The Online Algo Trading Platform
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.
Photo by Rodion Kutsaev on Unsplash
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.
The Newest Open Source Libraries for Quantopian Users
Today, I wanted to share our newest open source libraries for Quantopian users; pylivetrader and pipeline-live.
Python live trade execution library with zipline interface. – alpacahq/pylivetradergithub.com
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 — the Core Piece of Quantopian Framework
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.
How to Convert Your Quantopian Algorithms to Run in Live Trading
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.
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.
And here is the example code migrated from the post above.
Thanks for reading! If you’re a developer, and believe you can code your way to financial freedom, please support our project “a commission-free stock brokerage for developers and bots” by joining the waitlist!
Brokerage services are provided by Alpaca Securities LLC (alpaca.markets), member FINRA/SIPC. Alpaca Securities LLC is a wholly-owned subsidiary of AlpacaDB, Inc.
You can find us @AlpacaHQ, if you use twitter.