EWe’ve been quiet lately, because we’ve been working on one of the biggest updates BitMEX has ever received.
This is a multi-part upgrade; today we’re launching the API, but we’ll be launching a few new contracts and a reworked order dashboard very soon.
So what’s new in this update?
All updates are additions; no breaking changes have been made. In short:
- 10 new order types, including some very advanced types
- Bulk ordering
- Order Amending
- Bulk amending
- A new way to manage your leverage, before and while having an open position, and
- Various performance & stability updates.
Detailed Notes:
- Order: New endpoint: POST /api/v1/order/bulk. (docs) Send an array of orders and they will all be validated and executed at the same time. If any of the orders fail to validate, none will execute. To encourage use, bulk orders (and amends) are ratelimited atceil(orders.length / 2); for example, placing 2 orders consumes 1 call, and 9 consumes 5 calls.
- Order: New endpoint: PUT /api/v1/order. (docs) You may now amend an existing order’s price and quantity. This is very useful for market makers who want to save an API call (cancel/replace) and not lose their position in the book.
- Order: New endpoint: PUT /api/v1/order/bulk(docs). You may now amend multiple orders. The same behavior as bulk order placement applies.
- Order: New order types! (docs)
- Market: We gave in. For simplicity’s sake, we now support Market orders. As always, be careful. Required:orderQtyandsymbol.
- Stop: A Stop Market order. Required: orderQty,stopPx, andsymbol.
- MarketWithLeftOverAsLimit: A market order that, after eating through the order book as far as permitted by available margin, will become a limit order. The difference between this type and Marketonly affects the behavior in thin books. Upon reaching the deepest possible price, if there is quantity left over, aMarketorder will cancel the remaining quantity.MarketWithLeftOverAsLimitwill keep the remaining quantity in the books as aLimit.
- Trailing Stop: A trailing stop follows the current market price at an offset, enabling a trade to remain open, yet closing if the market changes direction by a certain amount. Send a pegPriceType: 'TrailingStopPeg'and apegOffsetValue: number. ThepegOffsetValueis a price offset. Use a negativepegOffsetValuefor sell orders.
- OCO: One Cancels the Other. A very flexible version of the standard Stop / Take Profit technique. Multiple orders may be linked together using a single clOrdLinkID. Send acontingencyTypeofOneCancelsTheOtheron the orders. The first order that fully or partially executes (or activates forStoporders) will cancel all other orders with the sameclOrdLinkID.
- OTO: One Triggers the Other. Send a contingencyTypeofOneTriggersTheOtheron the primary order and then subsequent orders with the sameclOrdLinkIDwill be not be triggered until the primary order fully executes.
- OUOA: One Updates the Other Absolute. Send a contingencyTypeofOneUpdatesTheOtherAbsoluteon the orders. Then as one order has a execution, other orders with the sameclOrdLinkIDwill have their order quantity amended down by the execution quantity.
- OUOP: One Updates the Other Proportional. Send a contingencyTypeofOneUpdatesTheOtherProportionalon the orders. Then as one order has a execution, other orders with the sameclOrdLinkIDwill have their order quantity reduced proportionally by the fill percentage.
 
- Market: We gave in. For simplicity’s sake, we now support Market orders. As always, be careful. Required:
- Order: New Order attributes:
- Hidden Orders: Send a displayQty, where0 <= displayQty < orderQty. AdisplayQtyof0is a fully hidden order. You may partially hide an order by choosing a non-zerodisplayQty. When the order is hit, the non-hidden portion will be refilled, up to the order’s total quantity. Note that hidden orders incur the Taker fee.
- Post-Only Orders: Any non-Market order may be made “Post-Only” by sending an execInstofParticipateDoNotInitiate. This will reject the order if it would execute against the market, ensuring your order receives the Maker rebate. To prevent feeling out Hidden Orders, Post-Only Orders will still execute against Hidden Orders, but you will receive the Maker rebate as Hidden Orders always incur the Taker fee.
- Time In Force: Valid options: Day,GoodTillCancel,ImmediateOrCancel,FillOrKill. Defaults toGoodTillCancelforLimitandStopLimitorders.
- Simple Quantities: Send a simpleOrderQtyinstead of anorderQtyto create an order denominated in the underlying currency. Useful for e.g. opening up a position with 1 XBT of exposure without having to calculate how many contracts it is.
 
- Hidden Orders: Send a 
Other Changes:
- WebSockets: Upon subscribing to a topic, a data image is now immediately pushed to the consumer. This means consumers no longer need to orchestrate calls to the HTTP API or use pushAccount/pushSymbol.- As a result pushAccount/pushSymbolhave been made redundant and are now deprecated. They will be removed in a later release.
 
- As a result 
- Position: New endpoint: POST /api/v1/position/leverage. Accepts asymbolandleverageinteger. This is a very easy way to update a position to isolated(fixed) margining at a given leverage. In the very near future, this will allow users on the website to easily adjust their leverage, even on open positions! For example:- A user deposits 1 XBT of margin.
- The user opens a cross-margin XBT24Hposition with a gross value of 2 XBT.
- The user decides to switch to isolated margin to protect his total account equity, and updates leverage to 50.
- The system assigns 2 XBT / 50or0.04 XBTto the position. The other0.96 XBTin the user’s account is no longer at risk.
- The user decides to switch to 1xisolated margin. Because the position value is 2 XBT and the user only has 1 XBT in the account, this will error and no change will occur.
- The user’s position loses 0.02 XBTof value, and only0.02 XBTremains assigned, for an effective leverage of100x. The user then decides to switch to10xleverage. The system then assigns2 XBT / 10or0.20 XBTto the position. The user has0.78 XBTof unassigned margin left.
 
- UDF/TradeBin: Indices (.XBT,.BVOL, etc) are now supported via the UDF (TradingView) and/api/v1/tradeBinroutes. In the near future, we will officially support overlaying underlying prices on the charts.
The new bulk order calls greatly simplify market making on BitMEX. We have updated our Reference Market Maker to support the latest calls, and as a result has been significantly improved in speed and accuracy.
Much more is on the way. Stay tuned.
As always, catch us in our chat box, on Telegram (we’re in the major trading channels), or via email (support@bitmex.com) if you have questions.
Good Luck,
Samuel Reed, CTO, BitMEX
