Trading
Placing Orders
Aftermath Perpetuals markets are order book-based markets and they allow users to place the following types of orders:
Market orders: the user chooses the amount to trade and his order is completely filled at the best prices the orderbook is offering.
Limit Orders: the user chooses the amount to trade and the price to trade at. Based on the type of limit order, different behaviors are possible:
Standard: the amount is filled until the chosen price. The unfilled amount is placed as a pending order on the orderbook.
Fill Or Kill: the order needs to be completely filled until the price, otherwise the transaction aborts.
Post Only: the order needs to be completely placed on the orderbook at the chosen price, with no fills, otherwise the transaction aborts.
Immediate Or Cancel: the order is filled until the chosen price, the unfilled amount is canceled and returned to the account.
Cancel Order: the pending order is removed from the order book.
Stop Market Order: Coming soon
Stop Limit Order: Coming soon
Trading Session
Thanks to Sui's Programmable Transactions Blocks (PTBs) and hot potato pattern, Aftermath Perpetuals allows traders to atomically perform multi-step operations while ensuring that safety mechanisms are always correctly triggered, saving gas and time for the user. A session can be composed by:
One liquidation, which is required to be the first operation in the session, if present.
One or more optional place limit and market orders. For example, a user can place orders in a range of prices, can market sell a liquidated position (immediately after acquiring it in the previous step) or can simply place a single order.
At the end of the session, the protocol will check that the position ended at (or above) IMR, or that the position improved its margin ratio. In case of a fail, the whole session is aborted. Notice that cancelling an order is not included in the session, due to the fact that it doesn't require to check the position's margin ratio and thus can be easily performed at any moment before or after a session.
Sessions are designed with two main goals:
Flexibility: any number of market and/or limit orders, in any order, is allowed
Safety: the market state can only change in predictable ways during a session (liquidation, market/limit orders) and the position state is safegarded by checks at the end.
Gas efficiency: expensive margin checks and order settlement are only performed once at the end of the session.
Last updated