Is a cryptocurrency exchange and derivative trading platform.
The following APIs are supported:
Bitmex API has 2 types of methods: public and private. Public methods can be accessed without authentication, example: get ticker prices. Only are only private and related to user data, those methods requires the use of Bitmex API keys.
REST API
Subscribe / Unsubscribe
BitMEX allows subscribing to real-time data. This access is not rate-limited once connected and is the best way to get the most up-to-date data to your programs. In some topics, you can pass a Symbol to filter events by symbol, example: trades, quotes...
The following subscription topics are available without authentication:
btmAnnouncement: Site Announcements
btmChat: Trollbox chat
btmConnected: Statistics of connected users/bots
btmFunding: Updates of swap funding rates. Sent every funding interval (usually 8hrs)
btmInstrument: Instrument updates including turnover and bid/ask
btmInsurance: Daily Insurance Fund updates
btmLiquidation: Liquidation orders as they're entered into the book
btmOrderBookL2_25: Top 25 levels of level 2 order book
btmOrderBookL2: Full level 2 order book
btmOrderBook10: Top 10 levels using traditional full book push
btmPublicNotifications: System-wide notifications (used for short-lived messages)
btmQuote: Top level of the book
btmQuoteBin1m: 1-minute quote bins
btmQuoteBin5m: 5-minute quote bins
btmQuoteBin1h: 1-hour quote bins
btmQuoteBin1d: 1-day quote bins
btmSettlement: Settlements
btmTrade: Live trades
btmTradeBin1m: 1-minute trade bins
btmTradeBin5m: 5-minute trade bins
btmTradeBin1h:1-hour trade bins
btmTradeBin1d: 1-day trade bins
The following subjects require authentication:
btmAffiliate: Affiliate status, such as total referred users & payout %
btmExecution: Individual executions; can be multiple per order
btmOrder: Live updates on your orders
btmMargin: Updates on your current account balance and margin requirements
btmPosition: Updates on your positions
btmPrivateNotifications: Individual notifications - currently not used
btmTransact: Deposit/Withdrawal updates
btmWallet: Bitcoin address balance data, including total deposits & withdrawals
Example of messages received:
{
"table":"orderBookL2_25",
"keys":["symbol","id","side"],
"types":{"id":"long","price":"float","side":"symbol","size":"long","symbol":"symbol"}
"foreignKeys":{"side":"side","symbol":"instrument"},
"attributes":{"id":"sorted","symbol":"grouped"},
"action":"partial",
"data":[
{"symbol":"XBTUSD","id":17999992000,"side":"Sell","size":100,"price":80},
{"symbol":"XBTUSD","id":17999993000,"side":"Sell","size":20,"price":70},
{"symbol":"XBTUSD","id":17999994000,"side":"Sell","size":10,"price":60},
{"symbol":"XBTUSD","id":17999995000,"side":"Buy","size":10,"price":50},
{"symbol":"XBTUSD","id":17999996000,"side":"Buy","size":20,"price":40},
{"symbol":"XBTUSD","id":17999997000,"side":"Buy","size":100,"price":30}
]
}
{
"table":"orderBookL2_25",
"action":"update",
"data":[
{"symbol":"XBTUSD","id":17999995000,"side":"Buy","size":5}
]
}
{
"table":"orderBookL2_25",
"action":"delete",
"data":[
{"symbol":"XBTUSD","id":17999995000,"side":"Buy"}
]
}
{
"table":"orderBookL2_25",
"action":"insert",
"data":[
{"symbol":"XBTUSD","id":17999995500,"side":"Buy","size":10,"price":45},
]
}
Authentication
If you wish to subscribe to user-locked streams, you must authenticate first. Note that invalid authentication will close the connection.
BitMEX API usage requires an API Key.
Permanent API Keys can be locked to IP address ranges and revoked at will without compromising your main credentials. They also do not require renewal.
To use API Key auth, you must generate an API Key in your account.
Cal method Authenticate before subscribe to any Authenticated Topic.
Method | Description |
GetExecutions | This returns all raw transactions, which includes order opening and cancelation, and order status changes. |
GetExecutionsTradeHistory | This returns more focused Transactions. |
GetInstruments | This returns all instruments and indices, including those that have settled or are unlisted. Use this endpoint if you want to query for individual instruments or use a complex filter. |
GetOrders | To get open orders only |
PlaceOrder | Place a raw order using TsgcHTTPBitmexOrder object. |
PlaceMarketOrder | Place a new MARKET order. |
PlaceLimitOrder | Place a new LIMIT order. |
PlaceStopOrder | Place a new STOP order. |
PlaceStopLimitOrder | Place a new STOPLIMIT order. |
AmendOrder | Modify an existing order. |
CancelOrder | Cancels an active Order. |
CancelAllOrders | Cancel All Active Orders. |
CancelAllOrdersAfter | Cancel All Orders after some time. |
ClosePosition | Close an open position. |
GetOrderBook | Get Current OrderBook in vertifcal format |
GetPosition | Get your positions. |
SetPositionIsolate | Enable isolated margin or cross-margin per position. |
SetPositionLeverage | Choose leverage per position. |
SetPositionRiskLimit | Update your risk limit. |
SetPositionTransferMargin | Transfer equity in or out of a position. |
GetQuotes | Get Quotes |
GetTrades | Get Trades |