Back

QuantConnect Data vs Quantopian Data?

I've recently joined QuantConnect after using Quantopian for awhile, since I'm a C# programmer by trade. For my first algorithm I've done a simple Faber Sector Rotation just to get the hang of things.

I've noticed that the results from QuantConnect vs Quantopian are fairly different.  QuantConnect gives me a return of 70% while Quantopian is at 63%.

Both sites say equity prices are split and dividend adjusted, but I've looked at the trades from both and the prices for securities at a given time definitely don't match up.

Has anyone run into this as well? I'm wondering which site's prices are more accurate?  Any info or insights would be appreciated.

Here's a link to the Quantopian backtest: https://www.quantopian.com/posts/fabers-sector-rotation

Update Backtest








I would think Quantconnect, since they have per tick data on equities. Quantopian is only every 5 minutes.

I also just switch from Quantopian, mainly because I hate python, and I think their API docs are rubbish.

2

From a quick look there are a few differences. I'd guess its a combination of the MOM indicator as your performance indicator, and the daily indicator values. Comparing the net return isn't helpful though - you need to ask different questions. E.g. what exactly is happening at every moment for every trade in your algorithm? When you understand this and differences become transparent. To truely understand this you should analyse every single trade.

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


@Jared thanks for the tips, I will definitely keep these in mind going forward.

I assumed the MOM indicator was percentage based; switched to MOMP and now getting behavior closer to what I expected.

0

As a new QC subscriber I've been looking at this since my algorithms are currently at Quantopian.

Quantopian equity data is 1-minute/daily resolution TRADE data ONLY during market open (9:30 to 16:00) since 2002 ALWAYS adjusted.

QuantConnect equity data is tick/second/minute/hourly/daily resolution TRADE data from 7:00 to 18:00 since 1998 avaiable as Raw/Adjusted/SplitAdjusted/TotalReturn.

QuantConnect has consolidators that allow you to easily build other timeframes (e.g. 5-minute bars). In Quantopian you have to write your own resampler.

However, I'm still trying to figure out calls to History. In Quantopian they prefer you do not store history in your backtest because each bar is adjusted for every call to data.history()

The examples I've seen for indicators in QC tend to use rolling windows and append new values to a window thereby saving data that might not be correctly adjusted. If you're trading on an intraday basis probably not a problem. Monthly indicators might be an issue. 

I did get my indicators to work with consolidators using the rolling window approach but I'm guessing I should really port my resampling code and call History() every bar period so values are always adjusted properly. 

QC - any thoughts on this? Is there a way to use consolidators in calls to History()?

0

Attached is code that is likely to be quite useful to Quantopian programmers transitioning to QC. I wrote it to try to figure out why Q and QC data is different and it contains the following features:

  • Sets up a helper class SymbolData that allows different resample rates per symbol
    • self.assets holds a list of SymbolData objects to support multiple symbols 
  • Has optional delegates for OnDataConsolidated and OnSmaUpdated per symbol
  • Call pandas.resample when OnDataConsolidated fires for comparing data
  • Uses a simple moving average indicator to Trade (copied from a QC example)
  • Cleans up import * which is discouraged in python

The code uses Consolidators and pandas.resample() to compare 1min/5min data. I also compare those values to my broker data. Unfortunately I can't make the output available because it is against the terms of service. However, I did make all the code available so anyone can run it themselves. Here is what I found:

I used FB for comparison and only looked at 20 minutes of data. Before accepting the conclusions below much more data should be evaluated.

  • QC Consolidators use closed=left label=right
  • QC 1min bars appear to use closed=left label=left (based on resampling 1sec data)
  • To get QC 1m bars to match Quantopian 1min bars resample QC 1sec data with closed=right label=left 
  • To get Quantopian data to match my broker's 5min data resample Quantopian 1min data with closed=right label=left 
  • To get QC 5min data to match my broker's 5min data resample QC 1min data with closed=left label=left
  • Note: The algorithm doesn't always consistently work for open. It seems to work for close. 
  • I didn't check high/low/volume 
  • If you use pandas.resample make sure you have complete data (e.g. second data that spans the entire period... 6 1-minute bars for 5 minutes resample especially if closing on right)
     
0


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed