Market vs. Limit Orders

Sending a Quote

When a trader wants to make a trade using SYMMIO, he calls sendQuoteWithAffiliate(). The trader must include a price, regardless of whether they want to create a Market Order or a Limit Order.

function sendQuoteWithAffiliate(
    address[] memory partyBsWhiteList,
    uint256 symbolId,
    PositionType positionType,
    OrderType orderType,
    uint256 price,
    uint256 quantity,
    uint256 cva,
    uint256 lf,
    uint256 partyAmm,
    uint256 partyBmm,
    uint256 maxFundingRate,
    uint256 deadline,
    address affiliate,
    SingleUpnlAndPriceSig memory upnlSig
) external returns (uint256);

Limit Orders

Limit orders can be partially filled. The price passed is the exact price the trader wants to enter a position at, and the trading fee is calculated as a fraction of requestedOpenPrice * quantity.

Market orders

Market orders must be filled in one go. Because the trader wants to enter the position immediately, the quote price is sent with some slippage, guaranteeing his entry. The frontend will handle the slippage calculation after the user sets his tolerance, which involves taking the oracle price from Muon and shifting it slightly depending on the position type (long or short). The shift accounts for the solver’s spread as well as any fluctuations in market price For market orders the trading fee is calculated as a fraction of the oracle price * quantity.

When the counterparty accepts the quote, he must open the quote at an equal or better price than was first requested by the trader. For longs, this is a price below or equal to the requestedOpenPrice, and for shorts this is above or equal to the requested open price.

Closing a Quote

Similar to opening a quote, a market order must be fully closed, whereas a limit order can be partially closed. The same logic for market orders applies for closes: The user will set his slippage, and the frontend will calculate the appropriate closePrice. Here the logic is inverted, for long positions the closePrice is decreased; for shorts it’s increased.

The trader can initiate a force close if the counterparty is unresponsive, and a sufficient cooldown period has passed. Force closes can only be performed on Limit orders.

Last updated