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

With all extras (plotting, pandas, polars):

pip install manifoldbt[all]

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.12.1-cp39-abi3-win_amd64.whl (8.3 MB view details)

Uploaded CPython 3.9+Windows x86-64

manifoldbt-0.12.1-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.12.1-cp39-abi3-musllinux_1_2_aarch64.whl (7.8 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

manifoldbt-0.12.1-cp39-abi3-manylinux_2_34_x86_64.whl (8.2 MB view details)

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

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

Uploaded CPython 3.9+manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.9+macOS 11.0+ ARM64

manifoldbt-0.12.1-cp39-abi3-macosx_10_12_x86_64.whl (7.9 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: manifoldbt-0.12.1-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 8.3 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.12.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 df04dc53d5c9da8ee85b81ecb488a08de68263298a7658320a26b96b218faebe
MD5 e55d058463b755c843afac0bbd9188b6
BLAKE2b-256 76ac4070b3237935deedb8d9bf0f4e8d923be90f55c06454677a07e470f18423

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for manifoldbt-0.12.1-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 40d2ff64c12807a1edcf645d1c02c2ea8a64d16f166e6f2e23f31d76708e4b37
MD5 3435f00e164920bf719a1be221fe924e
BLAKE2b-256 1e0c554624ee5df59efc158e4d0c4b09a3367c0dab1c5e5b339d12c0ade37489

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for manifoldbt-0.12.1-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 a0c781b384e96840718eb74633992c774d11af5629755f4530c63857ba44bbf9
MD5 6b9b0877ae920f6581ad4d98078a3700
BLAKE2b-256 0a9e6a6f166bc085423dbe7edcb7c67ef13f7e514c49e657b79c8bfbdc46d4d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for manifoldbt-0.12.1-cp39-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 75f7acd345bd4cc232e47ac8975af53e7734683ecd4cbdcc6e7453dd102fa38a
MD5 9c7d1d73f5d0cc69efb100cec3d382ed
BLAKE2b-256 8e57d02210837b52a2780d96c9f638c4cb420d63d0c04e708026e2d5b6e5a446

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for manifoldbt-0.12.1-cp39-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1e96d10ed77779ca28d4bd82ba2975ea4523e35f2fc57484664fba6e42e3f408
MD5 7ed677d883f95e5b3b52763b8b26b03a
BLAKE2b-256 05c381b8bb756426af4eec94c0d4dfb3c71e63b1c32eae5cd4ee7d5f1536b561

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for manifoldbt-0.12.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0ff2d2d6b23c64a7fe57f246ce0b415e6e5235025c29f84d2701e9d61eee5f1c
MD5 29832b47bc12a66b7fa17823ce5949b3
BLAKE2b-256 26289de42c3b9bc6415913e6450bfed43af1d092ec2c59e5b102c48c016b2b9f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for manifoldbt-0.12.1-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e19cb179698bc6963ea8522f3f0baf8f4061dc25c7e1e15c1d209482272ec1d2
MD5 671b8e8535958999eb28d16e862eb4c4
BLAKE2b-256 ae2a989b6241ab1c166358fdd0cc2a2e6924a857d36a3c6ad34a6154f2ff62f6

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