Price-Time Priority and Self-Trade Prevention in Limit Order Books
Summary
The answer explains how self-trade prevention can interact with price-time priority when an incoming limit order crosses a book containing the trader’s own resting orders. Its example says that a buy order first matches the best-priced eligible seller. If self-trade prevention is active, the engine may skip the trader’s own order at that price and continue to another order at the same price level. Any unmatched remainder may then expire or be cancelled, depending on exchange rules and order instructions.
The discussion also warns that an order may be rejected or prevented from executing if its matching path would skip a better-priced order, since regulated exchanges are expected to preserve price priority. It notes that behavior can differ with controls such as fill-or-kill or minimum fill sizes. This is a general explanation offered in response to an exchange-specific question, not verified documentation for a particular crypto venue; actual self-trade-prevention modes and order outcomes must be checked against the exchange’s rules.
Key ideas
- Price-time priority generally gives precedence to better-priced orders and then earlier orders at the same price.
- Self-trade prevention may cause an incoming order to bypass the trader’s own resting quantity.
- An unmatched remainder can expire or be cancelled under the venue’s order rules.
- Fill-or-kill and minimum-fill instructions can change order outcomes.
- The described behavior is general and may not match a specific crypto exchange’s implementation.
Tags
Full text
# How Crypto Exchanges handle overlapping orders when self trading is disabled? # How Crypto Exchanges handle overlapping orders when self trading is disabled? I am unsure how a typical "matching engine" handles overlapping orders (in my case, Deribit). I would be just as interested in how any crypto exchange handles the situation. The user has self-trading set to disabled (like most users). Given the following very simple orderbook... ``` SELL $504.... amount=20000.... owner=ALICE SELL $503.... amount=15000.... owner=BOB ------ BUY. $497.... amount=15000.... owner=BOB ``` If BOB sends through a new GTC limit order (not post)... ``` BUY... $505... amount=30000... owner=BOB ``` My understanding is if BOB had sent through an amount of 20000 or less, the order would execute entirely against ALICE and the status be set to "filled" without any errors (despite the order overlap and self-trading being set to disabled). But what happens to BOB's new overlapping order (with amount=30000)? (1) Rejected because BOB's order did not completely fill requested amount=30000 so an "order_overlap" error is returned and filled_amount=0. (2) Partially filled and status set to "cancelled" but with filled_amount=20000 (3) Partially filled and status set to "open" with filled_amount=20000 with price adjusted down (to 502.50 after executing at $504.00 against ALICE) ## Answer by Kulendra 'KJ' Janaka (score 1, accepted) https://quant.stackexchange.com/a/58193 Generally in a regulated exchange, you are not allowed to skip price points. In the case you have shown, BOB's new Buy order will skip the price point at 503 and execute at $504. Therefore the order will get cancelled/expired/rejected even if the time constraint of the order is not IOC/FAK. So in both scenarios you mentioned (whether the order quantity is 20,000 or 30,000), the regulated orders will not execute since they are skipping a price point. The important point to remember here is that the exchanges are supposed to provide a price-time order book. Take the following scenario: ``` SELL ALICE 10000 @ $503 at 17:00:00.000 UTC SELL BOB 5000 @ $503 at 17:00:00.010 UTC SELL DAVE 1000 @ $503 at 17:10:00.025 UTC SELL JANICE 1000 @ $504 at 16:58:00.000 UTC ``` In this, you can see while JANICE has sent the order earlier on, it is at the back of the queue because the price is worse. Now let's suppose BOB submits a new BUY order 11000 @ $503, this will first match 10000 with ALICE. If self-trade-prevention is on, then it will skip BOB's own order and will match with DAVE. Let's suppose the order size was 15000 instead. In a regulated exchange, it will match with ALICE and DAVE and the remaining 4000 will be expired. Do note that some exchanges provide additional controls over the order such as FOK (Fill the entire order, Or kill it. No partial fills), min fill sizes etc. So depending on that your experience may slightly vary.
Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.