Skip to main content

FastMM

CI Docs PyPI License

FastMM is a low-latency market-making engine. Read the documentation.

https://github.com/user-attachments/assets/dcd130c5-28fe-482f-a757-d0fc6550c5b9

Features

  • Low latency. In the engine a book update becomes an order in 143 ns (p50). Core pinning, busy polling, AF_XDP or DPDK receive and OpenOnload or XLIO order entry tune the host around it.
  • Sweeps in one pass. Thousands of parameter points share one pass over the data, and each gets the result its own backtest gives: 16,384 points over four hours of Binance BTCUSDT futures took 228 s on 8 threads.
  • Quote on one venue, hedge on another. xmm makes the market on one exchange and hedges each fill with an IOC on another.
  • C++ or Python, backtest or live. One strategy file runs in backtests, replays and live sessions; replays are deterministic and the simulated exchange models queue position. Python hooks marked @fastmm.hot compile to machine code with Numba.
  • Many accounts, one gateway. Several sub-accounts trade behind one venue, and strategy processes attach to one fastmm-gateway that keeps the exchange connections while they restart.
  • A/B tests. Parameter sets run side by side, split by instrument, by time block or both, and are compared on markouts and net with paired intervals.

Quickstart

python3 -m venv .venv && . .venv/bin/activate
pip install "fastmm-engine[hot]"
fastmm init my-mm && cd my-mm
python backtest.py
backtest py:MyMm  seed=1  md_events=7149  steps=12428  wall=0.02s
  net pnl                        -5.5272
  realized / unrealized / fees   0.5198 / 0.0005 / 6.0475
  fills (maker / taker)          1036 (1036 / 0)
  ...

This backtests a strategy on a simulated market; the Quick start goes on to a live session.

A strategy

import fastmm
from fastmm import Param


class TouchMM(fastmm.Strategy):
    half_spread_bps = Param(0.01, min=0.0, doc="half spread, bps")
    quote_qty = Param(0.002, min=0.0, doc="size per side")

    @fastmm.hot  # compiled to machine code with Numba
    def on_book(self, ctx, book):
        if not book.valid:
            ctx.pull()
            return
        half = book.mid * self.half_spread_bps * 1e-4
        ctx.clear()
        ctx.bid(book.mid - half, self.quote_qty)
        ctx.ask(book.mid + half, self.quote_qty)
        ctx.keep_passive()

Exchanges

FastMM trades on Binance (spot and USDⓈ-M futures), OKX, Bybit, Gate, Hyperliquid, Lighter, Deribit, Gemini, Coinbase (Advanced Trade and Exchange) and, for US stocks, Alpaca (Venue connectors).

If you are running FastMM on Binance, try bndesk, a real-time dashboard for your accounts.

License

MIT

Metadata

Release files for fastmm-engine 0.10.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastmm-engine 0.10.1
File Size Uploaded Provenance Actions
fastmm_engine-0.10.1.tar.gz 7.9 MB Without provenance Details for fastmm_engine-0.10.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for fastmm-engine 0.10.1
File Actions
fastmm_engine-0.10.1-cp314-cp314-manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ x86-64 Details for fastmm_engine-0.10.1-cp314-cp314-manylinux_2_28_x86_64.whl
fastmm_engine-0.10.1-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details for fastmm_engine-0.10.1-cp313-cp313-manylinux_2_28_x86_64.whl
fastmm_engine-0.10.1-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details for fastmm_engine-0.10.1-cp312-cp312-manylinux_2_28_x86_64.whl
fastmm_engine-0.10.1-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details for fastmm_engine-0.10.1-cp311-cp311-manylinux_2_28_x86_64.whl
fastmm_engine-0.10.1-cp310-cp310-manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64 Details for fastmm_engine-0.10.1-cp310-cp310-manylinux_2_28_x86_64.whl

Total release size: 29.8 MB

Release files / fastmm_engine-0.10.1.tar.gz

Download URL fastmm_engine-0.10.1.tar.gz
Size 7.9 MB
Tags Source
SHA-256 checksum
How to use checksums
bfbdd5c79ecae4bbabe5ccb57fdae50a7d67459cdfbcb430c505c779dc4a6873
BLAKE2b-256 checksum
How to use checksums
9c71de3149c821b66ff07242c276dea2fcdf237687ea61d846c2113545313455
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / fastmm_engine-0.10.1-cp314-cp314-manylinux_2_28_x86_64.whl

Download URL fastmm_engine-0.10.1-cp314-cp314-manylinux_2_28_x86_64.whl
Size 4.4 MB
Tags CPython 3.14 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
5d33562910b24af74c1653f5162f47a6ae074d315a92480b56618399a1f509e7
BLAKE2b-256 checksum
How to use checksums
a96f2419efac00481c97e408d2d62f3ed798b3ddac60ac5363325fe2acbcb55a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / fastmm_engine-0.10.1-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL fastmm_engine-0.10.1-cp313-cp313-manylinux_2_28_x86_64.whl
Size 4.4 MB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
47b7135db5cf893a04d58e0e073d0cd5084080d7acb0c5a18043d1b0e40c884a
BLAKE2b-256 checksum
How to use checksums
01aa95deb87fcb43b8a0f936d60108ad8702fce2cdd0ca979da8bfd74930f9b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / fastmm_engine-0.10.1-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL fastmm_engine-0.10.1-cp312-cp312-manylinux_2_28_x86_64.whl
Size 4.4 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
5f0de63583e35742cda6762cb9729465d30989252a5cc2f9e7380512f99c1194
BLAKE2b-256 checksum
How to use checksums
dff58dfb2a654d31ae97976c859294ba4afe7d6e650e8bf440f82a0202c84d8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / fastmm_engine-0.10.1-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL fastmm_engine-0.10.1-cp311-cp311-manylinux_2_28_x86_64.whl
Size 4.4 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
96fade11362fd52249f5afad331a179e9edd5294598f3a30d19cdfe6ca86c990
BLAKE2b-256 checksum
How to use checksums
b02aaccbbb9dce3f11161e089e44fbef487d9c8c05f958ed482f784fabd5f790
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / fastmm_engine-0.10.1-cp310-cp310-manylinux_2_28_x86_64.whl

Download URL fastmm_engine-0.10.1-cp310-cp310-manylinux_2_28_x86_64.whl
Size 4.4 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
d0b4a9720576e3041561e11f697d3557856d0d20b4d691a6eada49c31fd61ef5
BLAKE2b-256 checksum
How to use checksums
9187959bb541af2a8215110e1266e1f3cb83fa3dcbb482d92253c2743512224e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for fastmm-engine 0.10.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page