Quantopian vs Alpaca — When Paper Trading Your Algorithms

Matthew Tweed
Automation Generation
4 min readDec 18, 2018

Back-testing and paper-trading are the important final steps to the development of any algorithms, allowing you to verify its results on out of sample data before committing real money to the strategy. (This is 12/18 post for Trading API Advent Calendar 2018)

In this article, I’ll cover some of the important features and differences between Alpaca and Quantopian, two platforms focused around simple algo-trading.

Platform Features

Paper-Trading and Back-Testing

The first difference to mention is back-testing vs paper-trading. Alpaca offers only integrated paper-trading whereas Quantopian offers both paper-trading and back-testing. But, what’s the difference?

Back-testing usually refers to taking historical data and running your algorithm over it incrementally, so as to simulate a live data feed. This comes with the benefit of speed but can lack some of the accuracies of a live data feed, such as market bid and ask.

Paper-trading, however, involves interacting with live market data from a trading account with virtual money. This has the benefit of real-life trading conditions and the ability to test your whole system’s reliability but means that you’ll have to wait in real time as the algorithm runs.

Software Development Kits

The second difference comes from the software development kits offered by the two platforms: with Alpaca providing API wrappers in multiple different languages to be installed and developed with on your own system. Meanwhile, Quantopian provides an integrated development environment on their website along with back-testing functionality built in.

The latter can make the first steps of development and testing easier, but can’t be converted into production trading strategy without significant reworking, while any software written for Alpaca’s paper trading accounts is already functional with a live trading account with the simple change of the API keys.

Data Availability

Both platforms provide easy access to a wide range of price and fundamental data, allowing for quick implementation of new ideas without needing third party feeds.

Quantopian and Alpaca both have minute data of US stock prices and volume, with Quantopian also including a wide selection of US futures too. Alpaca provides a range of fundamental and metadata through integrations with IEX and Polygon, while Quantopian has access to fundamentals via Morningstar.

Algorithm Testing Differences

I think that the main differences come in the trade simulations used by each platform:

Alpaca uses live NBBO (national best bid/ offer) for simulated market orders and fills limit orders (which would hold the best bid/ offer) at a predefined random rate, so as to accurately replicate real market conditions. They, however, do not account for order size, which could have a noticeable effect on market movement with large trading accounts or lower volume equities.

Quantopian, on the other hand, from reading its document, simulates orders against the close next minute bar[1] after the order has been submitted. This can have the weird effect of filling orders at more favorable prices, such as a limit order being filled below its limit price. This behavior has the possibility to skew results long term, making a strategy look more favorable than it would be in reality, in my opinion.

Footnotes

  1. Paper trading is stated to be run on the same engine as back-testing and this has been a known effect of the back-testing engine for a long time. I also ran my own tests, which confirmed that limit orders could be filled below their limit price during paper trading.

Technology and services are offered by AlpacaDB, Inc. 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.

Follow Automation Generation, a Medium’s publication created for developers/makers in trading and fintech.

--

--