Integration
Stream BitMEX market data and execute spot, perpetual swap, futures, and spread orders through an adapter written in Rust, with REST and WebSocket access, a server-side dead man's switch, and full order and position reconciliation.
Crypto derivatives exchange
Spot, swaps, futures, spreads
Data and execution
Written in Rust 🦀
Founded in 2014, BitMEX (the Bitcoin Mercantile Exchange) is a cryptocurrency derivatives venue best known for inventing the perpetual swap in 2016, now the most traded instrument in crypto. It lists spot pairs, inverse and linear perpetual swaps, quanto contracts that settle in Bitcoin regardless of the underlying, and dated futures with their calendar spreads, all reached over a single REST and WebSocket API.
NautilusTrader integrates with BitMEX through nautilus-bitmex, a platform adapter written in Rust with Python bindings, providing both data and execution clients. It streams order books, quotes, trades, bars, and mark, index, and funding updates, and submits orders signed with HMAC-SHA256 in the Rust core rather than calling an external BitMEX SDK. Order, fill, position, and balance updates drive reconciliation, with liquidation and bankruptcy fills flagged as exchange-generated.
The adapter also wires up the venue-specific machinery that matters for running unattended: BitMEX's dead man's switch arms a server-side cancel-all timer that pulls every open order if the client goes quiet, while opt-in submit and cancel broadcasters fan time-critical requests across parallel HTTP clients and take the first success.
Spot, perpetual swaps, dated futures, and spreads, traded through one adapter and signing path.
Spot
Native spot pairs
Spot pairs quoted against USDT, USDC, and XBT, traded from the same wallet as the derivatives products rather than a separate spot account.
Market and limit orders
USDT, USDC, and XBT quoting
Unified wallet with derivatives
XBT_USDT.BITMEX
Perpetual swaps
Inverse, linear, and quanto
The contract BitMEX invented in 2016, listed three ways: inverse swaps settled in Bitcoin, linear swaps margined in USDT, and quanto swaps that price an altcoin in USD while settling in Bitcoin.
Inverse settlement in XBT
Linear USDT margining
Quanto contracts settled in XBT
XBTUSD.BITMEX
Futures
Dated and quanto
Fixed-expiry futures using standard month and year codes, settled inversely in Bitcoin, linearly in USDT, or as quanto contracts.
Standard month and year codes
Inverse, linear, and quanto settlement
Quarterly and dated expiries
XBTU26.BITMEX
Futures spreads
Basis as one symbol
Spread instruments that quote the basis between two legs as a single tradeable symbol, pairing spot, perpetual, and dated futures so a roll or basis trade is one order rather than two.
Basis quoted as one symbol
Spot, perpetual, and futures legs
Calendar and cash-and-carry rolls
XBTU26-XBTZ26.BITMEX
Crypto majors across linear perpetual swaps, Bitcoin-settled inverse and quanto contracts, spot pairs, and dated futures.
Perpetual swaps · Linear, USDT-margined
XBT
Bitcoin
ETH
Ethereum
SOL
Solana
XRP
XRP
ZEC
Zcash
HYPE
Hyperliquid
NEAR
Near
BCH
Bitcoin Cash
ADA
Cardano
DOGE
Dogecoin
SUI
Sui
WLD
Worldcoin
LTC
Litecoin
XAUT
Tether Gold
XMR
Monero
AVAX
Avalanche
+ More
USDT-margined perpetual swaps on crypto majors, e.g. XBTUSDT (Bitcoin) and ETHUSDT (Ethereum). Note that BitMEX writes Bitcoin as XBT, not BTC.
Inverse and quanto · Bitcoin-settled contracts
XBT
Bitcoin
ETH
Ethereum
SOL
Solana
XRP
XRP
DOGE
Dogecoin
LINK
Chainlink
BCH
Bitcoin Cash
BNB
BNB
ADA
Cardano
PEPE
Pepe
WLD
Worldcoin
LTC
Litecoin
XBTUSD is the flagship inverse swap: quoted in USD, margined and settled in Bitcoin. The quanto swaps price an altcoin against USD but also settle in Bitcoin, e.g. ETHUSD and SOLUSD.
Spot · USDT, USDC, and XBT quoted
XBT
Bitcoin
ETH
Ethereum
SOL
Solana
XRP
XRP
XAUT
Tether Gold
RLUSD
Ripple USD
USDC
USD Coin
LINK
Chainlink
UNI
Uniswap
TRX
TRON
ATOM
Cosmos
BMEX
BMEX Token
+ More
Spot symbols separate the pair with an underscore, e.g. XBT_USDT, ETH_XBT, and SOL_USDC. The underscore is what distinguishes spot XBT_USDT from the linear perpetual XBTUSDT.
Futures · Fixed expiry
XBT
Bitcoin
ETH
Ethereum
ADA
Cardano
XRP
XRP
Futures date the symbol with a month code and year, e.g. XBTU26 (September 2026) and XBTH27 (March 2027). Calendar spreads join two contracts, e.g. XBTU26-XBTZ26.
These are a representative sample. BitMEX lists close to 100 adapter-supported instruments across spot, perpetual swaps, futures, and spreads, and adds new ones continuously; the adapter discovers the live instrument set at startup and maps every BitMEX symbol to a NautilusTrader instrument.
Spot and derivatives
Spot pairs, perpetual swaps, dated futures, and calendar spreads, all reached from one wallet and one adapter.
HMAC-SHA256 signing
An API key and secret sign every REST and WebSocket request in the Rust core, with an api-expires window that BitMEX enforces against replays.
Data and execution
One adapter covers both market data and order execution, with order, fill, position, and balance reconciliation.
Dead man's switch
Arm BitMEX's server-side cancel-all timer and let the adapter keep it alive, so open orders are pulled automatically if connectivity drops.
Submit and cancel broadcasters
Fan submits and cancels across parallel HTTP clients and take the first success, trading rate limit budget for lower latency and fault tolerance.
Mainnet and testnet
Select the environment with one config enum; the adapter routes REST and WebSocket traffic to the matching endpoints and credentials.
Each BitMEX feed maps to a native NautilusTrader data type across the public streams.
Data feed
NautilusTrader type
Notes
Order book (L2)
OrderBookDeltasSnapshot then deltas from the L2 stream; depth is either the full book or 25 levels.
Order book (depth 10)
OrderBookDepth10Fixed 10-level snapshots from the orderBook10 channel.
Quotes
QuoteTickBest bid and offer streamed over WebSocket.
Trades
TradeTickLive public trades over WebSocket, with REST history up to 1,000 rows per call.
Bars
BarExternally aggregated 1m, 5m, 1h, and 1d time bars over REST, with optional partial bins.
Mark price
MarkPriceUpdateMark price for perpetual and futures contracts.
Index price
IndexPriceUpdateUnderlying index price, including the non-tradeable BitMEX reference indices.
Funding rate
FundingRateUpdatePerpetual funding, with the interval read from the venue fundingInterval field.
Instruments
CurrencyPairCryptoPerpetualCryptoFutureCryptoFuturesSpreadSpot pairs, perpetual swaps, dated futures, and calendar spreads discovered at startup.
Status
InstrumentStatusTrading-status transitions per instrument.
BitMEX maps to the full range of Nautilus order types, including both trailing stop variants, which reach the venue as pegged orders.
Type
Supported
Notes
Supported
Maps to a BitMEX pegged order with a trailing stop peg; absolute price offsets only.
Supported
Trailing peg that additionally carries the limit price; absolute price offsets only.
GTC, IOC, FOK, and DAY are all native. BitMEX has no good-till-date instruction.
Type
Supported
Notes
The execution instructions and account operations traders rely on.
Post-only
Maker-only limit orders. BitMEX cancels a crossing post-only order rather than rejecting it, so the adapter surfaces it as a rejection with the post-only reason set.
Reduce-only
Position-reducing flag carried through as a native BitMEX execution instruction.
Order modification
Amend price, quantity, and trigger price on resting orders in place, without a cancel-and-replace round trip.
Pegged orders
Delegate price selection to the exchange, pegging a limit order to the near touch, the far touch, the mid-price, or the last trade, with an optional offset.
Trigger types
Evaluate conditional orders against the last traded price, the mark price, or the index price; mark price reduces stop-outs from wick spikes.
Iceberg orders
Show only part of the order to the book with a display quantity, keeping the remainder hidden.
Data client
Public REST and WebSocket streams
Feeds: order books, quotes, trades, bars, and mark, index, and funding updates.
Products: one client covers spot, perpetual swaps, futures, and spreads from a single stream.
Resilience: reconnecting WebSocket with snapshot-and-buffer order book recovery, and keep-alive pooled HTTP.
Execution client
Signed orders over REST with WebSocket account streams
Orders: entry, in-place amend, conditional triggers, pegged and trailing orders, plus batch cancel.
Account: order, fill, position, and balance updates drive reconciliation, with liquidation and bankruptcy fills flagged as exchange-generated.
Safety: an optional dead man's switch, plus submit and cancel broadcasters for parallel request fanout.
Adapter crate
Data client
BitmexDataClient streams instruments, books, quotes, trades, bars, and mark, index, and funding updates.Execution client
BitmexExecutionClient handles signed orders, account queries, and reconciliation.Signing
Product types
Environments
BitmexEnvironment.Authentication
Considerations
Public market data needs no credentials; execution needs an API key and secret.
BitMEX writes Bitcoin as XBT rather than BTC, following the ISO 4217 convention where X denotes a non-national currency.
Instrument IDs use the native BitMEX symbol: XBTUSD (inverse swap), XBTUSDT (linear swap), XBT_USDT (spot), and XBTU26 (September 2026 future).
BitMEX reports quantities in contracts; the adapter derives the contract size from the venue lot size and position multiplier, so quantities in Nautilus stay in base units.
Time in force is GTC, IOC, FOK, or DAY; BitMEX has no native GTD, and DAY orders expire at 00:00 UTC.
Order book deltas are L2 only, at either full depth or 25 levels; the orderBook10 channel adds fixed 10-level snapshots.
Batch cancel is supported; BitMEX offers no batch submit or batch modify.
Rate limits are 10 requests per second burst and 120 per rolling minute for authenticated users, enforced locally by the adapter; each broadcaster client holds its own budget, so a pool multiplies the quota a request consumes.
The dead man's switch cancels every open order on the account, including orders placed by other systems.
Bracket flows link natively through the venue's contingent order mechanics, but mutual cancel between stop-loss and take-profit legs needs strategy-level emulation.
BitMEX reports auto-deleveraging and counterparty liquidation with the same execution code, so the two cannot be distinguished from the public API.
Stock perpetuals on equities, FX, and commodities are listed by BitMEX but not yet supported by the adapter; BitMEX has discontinued its options products.
Event-based prediction markets are mapped whenever BitMEX lists them, though no new event contract has been listed since 2024.
Starting points for the BitMEX adapter.
Read the integration guide
Installation, account setup, configuration, symbology, order handling, and environments for the BitMEX adapter.
Read guide
Grid market making tutorial
Backtest the shipped grid market maker on XBTUSD with free Tardis.dev quote data, then run the same config live behind a dead man's switch.
Read tutorial
Rust adapter examples
Runnable example nodes bundled with the crate: market data and execution testers, and a grid market maker.
View on GitHub
Python live examples
Live data and execution tester scripts wiring the BitMEX adapter into a Python trading node.
View on GitHub
Integration guide
Read the full integration guide
The guide covers installation, account setup, configuration, symbology, order handling, rate limits, and worked examples for trading BitMEX.
NautilusTraderâ„¢ is a product of Nautech Systems Pty Ltd (ABN 88 609 589 237). Nautech Systems provides algorithmic trading software only. We do not operate as a broker, dealer, or exchange, nor offer financial advisory services. Users are solely responsible for compliance with applicable laws and regulations. Subject to non-excludable consumer guarantees, we make no warranties and accept no liability for trading losses or regulatory violations arising from use of the software. Read full disclaimer.
We use essential cookies and, with your consent, optional analytics cookies, as described in our Privacy Policy. Manage your Cookie Preferences.