Search
⌃K

Orderbook & Matching Engine

The other element of building a performant exchange is the orderbook and matching engine. Building this in itself is an incredibly complex challenge. In true DeFi fashion, Zeta has composed with Serum to provide this core primitive. By doing so we can ensure that users can place and execute trades seamlessly.
Each unique market index that the user trades on is a separate serum market. This will require the creation of a serum open orders account. This is done atomically in the first order you place on that market. (This will have a one time cost per market index of ~0.024 SOL).
Markets are reused on expiration, so a user will at most pay once per market index.
Orderbook constraints
The serum orderbook has enough space allocated to store a maximum of 455 orders per side (bid and ask). It uses a FIFO mechanism (first in first out).
If more than 455 orders are placed, the worst order (lowest bid or highest ask) placed on the orderbook will be booted off, and the corresponding order is cancelled for the user.