Suppose that the user's balance is debited before his order is sent to the matching engine. The debiting is done to ensure that the user has sufficient balance and that he is not submitting orders that he ultimately cannot afford.

For limit orders, the amount to be debited is trivial to estimate.

Debit(Limit buy) = price * qty (quote asset)
Debit(Limit sell) = qty (base asset)

For market sell orders, the amount to be debited is also trivially estimated:

Debit(Market sell) = qty (base asset)

How about market buy orders, however?

The price is not known before the order hits the book, so you cannot do

Debit(Market buy) = price * qty (quote asset)

You could do last price instead:

Debit(Market buy) = last price * qty (quote asset)

And then, once you know the actual price at execution, debit or credit an additional amount to make up the difference.

But what if last price < actual price ?

Then the user's balance will potentially become negative.

Of course you could require a buffer (e.g. 150% of the last price) to account for this but there is no guarantee that this buffer will be sufficient for preventing negative balance.

Am I missing something obvious here?

  • $\begingroup$ If you require 150% balance for a market order, the customer is going to go elsewhere. Besides, the price is not going to drop 50% in the fraction of a second it takes to execute the order. A requirement of 105% should be amply sufficient IMHO. $\endgroup$
    – Alex C
    Commented Aug 19, 2018 at 3:03
  • $\begingroup$ True. The 150% was just an example. Your suggestion of 105% seems reasonable. Do you know if this kind of buffer requirement is standard practice for market buy orders? $\endgroup$
    – Soggiorno
    Commented Aug 19, 2018 at 3:20


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.