Trading Scaled Orders on BitMEX

2020-07-10 5 mins read

What is a scaled order

A scaled order is comprised of multiple limit orders at different price points. With a scaled buy, orders at lower limits are triggered in sequence as the market price drops; a scaled sell works in reverse, with orders at higher limits getting filled in turn as the market price increases.

Buying more aggressively as the price falls or selling more as the price rises is also known as pyramiding.

Scaled orders help avoid the market impact of buying or selling a large number of securities in a single transaction. They can also be used to improve your average entry or exit price.

Strategy comparison

Suppose XBTUSD is trading at $10000. We’d like to build a long position with at most one million contracts as the price drops by 10% to 20%.

Strategy #1: Buy 1,000,000 contracts at $9000

This order will get triggered once the price passes through $9000. If it’s filled, the entry price will be $9000.

Strategy #1: Single order

Strategy #1: Single order

Strategy #2: Buy 1,000,000 contracts at $8000

The lower limit of $8000 makes this order less likely to get filled than the previous order. If it does get triggered, the entry price will be $8000.

Strategy #2: Single order

Strategy #2: Single order

Strategy #3: Scaled buy between $8000 and $9000

For simplicity’s sake, we create five equal-sized limit buys at $8000, $8250, $8500, $8750, and $9000 (200,000 contracts each). The average entry price will be no worse than strategy #1’s. It could be as low as $8485.28 (i.e. 1000000/(200000/8000 + 200000/8250 + 200000/8500 + 200000/8750 + 200000/9000) = 8485.28) if all five orders are filled. The order fill rate will be no worse than strategy #2’s; it’ll be strictly better if the price falls in the range between $8000 and $9000.

Strategy #3: Scaled order

Strategy #3: Scaled order

Order size considerations

BitMEX’s trading fees are proportional to the size of an order. For example, XBTUSD market makers receive a 0.025% rebate, and liquidity takers pay a 0.075% commission. As there’re no per-order fees, breaking up a large order into small chunks won’t affect your overall trading fees.

However, BitMEX imposes a cap of 200 limit orders on each instrument. BitMEX has also increased their spam order threshold from 0.0025 XBT to 0.01 XBT since June 5th, 2020, which means that accounts with too many open orders with a gross value under 0.01 XBT will be marked as a spam account and get temporarily penalized.

Keep these restrictions in mind when you’re trading scaled orders on BitMEX.

Order creation

It’s tedious and slow to place scaled orders on BitMEX’s website because you would have to manually enter the quantity and the limit price for each order.

Bitwise Terminal offers two highly efficient alternatives to create scaled orders:

GUI

Scaled order GUI

Scaled order GUI

In the “Place order” panel, choose the order type “Scaled”.

Set the total order size under “Quantity”. Enter a positive value for long or a negative one for short. You may use the k and m abbreviations for quantities.

Set a reasonable “Max order count” based on the price range and order size.

Fill out the “Upper price” and “Lower price” fields. Both absolute and relative price notations are accepted. Evenly spaced limit orders will be created within this price range.

Execution instructions (post-only, reduce-only, or hidden) are identical to the ones for regular limit orders.

The “Distribution” option controls the size of each limit order: “Flat” creates equal-sized orders; “Pyramid” allocates more quantities to orders with lower prices; “Inverted pyramid” assigns more at higher prices.

Inverted pyramid distribution

Inverted pyramid distribution

Flat distribution

Flat distribution

Pyramid distribution

Pyramid distribution

Command line

An even more efficient albeit less intuitive method to place a scaled order is to run the so command in Bitwise Terminal. Command syntax:

so <quantity> <max-order-count> <lower-price> <upper-price> [instructions] [distribution]

The first four arguments (“quantity”, “max-order-count”, “lower-price”, and “upper-price”) are mandatory and take the same kind of values as accepted by the GUI.

The last two arguments, “instructions” and “distribution”, are optional.

“Instructions” can be empty (default), p (post-only), h (hidden), r (reduce-only), or a combination of the options (e.g. pr, hr).

“Distribution” is either empty or a number between 0.1 and 10, which specifies the ratio of the order size at “upper-price” to the size at “lower-price”. Leave it empty or pass 1 to create a flat distribution with identical order sizes; pass a number between 0.1 and 1 to create a pyramid distribution; or pass a number between 1 and 10 to create an inverse pyramid distribution.

Quantity amendment

Once a scaled order is submitted, you may change the order quantities in bulk using the aq (amend quantity) command. Command syntax:

aq <amended-quantity> <order-filters>

“Amended-quantity” is either an absolute order size or a relative quantity change which starts with + or -. “Amended-quantity” can also be a percentage change if it ends with %. “Order-filters” is a space-delimited list of order IDs, ID prefixes, b (buy orders), s (sell orders), or a (all orders).

For example, aq -25% s will reduce each sell order’s size by a quarter.

Price amendment

You may change the limit prices in bulk using the ap (amend price) command. Command syntax:

ap <amended-price> <order-filters>

“Amended-price” is either an absolute price (not useful for scaled orders) or a relative price change which starts with + or -. “Amended-price” can also be a percentage change if it ends with %. “Order-filters” is a space-delimited list of order IDs, ID prefixes, b (buy orders), s (sell orders), or a (all orders).

For example, ap +10 b will shift each buy order’s limit price by 10.

Order cancellation

Batch order cancellation can be done from either the GUI or the command line.

(1) From the “Active orders” panel, you may select one or more orders and hit the “Cancel” button.

Cancel orders from the GUI

Cancel orders from the GUI

(2) From the “Command” panel, you may run ca (cancel all open orders), cb (cancel all buy orders, including stop buys), cs (cancel all sell orders, including stop sells), or co (cancel orders that match any of the order IDs or ID prefixes).