Trades
Last updated
Last updated
The execution of trades involves many components of both the Variational protocol and the application.
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 .
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 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).
Trades are executed through the following flow:
User requests a from the by interacting with the Omni frontend.
The uses the Variational protocol's to provide the user with a quote.
If the user wishes to accept the quote from and open a position, they can select their sizing and limit and submit the trade.
The relays this information to the , which verifies the user's , 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 quote is not outside of the user's defined tolerance.
If all checks pass, the trade enters a sequential order queue on the .
Once the trade is first in the que, the Variational protocol's will check to see if the has enough margin in the user's settlement pool for the trade. If it does not, the will deposit funds into the settlement pool to act as margin for the trade.
Once both the user and have posted enough margin into the , the trade is considered cleared and open, and is tracked on the .
Now that the trade is open, the will periodically check to ensure the position has enough margin on both sides. If the user is liquidated, both the user and 's initial margin will be withdrawn from the settlement pool and returned to the treasury. If is liquidated, 's initial margin is added to the user's initial margin and the refills 's margin to continue covering its initial position.
Simultaneously, the will periodically calculate and track funding rates and payments associated with the position, which are managed inside the .
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 .