Private Liquidation System
Introduction
Synchronicity Exchange allows users to trade with leverage. In order to facilitate doing so safely, Synchronicity uses a state-of-the-art risk and liquidation engines to avoid incurring bad debt. The Liquidation Engine is run privately in a Trusted Execution Environment (TEE) on-chain such that no information about positions’ liquidation prices are revealed in any way to anyone other than the position holder, including Synchronicity, until after a liquidation occurs.
This document details Synchronicity’s perpetual futures risk and liquidation engines.
When Do Liquidations Occur?
The essential rule in designing a liquidation system is to liquidate accounts before they go bankrupt. An account is considered “bankrupt” when the margin posted in the account cannot cover the losses after a liquidation.
A user’s account is liquidated when the value of an account (Account Value) is less than the margin required to maintain its open positions (Maintenance Margin).
Account Value is calculated as the sum of the Initial Margin and Unrealized Profit and Loss (UPNL) across all positions in the account, based on the mark price oracle of the traded assets.
Maintenance Margin provides a buffer between an account’s value at the time of liquidation and the price at which the account would go bankrupt.
In short, liquidations trigger when Account Value < Maintenance Margin required.
How Exactly does Synchronicity Exchange’s Risk Engine Work?
Liquidation prices for isolated accounts can be computed at the time a position is opened. For cross and unified margin accounts, their liquidation prices need to be recalculated regularly because the account is dependent on more than one price at the same time. If mark prices that are inputs into an account’s liquidation price move by X% (where X is unique to individual assets) then Synchronicity’s risk engine re-checks if the account should be liquidated.
When an account’s Account Value drops below its Maintenance Margin, the positions in the account are sent to the Liquidator.
There are three steps in Synchronicity’s liquidation engine: the Liquidator, Insurance Fund and Auto Deleveraging System (ADL).
Liquidator
When a position is liquidated, Synchronicity’s liquidation engine first sends the position to the Liquidator. The Liquidator sends each position to the order book to be liquidated as a limit order where the limit price is set to the position’s bankruptcy price.
In the case of an isolated margin position, the bankruptcy price is the price at which the Account Value would fall below 0. In the case of a cross margin account, the Posted Margin is split among the positions in the account proportionally to the Maintenance Margin of each of its positions and then the bankruptcy price of each position is calculated as a function of its Posted Margin.
The Liquidator is processed as follows.
- The bankruptcy price for each position being liquidated is calculated.
- A liquidation-only order book is constructed with all of the orders in the Liquidator.
- A batch auction is run in each liquidation-only order book to clear offsetting liquidations.
- The remaining long (short) positions to be liquidated are closed in a batch auction against the bids (asks) in the normal order book.
- Each liquidation is charged a liquidation fee (paid to Synchronicity Exchange) and the remaining value left in the account after the liquidation is set aside to cover the losses from any bankrupt positions. The liquidation fee charged by Synchronicity Exchange is only paid if the excess value set aside to cover the losses from any bankrupt positions is able to do so. If not, the liquidation fees are also used to cover the losses from bankrupt positions.
- Any remaining orders to be liquidated that are not cleared in steps (2-4) are bankrupt. These orders are sent to the Bankruptcy System to prevent Synchronicity Exchange from accruing bad debt.
Bankruptcy System
The Bankruptcy System has two parts, the Insurance Fund and the Auto Deleveraging System.
Insurance Fund
Orders sent to the Bankruptcy System are first attempted to be liquidated in the remaining order book with losses subsidized by the Insurance Fund. The Insurance Fund is specific to the order book in which the position is being liquidated. If the Insurance Fund is unable to cover the losses from the position, the position is passed to the Auto-Deleveraging System (ADL).
The Insurance Fund portion of the Bankruptcy System works as follows.
- If the deficit of bankrupt positions, if cleared in the remaining order book, is less than the excess value from the other liquidations, the positions are cleared against the order book and the losses of the bankrupt positions are covered by the excess value from the other liquidations. If there is excess value left after covering deficits, it is transferred to the Insurance Fund. Liquidation fees are paid to Synchronicity Exchange.
- Else, if the value lost by the sum of bankrupt positions, if cleared in the remaining order book, is less than the excess value from the other liquidations PLUS the liquidation fees charged by Synchronicity Exchange, the positions are cleared against the order book and the losses of the bankrupt positions are covered by the excess value from the other liquidations and the liquidation fees. If there are any liquidation fees left after covering deficits, it is all transferred to the Insurance Fund.
- Else, if the value lost by the sum of bankrupt positions, if cleared in the remaining order book, is less than the excess value from the other liquidations PLUS the liquidation fees charged by Synchronicity Exchange PLUS the value in the Insurance Fund, the positions are cleared against the order book and the losses of the bankrupt positions are covered by the excess value from the other liquidations, the liquidation fees and the Insurance Fund.
- Else, the bankrupt positions are ranked in order of bankruptcy price and the maximum number of bankrupt positions are cleared in the remaining order book such that the losses in the bankrupt positions are covered by the excess value from the other liquidations, the liquidation fees and the insurance fund. All remaining bankrupt positions are sent to the ADL.
Auto Deleveraging System
The Auto Deleveraging System is the last resort to ensure no bad debt on Synchronicity Exchange. The positions sent to the ADL are closed against other open positions in that market.
During a liquidation via the ADL, Synchronicity Exchange creates an ADL queue where each position in an order book is assigned a Priority Index by profitability and effective leverage. The Priority Index ranking is a heuristic that attempts to identify and close the counterparty that has most profited from the position being liquidated in the ADL.
The ADL queue closes positions in order of their Priority Index against the position being liquidated at the liquidation’s bankruptcy price. This ensures the position will be liquidated without Synchronicity Exchange incurring bad debt, and the position closed against it by the ADL is closed at a fair price. Positions closed by the ADL against liquidated positions incur no trading fee.
Each position receives a Priority Index ranking as follows.
First, all positive positions are prioritized by the ratio of position UPNL to Account Collateral. Then, losing positions are prioritized by the ratio of UPNL to Realized Leverage. Positions with smaller losses are closed before those with larger losses, since heavily losing positions are highly unlikely to serve as counterparties to positions being liquidated. It is extremely rare that a healthy account’s negative position will ever be affected by the ADL.
Thus, Synchronicity’s Liquidation System is designed to protect the exchange from incurring bad debt while enabling users to trade with high degrees of leverage.