Python backtesting library for systematic strategies

Rust core, Python API. Realistic execution modeling, sub-second performance, reproducible research workflows.

$pip install manifoldbt
See the benchmark →

4,677 downloads on PyPI in the last 30 days
62 releases since March 2026

strategy.py
import manifoldbt as mbt
from manifoldbt.indicators import close, sma, rsi

fast = sma(close, 20)
slow = sma(close, 50)
signal = mbt.when((fast > slow) & (rsi(close, 14) < 70), 1.0, 0.0)

strategy = (
    mbt.Strategy.create("momentum")
    .signal("signal", signal)
    .size(signal * 0.25)
    .stop_loss(pct=3.0)
    .take_profit(pct=8.0)
)

result = mbt.run(strategy, config, store)
print(result.summary())
Public CI benchmark, real-time race
manifoldbt░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
raptorbt░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
vectorbt░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

Built-in visualizations

Publication-ready charts out of the box. Tearsheets, parameter sweeps, risk analytics, all with a single function call. Click a figure to see it in full.

Five of the built-in figures. Sweep maps, walk-forward folds, Monte Carlo fans and permutation tests are one call each as well, drawn on a real strategy in the research workflow →

Execution modeling

The gap between backtest and live performance is driven by execution assumptions. Each component is modeled independently and configurable per venue.

Fee model
Typical framework
Flat percentage or fixed cost
manifoldbt
Maker/taker split, minimum fee, per-venue configuration
Slippage
Typical framework
Fixed bps or ignored entirely
manifoldbt
Fixed-bps, spread-based, or size-aware volume-impact model, opt-in
Funding rates
Typical framework
Not modeled
manifoldbt
Per-bar funding accrual from the venue's historical funding-rate series
Borrow costs
Typical framework
Not modeled
manifoldbt
Short borrow charged per bar from an annual rate, per venue
Order types
Typical framework
Market orders only
manifoldbt
Market, limit, stop, stop-limit, market-if-touched, stop-loss, take-profit, trailing stop
Reproducibility
Typical framework
Depends on random seeds and data snapshots
manifoldbt
Deterministic bit-for-bit replay via cryptographic manifests

Data connectors

Built-in providers fetch and normalize market data into Arrow IPC, stored locally per symbol: instant replay, nothing downloaded twice.

Databento logoDatabento

CME futures, NASDAQ equities and OPRA options, from tick to daily bars, plus the contract terms of listed options.

Massive logoMassive

Stocks, ETFs, options, futures, forex and crypto spot, with the contract terms of US listed options.

Also built in

Crypto
0xArchive logo0xArchive
TradFi
Import
MetaTrader 4MetaTrader 5CSVpandasPolars

Speed, measured in public

The engine is written in Rust and operates on Apache Arrow columnar arrays. Data flows through the pipeline with zero-copy semantics and SIMD-friendly memory layout.

The figures below are measured on our own hardware. The engine is also measured in public CI against vectorbt and RaptorBT, all three installed from PyPI on a free GitHub runner, with the raw results published and the workflow open to anyone who wants to re-run it. See the reproducible benchmark →

sharpe512,000 combos
Illustrative parameter sweep heatmap: Sharpe ratio across two strategy parameters in red, amber and green, with a green plateau in the middle marked at 1.26 and red along the bottom.
Every combination, scored. Trade the plateau, not the lucky cell.

Write it with your agent

Ask an agent for a backtest and it hand-rolls one in pandas, fills and fees included, and the numbers often come out wrong without a single error to warn you. Give it Manifold-BT and the docs over MCP, and it gets the strategy right more than three times as often.

Works withClaude CodeCodexCursor
Success rate24 attempts · same 8 tasks · Haiku 4.5
Agent without a framework
21%
Agent + manifoldbt
3.6× more75%
How it was measured →

Research tools

Built-in tools to validate strategies before deploying capital. Every analysis runs in Rust, no Python bottlenecks.

Walk-forward optimization

Split your data into train/test folds. Optimize parameters in-sample, validate out-of-sample. Compare stitched OOS equity against the full backtest to detect overfitting.

mbt.plot.walk_forward(wf, mode="bars")
Walk-forward, IS vs OOS Sharpe per fold
mbt.plot.walk_forward(wf, mode="stitched", full_result=result)
Stitched OOS equity vs full backtest

Monte Carlo analysis

Bootstrap returns to estimate tail risk and P(ruin), or permute return order to measure path dependency and drawdown distribution.

mbt.plot.monte_carlo(result, method="bootstrap")
Monte Carlo bootstrap, fan chart with P(ruin)

Safety checks

Automated diagnostics that catch common backtesting pitfalls. Run them before trusting any result.

Lookahead bias detection

Names any signal that reads the future, through lead() or full_series_rank(), then re-runs the strategy on truncated and extended windows and flags every trade that moves. A column precomputed from future bars looks the same in every window: that check belongs where the column is built.

$ mbt.diagnostics.detect_lookahead(strategy, config, store)
 
Lookahead Bias Detection Report
================================
 
Tolerance: 1.0%
 
Signal 'fast' no future data ok
Signal 'slow' no future data ok
Signal 'rsi' no future data ok
Signal 'entry' no future data ok
Position sizing no future data ok
 
Result: CLEAN - no lookahead bias detected

Exposure stability

Verifies that strategy exposure is consistent when you extend or truncate the backtest period. Detects regime-dependent behavior.

$ mbt.diagnostics.check_exposure_stability(strategy, config, store)
 
Exposure Stability Report
=========================
 
Exposure drift, window 1: 0.3% ok
Exposure drift, window 2: 0.8% ok
Regime sensitivity: stable across 3 windows
 
Result: STABLE - exposure consistent across time ranges

Pricing

The engine is free and runs at full speed. Pro lifts the research caps. Researcher adds the tick layer and the GPU. Firm adds distributed compute on your own infrastructure and a named contact.

Community
Free
Full-speed engine, no time limit
No card, no account
pip install manifoldbt
  • Rust-powered engine
  • All 104 indicators
  • Multi-asset
  • Crypto, FX & stock connectors, CSV / DataFrame import
  • MCP server (AI agent integration)
  • Prop-firm account rules
  • Engine resolution: 1m
  • Timeseries output: Daily
  • Monte Carlo resampling: 1,000 sims
  • Parameter sweeps (all-core, 2-D, batch): 256 runs per sweep
  • Exposure & risk checks
Pro
$16/mo
No caps, 1-second bars
$190 billed yearly
  • Rust-powered engine
  • All 104 indicators
  • Multi-asset
  • Crypto, FX & stock connectors, CSV / DataFrame import
  • MCP server (AI agent integration)
  • Prop-firm account rules
  • Engine resolution: 1s
  • Timeseries output: Up to 1s
  • Monte Carlo resampling: Unlimited
  • Parameter sweeps (all-core, 2-D, batch): Unlimited
  • Look-ahead detection
  • Exposure & risk checks
  • Cross-exchange backtesting
  • Databento & Massive connectors
  • Built-in WFO
Researcher
$33/mo
Tick data, real fills, GPU
$390 billed yearly
  • Rust-powered engine
  • All 104 indicators
  • Multi-asset
  • Crypto, FX & stock connectors, CSV / DataFrame import
  • MCP server (AI agent integration)
  • Prop-firm account rules
  • Engine resolution: Tick
  • Timeseries output: Up to 1s
  • Monte Carlo resampling: Unlimited
  • Parameter sweeps (all-core, 2-D, batch): Unlimited
  • Look-ahead detection
  • Exposure & risk checks
  • Cross-exchange backtesting
  • Databento & Massive connectors
  • Built-in WFO
  • GPU acceleration
  • Order flow from the tape
  • Real bid / ask (BBO)
  • Tick-resolved fills
  • L2/L3 order book & queue position
Firm
From$490/mo
Self-hosted compute, SLA
Annual contract
  • Rust-powered engine
  • All 104 indicators
  • Multi-asset
  • Crypto, FX & stock connectors, CSV / DataFrame import
  • MCP server (AI agent integration)
  • Prop-firm account rules
  • Engine resolution: Tick
  • Timeseries output: Up to 1s
  • Monte Carlo resampling: Unlimited
  • Parameter sweeps (all-core, 2-D, batch): Unlimited
  • Look-ahead detection
  • Exposure & risk checks
  • Cross-exchange backtesting
  • Databento & Massive connectors
  • Built-in WFO
  • GPU acceleration
  • Order flow from the tape
  • Real bid / ask (BBO)
  • Tick-resolved fills
  • L2/L3 order book & queue position
  • Distributed compute on your infrastructure
  • Connectors built for your data
  • Priority support: Contractual SLA

In detail: what Pro unlocks, what Researcher adds, what Firm covers. Prices exclude tax.

FAQ

Learn backtesting in Python

Step-by-step guides, runnable strategy walkthroughs, and honest comparisons, all built on realistic, reproducible backtests.

Guides

Or browse 15 Python trading strategies, each with runnable code and a backtest, see all strategies →

Run it on your own strategy

The engine is free and runs at full speed, on your machine, with your data. The speed figures on this page come from a public CI run, if you would rather check them first.

$pip install manifoldbt
See the benchmark →