
Lean
Algorithmic trading engine for backtesting and live trading
Replaces Quantconnect, Multicharts

Who it's for
Lean provides a survivorship-bias-free backtesting engine with accurate accounting for corporate actions and position-level P&L. Developers write strategies in Python or C#, run them against historical data with realistic fill and slippage models, and compare results across parameter sets using the optimization runner.
Skip if you need a no-code backtesting tool with a graphical interface. Lean requires writing strategy code in Python or C# and is not suitable for traders who prefer drag-and-drop strategy builders.
Firms running on MultiCharts or similar commercial platforms can migrate strategies to Lean and eliminate recurring license costs. The Algorithm Framework's modular architecture makes it practical to port existing logic component by component. Over 300 hedge funds use Lean in production as evidence of institutional viability.
Skip if your current platform's specific order types or data adapters have no Lean equivalent. Migrating execution logic for exotic derivatives or niche exchanges may require building a custom brokerage model.
Lean's open execution stack, custom data import, and Jupyter Lab integration make it suitable for research on market microstructure, algorithmic market impact, and strategy simulation. Custom data sources can be fed directly into the engine, and the full execution trace is inspectable at the source level.
Skip if your research requires only statistical analysis of historical price series without execution simulation. A pandas-based Python workflow is simpler for that scope.
Lean's Apache 2.0 license, production track record ($100B per month notional volume), and Algorithm Framework make it a credible foundation for a proprietary fund's execution layer. The plug-in architecture means the engine can be extended for specific clearing, reporting, or risk management requirements.
Skip if your fund requires a fully managed execution platform with vendor support SLAs. Lean is self-operated, and operational incidents require in-house engineering to diagnose and resolve.
The problem
Building and testing algorithmic trading strategies on commercial platforms means paying recurring license fees for software whose execution logic you cannot inspect or modify. Platforms like MultiCharts charge per-version or per-seat licenses, and closed-source execution engines make it impossible to verify exactly how orders are filled, how slippage is calculated, or how corporate actions are handled during a backtest. When a strategy produces unexpected results, the inability to read and modify the engine becomes a real debugging problem. For quant teams moving toward production, vendor lock-in adds another cost. A strategy built against a proprietary brokerage API or data format is expensive to migrate. Cloud-based platforms remove infrastructure overhead but replace it with per-month subscription costs and data sovereignty concerns for funds with compliance requirements. Self-hosting was always the answer for serious funds, but the complexity of building a production-grade backtesting and execution engine from scratch put it out of reach for most teams.
How it works
Lean trades equities, forex, options, futures, future options, index options, crypto, and CFDs from a single portfolio. All nine asset classes share the same margin, buying power, and profit-and-loss accounting, so multi-asset strategies run without stitching together separate execution environments.
The engine automatically accounts for splits, dividends, corporate actions, listings, delistings, and mergers during a backtest. Without point-in-time handling of these events, backtests that hold stocks through delistings produce inflated results. Lean handles all of it automatically using historical corporate action data.
Over 100 technical indicators ship with the engine, pre-tested and applicable to any data source. They work across all supported asset classes and timeframes, can be chained as inputs to other indicators, and require no external library.
Every component of the execution stack is replaceable: slippage, fill, fee, and brokerage models are plug-in points. You can implement the exact margin and fill behavior of your target broker or test against idealized assumptions. Risk models run passively or actively hedge exposed positions.
Strategies run in Python or C#. Python is the preferred language for machine learning integrations; C# is used when execution speed matters. The LEAN CLI sets up a Jupyter Lab environment for interactive research and connects to VSCode for local debugging with full autocomplete.
The Algorithm Framework separates universe selection, alpha generation, portfolio construction, execution, and risk management into distinct, swappable modules. QuantConnect ships pre-built modules (Equal Weighting, Mean-Variance, Black-Litterman portfolios) that can be combined without writing them from scratch, accelerating strategy development.
Features
- Nine-asset-class trading from one portfolio
- Survivorship-bias-free backtesting
- 100+ built-in technical indicators
- Pluggable execution and risk models
- Python and C# strategy support
- Algorithm Framework for modular strategy design
How to install
Install the LEAN CLI with pip, then run strategies locally using Docker.
pip install lean
lean backtestRecommended for this setup
Strengths
- Apache 2.0 license with no commercial restriction: The Apache 2.0 license allows running Lean commercially, modifying the engine, and distributing changes without releasing source code. No royalties, no per-seat licensing, no vendor approval needed for production use. Over 300 hedge funds currently run Lean-powered strategies in live trading.
- Battle-tested in production at scale: The engine has run 375,000 live algorithms since 2015 and currently processes over $100B per month in notional trading volume. It is maintained by QuantConnect with contributions from 180+ engineers and has continuous integration with regression tests visible on GitHub.
- Full engine transparency for debugging: Every model is readable and modifiable source code. When a backtest produces unexpected fills or P&L, you can trace the execution path through the engine. Commercial platforms offer no equivalent access; subtle bugs in fill modeling are only discoverable when the code is open.
- Cross-platform deployment on Windows, macOS, and Linux: Lean runs on all three major operating systems via the LEAN CLI and Docker, or by compiling the .NET solution directly. MultiCharts, the primary commercial alternative in systematic trading, is Windows-only. Python strategy development and Jupyter research work identically across platforms.
Trade-offs
- Engine development requires C# and .NET tooling: The engine is written in C#, so extending the core or debugging execution internals requires the .NET 10 SDK and C# familiarity. Python-only developers using the LEAN CLI can write strategies without this, but the CLI abstracts the engine rather than exposing it. Quants who need to modify execution logic will need to learn the C# codebase.
- 285 open issues across a broad feature matrix: With 285 open GitHub issues against a multi-asset, multi-broker feature matrix, edge cases in specific broker integrations or asset class combinations may surface in production. The community forum is active, but production-critical deployments should expect to investigate issues in the engine source directly.
- Historical data must be sourced and formatted separately: Self-hosting Lean means you supply your own historical data in LEAN-compatible format. QuantConnect's cloud platform includes curated data from 40+ providers; the self-hosted path requires contracts with data vendors and an ETL step to convert data into LEAN's format before backtesting.
Tech stack
FAQ
Yes. Lean is licensed under Apache 2.0, which allows commercial use, modification, and distribution without royalties or per-seat fees. Over 300 hedge funds use it in production trading. The license does not require publishing your strategy code or sharing modifications.
Lean is the open source engine that powers QuantConnect's cloud platform. Self-hosting Lean runs the same engine without the cloud subscription cost. The trade-off is that you supply your own historical data and infrastructure; QuantConnect's cloud includes curated data from 40+ providers and no infrastructure management. Strategies written for the cloud run on a self-hosted instance with the same code.
Lean supports equities, forex, options, futures, future options, indexes, index options, crypto, and CFDs. All nine asset classes can be traded simultaneously from a single portfolio with unified margin and P&L accounting. Corporate actions, delistings, and splits are handled automatically using point-in-time data.
The quickest path is the LEAN CLI: run `pip install lean` to install it, then `lean backtest` to run a strategy locally using Docker, or `lean live` to deploy a live algorithm. For direct engine development, clone the repository and build with `dotnet build QuantConnect.Lean.sln`. The CLI path requires only pip and Docker; the build path requires the .NET 10 SDK.
Yes. Lean runs Python strategies natively alongside C#. Python is the preferred language for machine learning integrations, while C# is used when execution speed matters. The LEAN CLI sets up a Jupyter Lab environment for interactive Python research. A full Python setup guide is in the Algorithm.Python project within the repository.