Quick answer
BitMEX pioneered the perpetual swap and still offers a REST and WebSocket API for perpetuals, futures and spot. Requests are signed with HMAC-SHA256 over verb + path + expires + body, and a full testnet at testnet.bitmex.com with test coins makes it easy to rehearse a bot. Bucketed trade bins provide public OHLCV.
BitMEX API at a glance
- Pricing
- Free API; trading fees apply
- Availability
- Global; not US residents
- Paper trading
- Testnet at testnet.bitmex.com
- Integration type
- REST + API key
- In AlgoGP
- Design and backtest in AlgoGP, connect the exported code
- Auth
api-key,api-expires,api-signature(HMAC-SHA256)- Host
https://www.bitmex.com/api/v1- Testnet
https://testnet.bitmex.com
Public market data from BitMEX
curl -s "https://www.bitmex.com/api/v1/trade/bucketed?binSize=1h&symbol=XBTUSD&count=200&reverse=true"Save the bars as CSV and replay them with the exported python backtest.py --csv bars.csv, or use CCXT to read the same candles in one line of Python.
What to know before automating BitMEX
- Quantities on inverse contracts like XBTUSD are in USD contracts, not BTC.
- Bucket timestamps mark the bin close.
Build a BitMEX strategy with AlgoGP
AlgoGP does not connect to BitMEX natively yet. BitMEX uses plain HTTPS with an API key, so it is a good candidate for a native adapter; it is not built in yet.
- 1
Design and backtest in AlgoGP
Describe the strategy to the copilot and backtest it on years of normalized history. The result does not depend on any vendor.
- 2
Export the Python project
Every project exports
strategy.py,market_data.py,brokers.pyandlive.py. The strategy only sees bars, cash, positions and orders, never a vendor’s wire format. - 3
Plug in BitMEX
Implement the four adapter methods (
account,positions,submit_market_orderand a candle fetcher) with BitMEX’s SDK, or keep a built-in platform for paper trading and add BitMEX when you go live.
Built-in brokers for the same markets: Alpaca, Binance, Kraken, Bybit.
BitMEX API: frequently asked questions
Is BitMEX available in the US?
No; US persons are excluded.
Design and backtest your BitMEX strategy first
AlgoGP turns an idea into Python and tests it on years of history before you connect it to BitMEX. The exported code keeps the broker behind four small adapter methods.
- AI copilot writes and revises the rules
- Backtests with realistic costs
- Exported Python ready to wire to BitMEX
Free plan, no card required.
BitMEX alternatives
- Deribit API Built into AlgoGP (data)The leading crypto options exchange, with JSON-RPC over HTTP and WebSocket, FIX and a test environment.
- Bybit API Built into AlgoGPGlobal crypto exchange with a unified V5 API for spot, derivatives and options, and a Demo Trading environment.
- OKX API Built into AlgoGPMajor crypto exchange with a V5 REST and WebSocket API for spot, perpetuals, futures and options, plus demo trading.
- Hyperliquid API GuideOn-chain perpetuals and spot exchange with a REST and WebSocket API; trading actions are signed with a wallet key.
Frameworks that connect to BitMEX
Independent guide. AlgoGP is not affiliated with BitMEX. Limits, prices and availability change; confirm them in the official documentation. Nothing here is investment advice.