Bitmex | How Place Orders

The Bitmex REST API offer public and private endpoints. The Private endpoints requires that messages signed to increase the security of transactions.

First you must login to your Bitmex account and create a new API, you will get the following values:

 

 

These fields must be configured in the Bitmex property of the Bitmex API client component. Once configured, you can start to do private requests to the Bitmex REST API.

 

Order Types

All orders require a symbol. All other fields are optional except when otherwise specified.

These are the valid ordTypes:

 

Execution Instructions

The following execInsts are supported. If using multiple, separate with a comma (e.g. LastPrice,Close).

 

Pegged Orders

Pegged orders allow users to submit a limit price relative to the current market price. The limit price is set once when the order is submitted and does not change with the reference price. This order type is not intended for speculating on the far touch moving away after submission - we consider such behaviour abusive and monitor for it.

 

Pegged orders have an ordType of Pegged, and an execInst of Fixed.

 

A pegPriceType and pegOffsetValue must also be submitted:

Trailing Stop Pegged Orders

Use pegPriceType of TrailingStopPeg to create Trailing Stops.

 

The price is set at submission and updates once per second if the underlying price (last/mark/index) has moved by more than 0.1%. stopPx then moves as the market moves away from the peg, and freezes as the market moves toward it.

 

Use pegOffsetValue to set the stopPx of your order. The peg is set to the triggering price specified in the execInst (default MarkPrice). Use a negative offset for stop-sell and buy-if-touched orders.

 

Requires ordType: Stop, StopLimit, MarketIfTouched, LimitIfTouched.

Trailing Stops

You may use pegPriceType of 'TrailingStopPeg' to create Trailing Stops. The pegged stopPx will move as the market moves away from the peg, and freeze as the market moves toward it.

 

To use, combine with pegOffsetValue to set the stopPx of your order. The peg is set to the triggering price specified in the execInst (default 'MarkPrice'). Use a negative offset for stop-sell and buy-if-touched orders.

 

Requires ordType: 'Stop', 'StopLimit', 'MarketIfTouched', 'LimitIfTouched'.

Tracking Your Orders

If you want to keep track of order IDs yourself, set a unique clOrdID per order. This clOrdID will come back as a property on the order and any related executions (including on the WebSocket), and can be used to get or cancel the order. Max length is 36 characters.

 

Examples:


// buy market order
BITMEX.REST_API.PlaceMarketOrder(bmosBuy, 'XBTUSD', 100);
// sell limit order at 45000
BITMEX.REST_API.PlaceLimitOrder(bmosSell, 'XBTUSD', 100, 45000.00);
// stop order at 48000
BITMEX.REST_API.PlaceStopOrder(bmosSell, 'XBTUSD', 100, 48000.00);