Skip to main content

No project description provided

Project description

ManifoldBT logo

ManifoldBT
Rust-powered backtesting engine for quantitative research

Discord

Website · Documentation · Examples


ManifoldBT compiles Python strategy definitions into an optimized Rust expression graph. Write strategies in a fluent Python DSL — execute them on a vectorized Rust engine.

Why ManifoldBT

  • Fast — 500K bars in ~26ms. 161x faster than vectorbt, 1000x+ faster than backtrader.
  • Expressive — fluent DSL with 30+ indicators, conditional logic, cross-asset references
  • Rigorous — Monte Carlo, walk-forward, parameter sweeps, lookahead detection, exposure diagnostics
  • Portablepip install, no Rust toolchain needed. Works on Python 3.9+.

Installation

pip install manifoldbt              # engine only: backtests, sweeps, metrics
pip install manifoldbt[plot]        # + interactive charts and native windows (show=True)
pip install manifoldbt[all]         # everything: plots, windows, PNG export, pandas/polars

The base install stays light (no browser, no GUI) for scripts, servers and CI. [plot] adds plotly and a native window backend; [all] also pulls kaleido for static PNG/SVG export (which bundles a headless Chromium).

Quick Start

import manifoldbt as mbt
from manifoldbt.indicators import close, ema
from manifoldbt.helpers import time_range, Interval, Slippage

fast = ema(close, 12)
slow = ema(close, 26)

strategy = (
    mbt.Strategy.create("ema_crossover")
    .signal("fast", fast)
    .signal("slow", slow)
    .signal("signal", mbt.when(fast > slow, mbt.lit(1.0), mbt.lit(-1.0)))
    .size(mbt.col("signal") * mbt.lit(0.25))
)

start, end = time_range("2022-01-01", "2025-01-01")

config = mbt.BacktestConfig(
    universe=[1],
    time_range_start=start,
    time_range_end=end,
    bar_interval=Interval.hours(12),
    initial_capital=10_000,
    execution=mbt.ExecutionConfig(allow_short=True, max_position_pct=0.5),
    fees=mbt.FeeConfig.binance_perps(),
    slippage=Slippage.fixed_bps(2),
    warmup_bars=30,
)

store = mbt.ingest(provider="binance", symbol="BTCUSDT", symbol_id=1,
                   start="2022-01-01T00:00:00Z", end="2025-01-01T00:00:00Z", interval="1h")
result = mbt.run(strategy, config, store)
print(result.summary())

Loading data

Bring your own data, or pull it from a built-in connector — both return a DataStore ready for mbt.run(...).

CSV — free on all tiers, auto-detects standard / MetaTrader 4 / MetaTrader 5:

store = mbt.import_csv("EURUSD_1m.csv", symbol="EURUSD", symbol_id=1,
                       interval="1m", asset_class="forex")

Exchange connectors — Binance, Bybit, Hyperliquid, dYdX, Bitstamp (free); Databento, Massive (Pro):

store = mbt.ingest(provider="binance", symbol="BTCUSDT", symbol_id=1,
                   start="2024-01-01T00:00:00Z", end="2025-01-01T00:00:00Z")

Or from the CLI:

manifoldbt import-csv data.csv --symbol EURUSD --symbol-id 1 --interval 1m
manifoldbt ingest --provider binance --symbol BTCUSDT --symbol-id 1 --start ... --end ...

Examples

# Example What it shows
00 Template Minimal starting point
01 Trend Following EMA crossover, volume filter, stop-loss
02 Mean Reversion EMA crossover with parameter sweep
03 Multi-Asset Momentum Cross-asset signals
04 Linear Regression Regression-based signal
05 Statistical Arbitrage Pairs trading, spread z-score
06 Full Visualization Tearsheet and charts
07 Walk-Forward Out-of-sample validation
08 2D Sweep Parameter grid heatmap
09 3D Surface Parameter surface plot
10 Monte Carlo Permutation-based robustness
11 Portfolio Multi-strategy portfolio
12 Diagnostics Lookahead & exposure safety checks
13 Stochastic Simulation SDE path simulation (GBM, Heston, …)
14 Multi-Timeframe Combining signals across timeframes
15 Cross-Exchange Signal on one venue, execute on another
16 Exogenous Data External series (e.g. hashrate) as a signal
17 Per-Venue Fees Per-venue funding & borrow costs
18 CSV Import Load OHLCV from CSV (standard / MT4 / MT5)

Performance

EMA(12/26) + RSI(14) on 500K synthetic 1-min bars (median of 5 runs):

Engine Time vs ManifoldBT
ManifoldBT (Rust) 26 ms 1x
vectorbt (NumPy) 4,094 ms 161x slower
backtrader (Python) ~1000x slower

Reproduce: python benchmarks/bench_vs_competitors.py --rows 500000 --runs 5

Documentation

Full API reference, indicator list, configuration guide, and best practices:

www.manifoldbt.com/docs/documentation.html

Community vs Pro

Community Pro
Output resolution Daily 1m, 5m, 15m, 1h
Monte Carlo 1K sims Unlimited
Walk-Forward - Anchored + Rolling
Parameter Stability - Yes
Crypto connectors (Binance, Bybit, Hyperliquid) Yes Yes
Databento & Massive connectors - Yes
Safety checks (lookahead, exposure) - Yes
Tearsheets & export - Yes

License

Apache 2.0 with Commons Clause. The source is available, free to use, modify and self-host. Reselling the software or offering it as a paid hosted service is not permitted. See LICENSE for the full text.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

manifoldbt-0.14.0-cp39-abi3-win_amd64.whl (8.4 MB view details)

Uploaded CPython 3.9+Windows x86-64

manifoldbt-0.14.0-cp39-abi3-musllinux_1_2_x86_64.whl (8.4 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ x86-64

manifoldbt-0.14.0-cp39-abi3-musllinux_1_2_aarch64.whl (7.9 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

manifoldbt-0.14.0-cp39-abi3-manylinux_2_34_x86_64.whl (8.3 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.34+ x86-64

manifoldbt-0.14.0-cp39-abi3-manylinux_2_28_aarch64.whl (7.5 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ ARM64

manifoldbt-0.14.0-cp39-abi3-macosx_11_0_arm64.whl (7.3 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

manifoldbt-0.14.0-cp39-abi3-macosx_10_12_x86_64.whl (8.0 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file manifoldbt-0.14.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: manifoldbt-0.14.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 8.4 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for manifoldbt-0.14.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 9e89f9dd2e6f7889e149d3e106bae2c3edaec31ddc589a268c1b02d282d0032d
MD5 5897e18707e1b3e53a1aa117c9b7b849
BLAKE2b-256 003ab8144b7d18c7bc8fb17c99c94f72dc6ad6faf90f7b3f1edaad669baafa85

See more details on using hashes here.

File details

Details for the file manifoldbt-0.14.0-cp39-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for manifoldbt-0.14.0-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 cc6d3603e923204e7975b7e9324581fc11fe5bb1eb92df52810132bcedbf1267
MD5 4de0f9ad4671442dfe7434f8542ba09f
BLAKE2b-256 b4fd7f8cff6fae492f2a25f06cba42ef2332b57be68de4c210f84d428a426163

See more details on using hashes here.

File details

Details for the file manifoldbt-0.14.0-cp39-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for manifoldbt-0.14.0-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 39426a61dc298b853f77542b1a690be02eeb7b050c7f49ce5f2af7f6b65b4159
MD5 1b0c2aba5429da69a0105b0dc29d1f7b
BLAKE2b-256 f8369ff039166aede7e817213b797802b142a03a325343d750e6fc4d263b4e34

See more details on using hashes here.

File details

Details for the file manifoldbt-0.14.0-cp39-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for manifoldbt-0.14.0-cp39-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 890af10d37272550b14fe1c461d847616153317b856bb31cb9105cd24e6d4d59
MD5 e6fd2a93d2aaf3089704b2e1da89cb6d
BLAKE2b-256 eb8129a980cb4ce2b3315312eda080b7a3aad1533faee4beb19f4fec84b903a0

See more details on using hashes here.

File details

Details for the file manifoldbt-0.14.0-cp39-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for manifoldbt-0.14.0-cp39-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3d2dd1f89f181e7057c6c93682c3ab01af5fba73aea79ef84e39fdcf9d81dd8b
MD5 08304199a25ccc26dba9f42dc48f9a6e
BLAKE2b-256 47c55f78467e4ff5aefcbaa50c806cb0e70db18be6dc7dd4572c5a229c6cf813

See more details on using hashes here.

File details

Details for the file manifoldbt-0.14.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for manifoldbt-0.14.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1aee885ba46f3756a3a299845676d68c5e50c8581e0013984d23cb0cd5070585
MD5 274e2f944a8a8496fbbb3646812409ab
BLAKE2b-256 516ff142f43e8d7c0ff62e544bb3af70c31a2e0a84d484489987331d81022ab8

See more details on using hashes here.

File details

Details for the file manifoldbt-0.14.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for manifoldbt-0.14.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 85f09c3510bb38e80462dd8d5b25d86c17caf9097ed83f8c64fe542e556626b2
MD5 2a0fa275931f2d9bd8f67354aba6eecb
BLAKE2b-256 9845eab3734d05be612503f9eb8c59e35141473a62eb473b8d5777db8a99f935

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page