💲Position and Margin

Position and Margin

Market order and Filled Limit Order Result in a Position

  • Leverage: Position Value / Margin

  • Average Price:

    • Oyster AMM tracks the average price of a position and uses that to calculate realized P&L when closing the position.

    • The Average Price of a position stays the same after a partial close of the position.

  • Realized P&L = (Traded Price - Average Price) * Traded Size

  • Unrealized P&L = (Mark Price - Average Price) * Position Size, note that Position Size is signed in this equation.

  • Unrealized Funding, please refer to Funding section

  • Unrealized social loss, please refer to Liquidations section

  • Total Unrealized P&L = Unrealized P&L + Unrealized Funding + Unrealized social loss

Mark Price for Position

Mark Price determines the unrealized profit and loss and margin requirements of all positions in a pair. This price also determines the initial margin requirement to open a position. This is the price for position risk management.

Mark price is based on spot index price but also incorporates a daily interest component of the underlying trading pair. With the segregation of duty of trading and marking, the pricing mechanism in Oyster AMM shields all users from attacks, such as flash loans and price manipulation


  • Initial margin requirement = Position Value * Initial Margin Ratio. Used to determine the margin required to open new or increase current positions. Please refer to the Pair Specification section.

  • Maintenance margin requirement = Position Value * Maintenance Margin Ratio. Used to determine the margin required to avoid liquidation of the current position. Please refer to the Pair Specification section.

Open Position Margin Requirement

  • As trade price and mark price vary, a trade could result in unrealized profit or loss right after execution.

  • In the case of an unrealized profit, this unrealized profit can not be used to satisfy the initial margin requirement to open this position.

  • In the case of an unrealized loss, this unrealized loss needs to be covered by an additional margin to satisfy the initial margin requirement to open this position.

Increase Position

In addition to the requirements of opening a new position, if the margin for the existing position falls below its initial margin requirement, the additional margin is required to top up the existing position margin to its initial margin requirement.

Close Position

As long as the resulting position satisfies its maintenance margin requirement, closing an existing position requires no other margin.


Due to the margin requirement rules mentioned above for open positions, not all trades can open positions with maximum leverage allowed for the pair.

Margin Deposit and Withdraw

  • Position margin can be deposit at any time.

  • Unrealized profit cannot be withdrawn from the position margin but can be used to satisfy maintenance margin requirements.

  • Margin available for withdrawal = Max(0, total margin - unrealized profit - initial margin requirement)

  • Withdrawal of realized profit in a short period of time is throttled to a level set by the admins. Please refer to pair specification section. If a user's realized profit reaches the throttle and decides to withdraw in one go, a waiting time is imposed. The user could either contact admin or continue waiting. Once the waiting time is passed, the user's realized profit withdrawal counter is reset.

Open Interests

Total open interests are from two types of positions, the positions inside the Oyster AMM as liquidity inventory and the positions traders hold in their accounts.

Long open interests are from all traders long positions. Short open interests are from all traders short positions. They can differ as AMM liquidity is taking the other side of the net position.

Last updated