Trade Flow & Busts
Paradex is a hybrid trading system with off-chain (cloud) and on-chain components. The matching engine runs on the cloud. The users interact with it by submitting orders. The cloud assesses if the order causes the account to exceed risk limits (account value must not be below initial margin requirement) in which case cloud rejects the order. This check relies on the composition of the portfolio (collateral + positions + orders) as well as market data (e.g. external oracle price, funding data etc).
Once the order crosses against a matching order in the cloud order book, a fill is sent to the chain. The off-chain account balances are updated and the user can proceed with trading which gives a high-performance exchange experience.
The chain independently checks the new account composition and can reject the trade when the account would violate the initial margin requirement if the trade had happened. Although the cloud risk assessment is usually more conservative than on-chain, the independent on-chain risk check can result in a rejection of the trade.
If this happens, the account off-chain data data is rectified to revert the impact of the invalid trade.
A significant amount of our focus is currently directed towards minimizing the occurrence of trade busts in order to make this kind of risk significantly low.