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

This runs a strategy on a simulated market.

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.0

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.0
File Size Uploaded Provenance Actions
fastmm_engine-0.10.0.tar.gz 7.0 MB Without provenance Details for fastmm_engine-0.10.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for fastmm-engine 0.10.0
File Actions
fastmm_engine-0.10.0-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.0-cp314-cp314-manylinux_2_28_x86_64.whl
fastmm_engine-0.10.0-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.0-cp313-cp313-manylinux_2_28_x86_64.whl
fastmm_engine-0.10.0-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.0-cp312-cp312-manylinux_2_28_x86_64.whl
fastmm_engine-0.10.0-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.0-cp311-cp311-manylinux_2_28_x86_64.whl
fastmm_engine-0.10.0-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.0-cp310-cp310-manylinux_2_28_x86_64.whl

Total release size: 28.9 MB

Release files / fastmm_engine-0.10.0.tar.gz

Download URL fastmm_engine-0.10.0.tar.gz
Size 7.0 MB
Tags Source
SHA-256 checksum
How to use checksums
eea86a4d1f367f4a43cb5a05966bcb993f1daa574b9c80d4154091b7c6d8eb77
BLAKE2b-256 checksum
How to use checksums
6e2f00dbab8c88c98bcea39e32a74163e06d5777cfea22a6dc411191ef6f8924
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.0-cp314-cp314-manylinux_2_28_x86_64.whl

Download URL fastmm_engine-0.10.0-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
5078b68947243616b11d62e47fc295a6218380bf83539a000d3ab255ef41b3bd
BLAKE2b-256 checksum
How to use checksums
ffeaa3e286396b9f11ae23642f0308143badf494cba71742e32e08f213ea83fb
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.0-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL fastmm_engine-0.10.0-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
162543407e3c4a95d606edb7b1104690f06e0947ca654ce2d101e8f0053fa0fb
BLAKE2b-256 checksum
How to use checksums
4486aabb929d36800a7f0ff5205fc958d0144704661ae5ef94d668a7a4919338
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.0-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL fastmm_engine-0.10.0-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
d5bbff3950eaa5d2273bcc3a0abd2157bd9285006a6d635424d14efdffc59158
BLAKE2b-256 checksum
How to use checksums
fefb74cf77fb6c82d4435da0345e1c4e3d0c8c1ba265cd6b47be25644713477d
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.0-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL fastmm_engine-0.10.0-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
6ed6732215e9999686b948f74738bc45944244ddb13de64edbb2733ffb73180c
BLAKE2b-256 checksum
How to use checksums
07a96de92665f80d6d13b1184f4f478268c3b7b47b04597c539b0192354e9dfe
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.0-cp310-cp310-manylinux_2_28_x86_64.whl

Download URL fastmm_engine-0.10.0-cp310-cp310-manylinux_2_28_x86_64.whl
Size 4.3 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
650f80ab5e7676a9c9fad231f522e4accebe10de2e726b4bc3b4809b757e5afc
BLAKE2b-256 checksum
How to use checksums
15f941677389ae43284eb53ae2a52f14eed9b8fc8b44f8cc2c23a999ed5a4c1e
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.0

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