“Which framework to choose for algorithmic trading?”

Over the past 6 months, I tested three platforms: LEAN (QuantConnect) — C#/Python, StockSharp — C#, and Backtrader — Python.

I wrote identical strategies on all three. Measured backtest speed. Counted the time for MOEX integration.

Three Platforms, Three Philosophies

LEAN: Professional engine for quant funds. C# core, Python API, event-driven architecture, 400TB of historical data in the cloud.

StockSharp: Universal platform focused on performance and the Russian market. C#, visual Designer + API, 90+ connectors, microsecond order processing.

Backtrader: Simple and flexible Python framework. Pythonic API, large community, but development stopped in 2021.

Test 1: Simple Strategy (SMA Cross)

Same strategy on all three. Backtrader: 5 minutes to write, low complexity. LEAN: 10 minutes, medium complexity. StockSharp: 15 minutes, high complexity.

Winner for simplicity: Backtrader.

Test 2: Backtest Performance

Testing on 3 years of hourly data (~18,000 candles):

Framework Backtest Time RAM Usage Speed (candles/sec)
Backtrader 12 seconds 150 MB 1,500
LEAN 4 seconds 220 MB 4,500
StockSharp 3 seconds 180 MB 6,000

StockSharp and LEAN are 3-4x faster than Backtrader. StockSharp is fully C# with microsecond order processing.

Test 3: MOEX Integration

LEAN: No official MOEX support. Need to write a custom data feed (2-3 days, high complexity).

StockSharp: Native support for 90+ exchanges, including all Russian brokers. Setup: 30 minutes, low complexity, free.

Backtrader: Via third-party libraries (backtrader_moexalgo or aiomoex). Setup: 30 min-1 hour.

Winner: StockSharp (native support for all Russian brokers).

Test 4: Architecture Complexity

LEAN: Event-driven — realistic but complex debugging.

StockSharp: Message-based — flexible, HFT-ready, but steep learning curve.

Backtrader: Simple loop — easy to understand, transparent, but slow.

Framework Architecture Complexity Learning Curve Suitable for Beginners?
Backtrader Low 1-2 weeks Yes
LEAN Medium 1 month No
StockSharp High 2-3 months No

Real Case: HFT Strategy

For market making on futures where latency is critical (<5ms): StockSharp wins with 1-3ms latency. LEAN is borderline at 5-10ms. Backtrader doesn’t support real-time tick-by-tick.

Real Case: ML Strategy

For LSTM prediction with TensorFlow integration: Backtrader wins — Python-native, TensorFlow integrates naturally. LEAN and StockSharp require complex bridging to Python ML libraries.

Summary Table

Criterion Backtrader LEAN StockSharp
Beginner-friendly 5/5 3/5 2/5
Backtest performance 2/5 4/5 5/5
MOEX integration 4/5 2/5 5/5
HFT (latency <5ms) No 3/5 5/5
ML integration 5/5 3/5 2/5
Active development No (2021) 5/5 4/5
Russian community 4/5 2/5 5/5

My Recommendation

Backtrader — if you’re a beginner, know Python, need ML, don’t need HFT.

LEAN — if you’re a quant developer, need international markets, ready to pay for QuantConnect cloud.

StockSharp — if you trade on MOEX, need HFT, know C#, want visual Designer + code.

If you’re a beginner — start with Backtrader. After 3-6 months, when you need speed or HFT — switch to StockSharp (especially for MOEX and crypto) or LEAN (for international stock markets).


Useful links: