0%

Step up your game in Quant trading - Backtest platforms QuantConnect v.s. Quantopian review

Backtesting is the most important stage of testing and verifying the result of your trading strategy. You can either build your own backtesting script or use a python package such as backtrader to simulate your portfolio return with downloaded stock prices CSV files. Either way would require you to download the stock price in minute or day bar beforehand. Also, you need to deal with the stock market events such as stock splitting, ticker name changing, or delisting. So effectively using an existing online tool like QuantConnect could save you a lot of time dealing with edge cases yourself.

I’ve been spending my time learning how to work with QuantConnect platform and its features in the past month. So in this post, I’m going to introduce the web-based backtest platform by finding out the common things between Quantopian and QuantConnect. Then I’ll talk about the good and bad I found in trying out these two platforms. Hopefully, the experience that I shared in this post can better help people who are looking for a solution of validating their trading ideas.


Quantopian and QuantConnect in common

Since Quantopian has announced its retirement on Nov 14th, 2020, I’ve been struggling to find a substitution for backtesting the strategy. QuantConnect is a seemingly promising one that I can find so far. Both Quantopian and QuantConnect are web-based backtest platforms that allow you to use code to construct your trading strategy with the tools provided. In their built-in IDE, you can decide your target universe and work on the indicators that trigger the buy-in or sell-off instructions. After you put together your trading strategy, it simply costs you one click to backtest your strategy with historic data. The visualized portfolio performance and key stats are the things for you to evaluate whether you have constructed a high-alpha strategy or not.

So basically, Quantopian and QuantConnect are quite similar in terms of their functionalities to fulfill a quant’s basic needs.

Quantopian and QuantConnect in different

While constructing a trading strategy, I’ve encountered a few concepts and features that are a bit hard for me to grasp in the first place. Here I bring them up so that you can pay more attention to when you start working with QuantConnect platform.

  • Built-in IDE
  • Fewer helper functions in QuantConnect
  • Community and forum
  • Platform stability
  • Differences in data structure and concepts between two platforms

Built-in IDE

From the experience of being a former product/project manager in the software industry, I’ve learned that the UI/UX of your product will set the tone and draw a particular group of your product audience. So we can try to identify the target audience of Quantopian and QuantConnect by looking at their most important page: built-in IDE.

Quantopian QuantConnect

Quantopian research IDE


QuantConnect research IDE

Quantopian’s IDE is designed to be elevating the users’ speed to develop profitable strategies. There are two types of backtesting you can execute: quick performance backtesting and deep analysis backtesting. If you are constructing your alpha strategy from the scratch, you can code in the left area and run a quick performance backtest to see the result on the right. This result contains only the portfolio return graph and other crucial KPIs which take less time to generate. When you feel confident with your trading strategy, you can run a deep analysis backtest to see details such as the exact order you have submitted and what is your sector-specific exposure. Personally, I like this design as I can quickly try and error to build the strategy with the performance backtest and spent less time to see how it worked out and fine-tune the strategy while running a deep analysis backtest to print out a log message every time will be wasting time and resources.

On the other hand, QuantConnect seems taking a different route to approach their end-users. QuantConnect provides only one type of backtesting with analysis and separates their IDE from their backtest result into two different tabs. Therefore, even with the tiniest change in your code, you are obligated to rebuild your code and run a full-fledged backtest that might not necessary. However, unlike Quantopian who treats every trading strategy as a script, QuantConnect does treat each trading strategy as an individual project. The IDE inspects and monitors how many times you have run backtest against this specific strategy, how many parameters you have used in it, and how much time you have been spending on this script. These are all deemed as indicators to be referenced while you’re doubting the level of over-fitting of your trading strategy.

Fewer helper functions in QuantConnect

Helper functions are like small gadgets that make you complete your work much easier. Quantopian provides a lot of helper functions, such as get_open_orders(), set_slippage(), and get_calendar(), that help you focus more on constructing your trading strategy and less on spending time on the underlying data structure.

On the other hand, QuantConnect encapsulates the data needed in important objects such as portfolio and securities. Instead of providing helper functions, QuantConnect decides to expose these properties to calculate what they want when they need to.

Personally speaking, I prefer the Quantopian way as having more helper functions could help users pay more attention to the most essential things, building the trading strategy.

Community and forum

Quantopian no doubt used to have the most active open community in the quantitative trading industry. All the members actively exchange their ideas and thoughts, and the staffs are also very involved in each crucial topic to provide assistants when needed. But, the QuantConnect community somehow looks to me missing the engagement between quant traders and thriving atmosphere.

Platform stability

I still remember the first time when I tried to work with QuantConnect, I’ve been trying to run my first backtest several times yet no successful result. My backtest has been hung in one of the steps for hours and then got logged out for unknown reasons. Then, I was having issues logging back in to the platform. I was so frustrated so I moved on to another substitution.

Thankfully, everything went pretty smoothly this time. Also, if you want to know the stability of QuantConnect server, there’s another tool that you can utilize: QuantConnect Status Monitor.

During my time using Quantopian, everything went well.

Differences in data structure and concepts between two platforms

There are still a lot of differences between these two platforms. I’m not going to bother you with these details. Instead, I put these at the end of this post so that you can refer to them whenever you need them.


Advanced features that QuantConnect provides

Below is a list of features that QuantConnect does well and is beneficial to the users:

  • The built-in debugger in IDE
  • Live trading support
  • Algorithm Framework
  • Alpha streams

The built-in debugger in IDE

Debugging accounts for a crucial part while building your trading strategy. We usually use an IDE-built-in debugger or python package pdb to help us debug local scripts. Yet, it’s really interesting to see a built-in debugger in this web-based IDE. If you have a variable that you want to monitor in each iteration, this debugger would definitely come in handy.

Live trading support

Live trading would be the last piece of the puzzle to activate your trading strategy. Once you complete the backtest and decide to throw this trading strategy into the live market, live trading support would make sure you can seamlessly connect your trading strategy to the brokers.

Quantopian collaborates with Interactive Brokers so that you can connect your strategy to your own IB accounts to start trading live.

QuantConnect supports even more live trading brokers such as IB, Oanda, Coinbase, Bloomberg, …etc. This feature is quite attractive as you’re able to run multiple strategies under the same QuantConnect account as long as you have accounts under each broker.

Brokers supported on QuantConnect

Algorithm Framework

Unlike Quantopian who treats every trading strategy as an individual script, QuantConnect separates a trading strategy into five unique models: universe selection, Alpha, portfolio construction, risk, and execution. Each of them is responsible for a unique task:

  • Universe selection model is responsible for filtering the target securities and add to your target universe.
  • Alpha model processes the data and emits the trading insights according to the trading directions.
  • Portfolio construction model takes the insights from Alpha model and decides how much money you would like to allocate to each security.
  • Risk model monitors the performance of your portfolio and drops certain securities when a downside trend appears.
  • Execution model control how each order gets executed.

Data flow in QuantConnect

By splitting the responsibilities into each model, you can focus on build one model that can be reused in another strategy in the future.

Alpha Streams

Quantopian held competitions to have quants to share and compete for their strategies. Once your strategy is outstanding and lucrative enough, Quantopian would allocate a part of their asset to construct a fund with the strategy you designed. The profit would be shared together between you and Quantopian. This is also the business model of Quantopian who acts as a supervisor and hand-pick the best strategy within the organization.

On the other hand, QuantConnect acts as a broker between quants and organizational investors. The quant can construct his/her own strategy and run backtest through certain years. Once the organizational investors have scouted your strategy and believe that your strategy is fitting their needs and profitable enough, they can pay you the money to subscribe to your strategy in order to receive the trading signals that your strategy produced. QuantConnect will charge 30% of your subscription fee as the cost of hosting your code and everything.

Essentially, these are the differences between their business models. We won’t be able to judge which model is better than the other, but knowing the fact that you might have a chance to make money by writing strategy is a plus for QuantConnect users.


Last but not least

This post is not a short summary of either Quantopian or QuantConnect is better, but is more of personal learning tracks and feelings of what QuantConnect can do better in the future. For those who are interested in utilizing their personal skills to make money and in learning investors’ mentalities and behaviors by reading the market, QuantConnect could be a tool that is worth your time to learn and a community to join.


Misc

Q&A and tips

  1. Definition of self.portfolio is different

Quantopian: It’s a list of objects of your invested positions
QuantConnect: It’s a dictionary of your monitored universe

Comment:
The term portfolio has different meanings in these two platforms. In Quantopian, the portfolio means a group of securities you currently hold. In QuantConnect, the term indicates the stock universe that is on your watchlist, no matter you have bought this stock or not.

The way that QuantConnect defines portfolio could lead to confusion and extra work when inspecting the status of your portfolio.

  1. How to subscribe data you needed

Quantopian: You subscribe to the data you need by telling def make_pipeline() the data specification, such as what stocks you would like to include, what fundamental data you need, and what indicator you would like to see. In the end, you’ll get a huge piece of dataframe as the output from the daily pipeline data processing.
QuantConnect: You first need to register the security you would like to add to your watchlist with self.AddEquity(symbol). You’ll receive all the data of the securities on your watchlist every trading day. What about the indicators? You need to calculate and update yourself.

Comment:
The way that Quantopian deals with the data subscription is quite straightforward. You simply need to use your code to describe how you want the data to be like, and then you’ll get a big sheet for you to play with. Yet, data from QuantConnect requires more works from you in order to stitch the data into the form you would like them to be.

  1. QuantConnect introduced the concept of Symbol, Quantopian identify securities by ticker

Quantopian: You need to specify security using string. However, it’s not quite clear to me how Quantopian deals with the events of changing ticker or delist.
QuantConnect: QuantConnect usesself.AddEquity(symbol) to transform a string-like ticker into an object that QuantConnect understands. Therefore, it doesn’t matter whether the ticker of security has been changed or delisted.

Comment:
It is a very good concept that waives the users’ concerns of dealing with these events. However, by looking at the API documentation of QuantConnect, the APIs were not consistent regarding using either a symbol object or a ticker string. Therefore this increases further difficulties for users to learn how to use their APIs.

Enjoy reading? Some donations would motivate me to produce more quality content