After 8 months development we've released a new backtesting engine powering QuantConnect called
Lean. It is a complete rewrite of QuantConnect's core technology that can take a generic time-series data source and run a backtest.
We wanted QuantConnect to quickly and easily accept any data source and be able to trade on it as it would equities. Almost every user has their own set of demands, languages, data-sets and trading strategies so we needed a backtesting platform that could accommodate them all.
There are several leaps in engineering with
Lean, the key aspects are:
-
Lightening Speed - We complete a simple backtest across 10 years of 1-minute data in 46 seconds. In head to head benchmarks we are literally 10x faster than the competing platforms (46s vs 7m40s)! This allows you to test ideas faster and design better strategies.
-
Generic Data - Data sources are dynamically loaded at run-time so you can now backtest any market data that has a Time and Value. You define where the data comes from during backtesting, and can even specify a new streaming source for live trading.
-
Custom Charting - Plot customized dynamic and flexible charts to the web browser directly from your algorithm. See our last post for some examples on how to use charting in your algorithm.
We've been able to maintain backwards compatibility but recommend updating your algorithms to use the new API. There key difference is the name of the data event handler:
//Deprecated v1.0 Event Handler:
public override void OnTradeBar(Dictionary data) { ... }
//New LEAN v2.0 Event Handler:
public void OnData(TradeBars data) { ... }
TradeBars
implements an
IDictionary<string, TradeBar>
so it will work with your current algorithms and make you future proof for updates to come.
If you're designing locally in Visual Studio we've created a new QCAlgorithm base-class, so
update your local copies from GitHub.
Here's an example of importing Bitcoin data to backtest your strategy!
Jared Broad
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!