The BitMart SDK streams all futures WebSocket data through a singleDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/tiagosiebler/bitmart-api/llms.txt
Use this file to discover all available pages before exploring further.
WebsocketClient. Public topics — ticker, order book depth, kline candlesticks, and trades — connect automatically without credentials. Private topics (orders, positions, and asset balances) require your API key, secret, and memo. All futures topics use the 'futures' market identifier in subscribe() and data arrives on the 'update' event. The client connects to the V2 futures WebSocket endpoint by default, which also supports a demo trading environment.
Futures symbols use no underscore separator. Use
BTCUSDT, ETHUSDT, etc. — not BTC_USDT. This is different from the spot market format.Setup
- Public (no credentials)
- Private (with credentials)
- Demo Trading
Public Futures Topics
Public topics provide live market data and do not require authentication.Topic Reference
| Topic format | Description |
|---|---|
futures/ticker | All futures tickers — best bid/ask and 24 h stats for every contract |
futures/depth5:{symbol} | Order book snapshot — top 5 bid and ask levels |
futures/depth20:{symbol} | Order book snapshot — top 20 bid and ask levels |
futures/depth50:{symbol} | Order book snapshot — top 50 bid and ask levels |
futures/trade:{symbol} | Real-time executed trade feed |
futures/klineBin1m:{symbol} | 1-minute candlestick (OHLCV) |
futures/klineBin3m:{symbol} | 3-minute candlestick |
futures/klineBin5m:{symbol} | 5-minute candlestick |
futures/klineBin15m:{symbol} | 15-minute candlestick |
futures/klineBin30m:{symbol} | 30-minute candlestick |
futures/klineBin1h:{symbol} | 1-hour candlestick |
futures/klineBin2h:{symbol} | 2-hour candlestick |
futures/klineBin4h:{symbol} | 4-hour candlestick |
futures/klineBin1d:{symbol} | 1-day candlestick |
futures/klineBin1w:{symbol} | 1-week candlestick |
Ticker
Thefutures/ticker topic streams data for all contracts simultaneously — no symbol suffix is required.
Order Book Depth
Trades
Kline / Candlestick
Futures kline topics use theklineBin prefix and lowercase interval suffixes. Multiple symbols and intervals can be batched into a single subscribe() call, which is more efficient than separate calls.
| Topic suffix | Interval |
|---|---|
klineBin1m | 1 minute |
klineBin3m | 3 minutes |
klineBin5m | 5 minutes |
klineBin15m | 15 minutes |
klineBin30m | 30 minutes |
klineBin1h | 1 hour |
klineBin2h | 2 hours |
klineBin4h | 4 hours |
klineBin1d | 1 day |
klineBin1w | 1 week |
Private Futures Topics
Private topics deliver account-level updates. TheWebsocketClient authenticates the private connection automatically when credentials are provided — no manual login step is required.
Topic Reference
| Topic format | Description |
|---|---|
futures/order | All order events: new, cancelled, partially filled, filled |
futures/position | All position updates across all contracts |
futures/asset:{currency} | Asset/balance update for a specific settlement currency |
futures/order and futures/position topics do not take a symbol suffix — they deliver events for all contracts on the account. To filter by contract, inspect the symbol field in the received message data.Order Updates
Position Updates
Asset / Balance Updates
Subscribe to balance changes for one or more settlement currencies. Multiple currencies can be batched in a single call.Demo Trading Environment
BitMart provides a simulated trading environment for futures. SetdemoTrading: true when constructing the WebsocketClient to connect to the demo WebSocket endpoint (wss://openapi-wsdemo-v2.bitmart.com). API keys are shared between production and demo environments.
The
demoTrading flag only affects the V2 futures WebSocket endpoints. Spot WebSocket connections are not affected and do not have a demo environment.Handling the update Event
All incoming messages emit on the single 'update' event. Inspect data.group (or data.table depending on message type) to identify the originating topic and fan out to the appropriate handler.
Unsubscribing
Pass the same topic strings and'futures' market to unsubscribe(). Unsubscribed topics are removed from the internal cache and won’t be re-subscribed after a reconnect.
Connection Events
| Event | When it fires |
|---|---|
open | WebSocket connection established |
authenticated | Private connection successfully authenticated |
response | Server acknowledgement of a subscribe/unsubscribe request |
update | Market data or account data received |
reconnect | Connection lost, attempting to reconnect |
reconnected | Reconnect successful (topics re-subscribed automatically) |
close | Connection closed |
exception | An error occurred |