Unlike stock markets, crypto markets are open 24×7 and trading should happen in a continuous manner. Ideally, an exchange should never go down and trading should never stop. But, there are still times when markets need to be disrupted.
Single Price Auction is a well-known method used by prominent exchanges to discover the opening price when markets resume. This post talks about the auction mechanism used by Delta Exchange.
At Delta, we take market disruption events very seriously. Our engineering team strives hard not to disrupt markets for running maintenance tasks or for deployments. Although, sometimes we do need to schedule a maintenance window where we need to disrupt markets.
Another major scenario where we need to disrupt the market is when we are unable to mark positions because the index price is not available. For example — the underlying index of the BTCUSD_Dec28 contract is a weighted average of last traded spot price on BitStamp and Coinbase. But it does happen sometimes that no trades are being printed on these exchanges either because they are themselves down for maintenance or because of infrequent trading. In such cases, the index price becomes stale and cannot be used to mark positions and we may have to disrupt futures market as well.
To enable a fair price discovery when the market comes up, we conduct a single price auction which helps determine a fair opening price for the future contract.
- Once trading on a contract is disrupted, it enters into cancel-only mode. Participants are given this time window to cancel any open orders they might have.
- After this, the market enters into disrupted state and no trading can happen. Liquidations or stop orders are not triggered during the disrupted state.
- Once everything has become stable (For example — the spot market has recovered and trading has resumed there), market enters into the auction state.
- The first phase of the auction is a post-only mode where participants can post limit orders but no matching happens. During this phase, it is possible that the best bid is higher than the best ask and the buy and sell side of order book overlaps with each other. The idea is to let people express their view on the price without entering into a trade. Assuming there are enough participants in the auction, this would ideally lead to fair price discovery.
- Once the price discovery has happened, the auction enters into matching state where the overlapping buy and sell orders are matched at a single price determined by the book overlap.
- Finally, market enters into a healthy state and trading continues as usual.
Single Price Methodology
Now, we explain the method used to determine the single price at which matching happens.
During the post-only mode, we define equilibrium price using the following algorithm
Indicative equilibrium price is the price at which maximum quantity can be matched.
If there is more than one price point at which the maximum matching can happen, then the price with the minimum Imbalance is chosen. Imbalance at any price is defined as the difference between the cumulative size of buy and sell side.
If the imbalance is also equal for the two price levels, the final tie-breaker is done by the last traded price. The price level closer to the last traded price is chosen.
When the auction finishes, the equilibrium price is used as the single price where overlapping buy and sell orders are matched.
A great explanation with more examples can be found in NSE Official docs here.
If you have any ideas or feedback on how to improve on this, do write to us on [email protected]
Originally published here on our Medium blog.