Comparison

Bagtester vs vectorbt

vectorbt is one of the best Python backtesting libraries in existence — fast, expressive, array-oriented. Bagtester is a hosted MCP service for AI coding agents. The two answer different questions.

Pick vectorbt if you want maximum flexibility in-process for massive vectorized parameter sweeps. Pick Bagtester if you want a zero-setup hosted endpoint your agent can call without you maintaining data, environment, or compute.

Side by side

TopicBagtestervectorbt
Form factorHosted MCP server. Agent calls a tool; we run sandboxed compute and return JSON.Python library you import. Runs in your local Python process (or notebook).
Where you write codeAnywhere. Your AI agent submits Python source to `submit_strategy`.Notebook / script on your machine. You import `vectorbt as vbt` and call its APIs.
DataWe host ~10-15 GiB of crypto, FX (tick from 2003+), US stocks 1m, ETFs, fundamentals, perp funding. No download or maintenance.You bring your own data. Yahoo / Binance / IEX pulls work out of the box; tick history requires extra plumbing.
ComputeSandboxed Cloud Run worker (gen2). 2 vCPU / 4Gi per backtest, auto-scale, queue-aware.Your CPU / RAM. Highly optimized vectorized numpy — fast — but bounded by your laptop.
API styleObject-oriented per-bar callback: subclass `bagtester.Strategy`, implement `on_bar`. Conventional.Functional + array-oriented: build signal arrays, call `vbt.Portfolio.from_signals(...)`. Steep curve but extremely composable for sweeps.
Parameter sweeps`optimize_strategy` MCP tool — up to 1,000 combinations on Quant tier, auto-creates a `param_sweep` experiment with heatmap data.World-class. Multi-dim arrays mean a 1,000-combo sweep is one call. The reason vectorbt exists.
Walk-forward`walk_forward` MCP tool. Re-optimizes per window, returns OOS-vs-IS metrics.Manual but doable — split your signal arrays into windows yourself.
Result structureSchema v2.0 JSON: 107 metrics + 12 quality flags + 58 scoring features + sparkline + share URL + PNG visuals.`Portfolio.stats()` — ~70 metrics as a pandas Series. You compose the rest yourself.
Agent integrationNative MCP. Claude Code / Codex / Cursor connect, list tools, call.Agent generates Python code, you run it locally. No remote agent surface.
Cost$0 free / $19 Trader / $39 Quant. Pay-per-credit beyond plan.Open-source core is free. Pro adds advanced features for $400+/yr.

When to pick Bagtester

  • You work with an AI agent and want backtesting at MCP call distance, not pip install distance.
  • You don't want to maintain a data pipeline — we host crypto/FX/stock/ETF history.
  • You want share URLs, OG cards, and dashboards out of the box.
  • You want subscription management inside your agent.

When to pick vectorbt

  • You want to run massive parameter sweeps in-process — vectorbt's array math is the gold standard.
  • You already have your own data pipeline and prefer everything local.
  • You want full control over signal generation and execution model — vectorbt's API is more composable.
  • Your strategy is a tight feedback loop you want to keep in a notebook.

Frequently asked

Can I run vectorbt inside Bagtester?+

Not directly — Bagtester's sandbox uses our own engine, not vectorbt. But you can absolutely use vectorbt locally and call Bagtester only for the moments where hosted compute or shared data helps.

Is Bagtester slower than vectorbt?+

Per-backtest wall-time is comparable for typical iterations. We add ~3-5s of MCP / queue overhead, which is amortized once you're running many backtests in a session. For massive vectorized sweeps with custom signal logic, vectorbt's in-process array math will still be faster — that's its sweet spot.

Why not just install vectorbt and call it from my agent?+

Two practical issues: data (vectorbt assumes you have it) and reproducibility (every machine and environment is different). Bagtester centralizes both — same data, same engine, same metrics across runs.

What's the migration path?+

Most signal logic in vectorbt translates directly. The biggest shift is from array-oriented to per-bar callback (`on_bar`). For pure parameter-sweep workflows, vectorbt's API is more ergonomic; for agent-driven iterate-and-evaluate, Bagtester's structured output is easier to reason about.

Use both, even.

vectorbt for tight in-process sweeps; Bagtester when you want your agent to do the work for you. Free tier ships 500 credits/month.