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:
orderQty
andsymbol
. - 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
Market
only affects the behavior in thin books. Upon reaching the deepest possible price, if there is quantity left over, aMarket
order will cancel the remaining quantity.MarketWithLeftOverAsLimit
will 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
. ThepegOffsetValue
is a price offset. Use a negativepegOffsetValue
for 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 acontingencyType
ofOneCancelsTheOther
on the orders. The first order that fully or partially executes (or activates forStop
orders) will cancel all other orders with the sameclOrdLinkID
. - OTO: One Triggers the Other. Send a
contingencyType
ofOneTriggersTheOther
on the primary order and then subsequent orders with the sameclOrdLinkID
will be not be triggered until the primary order fully executes. - OUOA: One Updates the Other Absolute. Send a
contingencyType
ofOneUpdatesTheOtherAbsolute
on the orders. Then as one order has a execution, other orders with the sameclOrdLinkID
will have their order quantity amended down by the execution quantity. - OUOP: One Updates the Other Proportional. Send a
contingencyType
ofOneUpdatesTheOtherProportional
on the orders. Then as one order has a execution, other orders with the sameclOrdLinkID
will 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
. AdisplayQty
of0
is 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
execInst
ofParticipateDoNotInitiate
. 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 toGoodTillCancel
forLimit
andStopLimit
orders. - Simple Quantities: Send a
simpleOrderQty
instead of anorderQty
to 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
/pushSymbol
have 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 asymbol
andleverage
integer. 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
XBT24H
position 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 / 50
or0.04 XBT
to the position. The other0.96 XBT
in the user’s account is no longer at risk. - The user decides to switch to
1x
isolated 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 XBT
of value, and only0.02 XBT
remains assigned, for an effective leverage of100x
. The user then decides to switch to10x
leverage. The system then assigns2 XBT / 10
or0.20 XBT
to the position. The user has0.78 XBT
of unassigned margin left.
- UDF/TradeBin: Indices (
.XBT
,.BVOL
, etc) are now supported via the UDF (TradingView) and/api/v1/tradeBin
routes. 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