CLOB Mechanism Details
Bid/Ask Spread and Order Book Integration: The hybrid model’s pricing means the best bid/ask on the order book and AMM should align. To ensure fairness, the AMM’s quote price is set to match the top-of-book price if the book has depth, or to closely follow the index price plus/minus half the spread if the book is empty. If a large market order eats all order book asks, the next available liquidity is the AMM which will start at a price slightly worse than the last filled order book price. This continuity prevents sudden jumps.
On-Chain Limit Order Fill Equation: When matching against limit orders, slippage is simply determined by the resting order distribution:
Suppose the order book has orders such that at price level $p_k$ there is $\delta q_k$ quantity. For a buy market order of size $Q$, the execution price is $P_{avg} = \frac{1}{Q}\sum_k p_k \min(Q_{\text{remaining}}, \delta q_k)$ summing until $Q$ is filled. The structure of the book (which often can be modeled as having more depth further from mid) determines slippage. Unlike AMM, order book liquidity is not a continuous function but a step function at each order.
Our hybrid model effectively combines the above: part of the sum might be discrete fills from the book, and the last part an integral from the AMM curve.
Last updated
Was this helpful?

