Overview
BULK implements Self-Trade Prevention (STP) in the matching engine. When an incoming aggressive order reaches a resting order from the same account, the resting order is skipped and the aggressor continues searching for eligible external liquidity.How It Works
- An aggressive order enters the book and begins matching
- Before each potential fill, the engine checks if the incoming order’s owner matches the resting order’s owner
- If they are the same account, the engine bypasses that resting order and leaves it unchanged on the book
- The aggressive order continues through the book and fills against eligible external liquidity within its price limit
partiallyFilled. If it finds no external liquidity, it finishes as cancelledSelfCrossing. Any unfilled remainder does not rest on the book after a self-cross is encountered.
Why This Matters
- No self-trade fees. You never pay fees for matching against yourself.
- Market maker friendly. Makers quoting on both sides of the book can submit aggressive orders without worrying about filling their own resting liquidity.
- No wash trading. Self-trades do not appear in the public trade feed.
- Sub-accounts are independent. STP applies per account. Orders from different sub-accounts under the same main account can trade against each other.