For the complete documentation index, see llms.txt. This page is also available as Markdown.

Closing a Quote

Closing a quote is how PartyA exits an open position. You send a close request specifying which portion of the position to close, at what price, and by when. As with sending a quote, you encode the requestToClosePosition call with the Symmio Core ABI and forward it through the AccountLayer's _call. For a wallet-free close signed by a session key, use the Instant Layer flow instead.

Function signature

function requestToClosePosition(
    uint256 quoteId,
    uint256 closePrice,
    uint256 quantityToClose,
    OrderType orderType,
    uint256 deadline
) external;

Parameter breakdown

quoteId

The unique identifier of the quote you want to close.

closePrice

For a LIMIT order, this is the exact price (in 18 decimals) at which you want to close the position.

For a MARKET order, the executed price includes the spread the solver charges, so you send a price adjusted from the current market price by a slippage buffer (e.g. 5%) to make sure the close is accepted. Adjust in the direction that guarantees the fill:

  • Closing a LONG (a sell): decrease the market price by your slippage percentage.

  • Closing a SHORT (a buy): increase the market price by your slippage percentage.

The adjustment accounts for the hedger's spread and helps ensure your close request is accepted.

quantityToClose

The amount of the position (in 18-decimal format) you want to close.

orderType

An enum value for the closing order type:

  • 0 for LIMIT orders

  • 1 for MARKET orders

deadline

A Unix timestamp by which the close request must be executed. If no action is taken by then, the request expires.

Parameter encoding

Encode the parameters for requestToClosePosition() with the Symmio Core ABI, then pass the calldata to the AccountLayer's _call() for the SubAccount that owns the position. On a non-CUSTOM SubAccount the AccountLayer routes the close to the VirtualAccount holding that quoteId; on a CUSTOM SubAccount it executes directly.

Last updated