Trades

The execution of trades involves many components of both the Variational protocol and the Omni application.

Quotes

Variational uses a request-for-quote (RFQ) system: users announce their intention to open a trade, and have the option to accept or reject any subsequently provided quotes. Within Omni, quotes are always provided by the Omni Liquidity Provider (OLP). The OLP determines the price to quote users at by aggregating data from the Variational protocol's pricing oracle.

Slippage

Within Variational, slippage refers to the difference in price between the last provided quote and the quote at the time when the trade is submitted. In highly-volatile markets, quoted prices can change significantly in a matter of seconds. Setting a slippage limit ensures that users don't accept a quote that is significantly worse than the last price displayed in the UI.

Settlement Pools

Settlement pools are smart contracts created and maintained by the Variational protocol that hold margin for both parties involved in a peer-to-peer trade. Within the Omni platform, settlement pools always contain margin from the user (taker) and the OLP (maker).

Flow of a Trade

Trades are executed through the following flow:

  1. User requests a quote from the Omni Liquidity Provider (OLP) by interacting with the Omni frontend.

  2. The OLP uses the Variational protocol's pricing oracle to provide the user with a quote.

  3. If the user wishes to accept the quote from OLP and open a position, they can select their sizing and slippage limit and submit the trade.

  4. The Omni frontend relays this information to the Omni backend, which verifies the user's authentication token, performs a variety of risk checks, ensures that the user has enough free collateral in their account for the trade, and ensures that the updated OLP quote is not outside of the user's defined slippage tolerance.

  5. If all checks pass, the trade enters a sequential order queue on the Omni backend.

  6. Once the trade is first in the que, the Variational protocol's margin & liquidation engine will check to see if the OLP has enough margin in the user's settlement pool for the trade. If it does not, the treasury manager will deposit OLP funds into the settlement pool to act as margin for the trade.

  7. Once both the user and OLP have posted enough margin into the settlement pool, the trade is considered cleared and open, and is tracked on the Omni backend.

  8. Now that the trade is open, the margin & liquidation engine will periodically check to ensure the position has enough margin on both sides. If the user is liquidated, both the user and OLP's initial margin will be withdrawn from the settlement pool and returned to the OLP treasury. If OLP is liquidated, OLP's initial margin is added to the user's initial margin and the treasury manager refills OLP's margin to continue covering its initial position.

  9. Simultaneously, the settlement & funding rate engine will periodically calculate and track funding rates and payments associated with the position, which are managed inside the settlement pool.

The process of closing a trade is identical to the process of opening a trade in the opposite direction, with the exception of some risk checks that are skipped by the Omni backend.

Last updated