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:
  1. 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.
  2. 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.
  3. 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!

Author