Comparison

Bagtester vs Backtrader

Backtrader has been the go-to Python backtesting framework for the better part of a decade. Bagtester is a different animal — a hosted MCP service for AI coding agents, not a library you install.

If you've been running Backtrader on a personal machine and your workflow now starts with "Claude Code, write me a strategy", Bagtester collapses the gap between agent and backtest result.

Side by side

TopicBagtesterBacktrader
Form factorHosted MCP server. Agent submits Python source, we run sandboxed.Python library (`pip install backtrader`). Runs in your local process.
Active developmentActive — engine v2.0 shipped May 2026.Effectively stalled — last meaningful release was 2017. Community has migrated to vectorbt, Zipline-reloaded, Lean, NautilusTrader, or custom.
API style`bagtester.Strategy` subclass + `on_bar(self, ctx, bar)`. Minimal surface.`bt.Strategy` subclass + `next(self)` + cerebro orchestrator + analyzers / observers / indicators / sizers. Verbose but extensible.
DataHosted — crypto top 50 (1m + tick top 10), FX 16 majors (tick from 2003), ~200 US stocks, ETFs, fundamentals (DOW 30), funding rates.Bring your own. Built-in feeds for Yahoo, IB, Oanda; CSV / pandas adapters.
MaintenanceWe handle data ingestion, schema migration, engine bumps. You write strategy code only.Aging stack — Python 3.12+ has rough edges, some `setup.py` issues; community patches exist but not in the official package.
Result formatSchema v2.0 JSON — 107 metrics, 12 quality flags, sparkline preview, share URL, PNG visuals.Analyzer-style metrics you wire up yourself (SharpeRatio, DrawDown, TradeAnalyzer). Matplotlib plots built in.
Agent integrationNative MCP. Tools self-describe via `tools/list`.None native. Agent generates code, you run it locally.
Parameter sweeps`optimize_strategy` MCP tool — up to 1,000 combinations on Quant tier, returns ranked + heatmap.`cerebro.optstrategy()` with multiprocessing. Works but you assemble + render results yourself.
Realism modesMinute / hybrid (adverse-fill within bar) / tick (event-driven). FX hybrid models bid/ask spread.Flexible Broker / Commission classes. You build slippage logic yourself.

When to pick Bagtester

  • You'd rather not maintain a backtesting library locally.
  • Your workflow is agent-first.
  • You want hosted data + sandboxed compute + structured outputs.
  • You want active development and structured release notes.

When to keep Backtrader

  • You already have a working Backtrader stack and don't want to change it.
  • You need fine-grained intra-bar order logic that fits Backtrader's model.
  • You're learning — Backtrader's docs are excellent and conceptual.
  • You want zero recurring cost and your data + compute are already solved.

Frequently asked

Should I still use Backtrader in 2026?+

It still works for many strategies and the docs are excellent for learning. But the library hasn't seen substantial maintenance for years and the Python ecosystem has moved on. For new projects, look at vectorbt (vectorized), NautilusTrader (production-grade), Lean CLI (institutional), or hosted alternatives like Bagtester.

Can I port a Backtrader strategy to Bagtester?+

Most logic ports. The mental model shift is from cerebro + analyzers to a single `Strategy.on_bar` callback. Indicators that ship with Backtrader (`bt.indicators.SMA`, etc.) become explicit list-based computation in Bagtester, or you use `ctx.indicator('sma', period)` for the basics.

Why not just patch Backtrader and self-host?+

Plenty of people do — and Bagtester isn't trying to replace that workflow. We exist for users who want the agent → backtest loop without owning compute, data, or library maintenance.

Does Bagtester support intra-bar limit / stop logic?+

Hybrid mode models adverse-fill within the bar's OHLC range; tick mode walks the actual stream for fill timing. Backtrader's intra-bar simulation is more flexible because it's fully in-process; if that level of control matters, stay in Backtrader.

Try the agent flow

500 credits/month free. Connect Claude Code / Codex / Cursor to our MCP endpoint and run your first backtest.