TANAY.SHAH
✓ SHIPPED · 2025 · QUANT TOOLING · UPDATED 2026-05-10

Apex Backtest.

A simplified QuantConnect Lean wrapper. Write a strategy file, run one CLI command, get formatted results.

// 01 — WHY I BUILT IT
THE PROBLEM

Lean is the best open-source backtesting engine in finance, but the developer experience is terrible: manual Docker setup, hand-edited JSON configs, manual data preparation in Lean's specific format (prices stored as integers ×10000), result parsing left as an exercise. New users spend their first week fighting infra instead of writing strategies.

I built apex-backtest as the wrapper I wished existed when I onboarded onto Lean. The premise: traders should write strategies, not maintain backtesting infrastructure.

// 02 — THE APPROACH
THE WORK

A single CLI (`apex-backtest`) handles: setup (Docker readiness check, image pull), data download (yfinance → Lean format with the price-×-10000 conversion), config generation (auto-builds the JSON Lean expects), execution (mounts volumes, runs the container, captures output), and results parsing (converts Lean's stats output into a Rich-formatted terminal report).

Strategy files are vanilla Python — users write a class that subclasses `QCAlgorithm` from Lean's API. No DSL, no proprietary syntax. The wrapper ships with example strategies (SMA crossover, RSI, MACD, Bollinger) so new users have working code on day one.

// 03 — KEY DECISIONS
WHAT I CHOSE & WHY
DECISION · 01

yfinance instead of Lean's data feed

Lean's official data feed requires QuantConnect cloud subscription. For local backtesting, yfinance is free, sufficient, and ubiquitous. The price conversion (×10000 to fit Lean's integer format) happens once at download, transparently to the user.

DECISION · 02

Docker as a runtime boundary, not a developer tool

Most Lean tutorials make users aware of Docker (start the container, mount this volume, watch this port). apex-backtest hides Docker entirely behind the CLI — it's a runtime detail. Users who care can drop into a `docker exec`; users who don't never see a container.

DECISION · 03

Rich terminal output, not Jupyter notebooks

Most quant-tooling lives in notebooks. They're great for exploration and terrible for iteration. Rich-formatted CLI output (tables, sparklines, color-coded stats) keeps users in their terminal where they're already running git, tests, and their editor.

// 05 — STATE OF THE ART
2026 BLEEDING-EDGE TECH
QuantConnect Lean engine

The best open-source backtesting engine in finance. apex-backtest hides its surface-area complexity behind a single CLI.

Click + Rich CLI

Modern Python CLI stack — composable commands, gorgeous formatted output. Quant tools belong in the terminal, not Jupyter notebooks.

// 06 — MEASURED
NUMBERS THAT MATTER
Strategy onboarding
<5 min
vs. ~1 day for raw Lean
Built-in strategies
6+
SMA · RSI · MACD · Bollinger · …
CLI verbs
4
init · setup · download · run
// 07 — IF I DID IT AGAIN
LESSONS · WHAT I'D CHANGE
  • Most 'developer tooling' projects underinvest in onboarding. The CLI's `setup` command (which validates Docker, pulls Lean, runs a smoke test) was the single highest-ROI feature — it converts 'this thing doesn't work' bug reports into actionable diagnostics.
  • Wrapping a powerful tool with a constrained CLI is high-leverage when the tool's surface area exceeds 99% of users' needs. Lean is enormous; apex-backtest exposes the 5% that traders actually use.
// 08 — STACK
THE TOOLS
LANGUAGE
Python
ENGINE
QuantConnect Lean
RUNTIME
Docker
DATA
yfinance
CLI
Click + Rich