Main Flow (0.8.4)

This section describes the sequential steps required for initiating and managing trading operations in the 0.8.4 codebase. It covers the process from depositing collateral to opening and closing positions.


Deposit

To begin sending and accepting INTENTs, users must first deposit collateral into the Symmio contracts. This collateral is the foundation for all subsequent trading actions.


Allocate

After depositing collateral, funds are not immediately tradable. Users must allocate the deposited collateral to a subaccount.

  • Purpose of Subaccounts: Subaccounts isolate trading instances, ensuring that all PartyA and PartyB interactions remain economically sound. All collateral within a subaccount is cross-collateralized across any open positions.

  • Isolated Positions: To create an isolated position, a separate subaccount must be established. This mechanism also paves the way for future enhancements—such as allocating collateral to specific contract instances with custom code developed by PartyA or PartyB.


Send Quote (Send INTENT)

To initiate a trade, the user sends a quote (or INTENT) by specifying trade criteria such as the symbol and price. This is achieved by calling the sendQuote function.

Note: Sending a quote is the first step in the trading process and signals the start of a potential position.


Party B Sees the Position Request

Once the quote is sent, PartyB receives the position request and can choose to respond as follows:

  1. Lock the Quote: PartyB calls lockQuote to reserve the quote. This prevents other PartyB users from accepting the same quote until it is unlocked.

  2. Open the Position: After reserving the quote, PartyB finalizes the trade by invoking the openPosition function.

Training Wheel Feature: Reserving quotes simplifies the response process for MarketMakers. It allows them to reserve a quote, perform necessary hedging operations, and then fulfill the quote. This feature may be subject to removal in future versions.


Cancel Quote

Users can cancel their quote (INTENT) before the position is fully opened:

  • Immediate Cancellation: If the quote is not locked (reserved), it is canceled immediately.

  • Conditional Cancellation: If the quote is locked but not yet fully opened, cancellation depends on the fill status:

    • Partially Filled: The unfilled portion is canceled, while any partially filled amount remains active.


Open Position

Provided that the quote has been successfully locked (reserved) and no issues have arisen, PartyB completes the process by calling openPosition to open the position.


Close Request

PartyA (the user) can request to close an open position at any time by calling requestToClosePosition.

Important: Only PartyA is authorized to request the closure of a position. PartyB does not have this capability unless the PartyA explicitly authorizes.


Cancel Close Request

If the user wishes to cancel a close request—either before it is completely filled or to modify a limit order—the process is as follows:

  • Unfilled Request: The close request is canceled immediately, reverting the position status from “close pending” back to a regular active position.

  • Partially Filled Request: The portion of the position that has been filled remains closed. The unfilled portion is re-opened and added back to the existing position.

Last updated