Coin-margined Margin and PnL Calculations

# Coin-margined Margin and PnL Calculations

Understanding how margin and profit/loss (PnL) are calculated for coin-margined perpetual contracts is essential for effective trading and risk management. This guide explains the key calculations and concepts specific to coin-margined contracts.

# Fundamental Differences from USDT-margined Contracts

In coin-margined contracts:

  • The margin is denominated in the underlying cryptocurrency (e.g., BTC for BTC/USD contracts)
  • Profits and losses are calculated and settled in the underlying cryptocurrency
  • Contract prices are quoted in USD (inverse contracts), not in the cryptocurrency

These differences create unique dynamics in margin requirements and PnL calculations.

# Initial Margin Calculation

The initial margin is the amount of cryptocurrency required to open a position. It is calculated using:

Initial Margin = Contract Value × Number of Contracts / (Entry Price × Leverage)

Where:

  • Contract Value is the USD value per contract (e.g., $100 per BTC/USD contract)
  • Entry Price is the USD price of the cryptocurrency at entry
  • Leverage is the selected leverage ratio (e.g., 10x, 50x, 100x)

For example, to open a long position of 10 BTC/USD contracts at $50,000 with 10x leverage:

  • Initial Margin = ($100 × 10) / ($50,000 × 10) = $1,000 / $500,000 = 0.002 BTC

# Position Value Calculation

The position value in coin-margined contracts is calculated in USD terms:

Position Value (USD) = Contract Value × Number of Contracts

For example, 10 BTC/USD contracts with a contract value of $100 each equals a position value of $1,000.

# Maintenance Margin Calculation

The maintenance margin is the minimum amount required to keep a position open:

Maintenance Margin = Position Value × Maintenance Margin Rate / Mark Price

Where the maintenance margin rate varies based on the position size tier (refer to the Ladder Maintenance Margin Rate documentation).

# Margin Ratio Calculation

The margin ratio indicates how close a position is to liquidation:

Margin Ratio = (Position Margin + Unrealized PnL) / Position Value × 100%

When the margin ratio falls below the maintenance margin rate plus the closing fee rate, liquidation will be triggered.

# PnL Calculations for Coin-margined Contracts

# Unrealized PnL

For coin-margined contracts, unrealized PnL is calculated in the underlying cryptocurrency:

For Long Positions:

  • Unrealized PnL = Contract Value × Number of Contracts × (1/Entry Price - 1/Mark Price)

For Short Positions:

  • Unrealized PnL = Contract Value × Number of Contracts × (1/Mark Price - 1/Entry Price)

Example: If you go long 10 BTC/USD contracts (contract value = $100) at $50,000, and the mark price rises to $60,000:

  • Unrealized PnL = $100 × 10 × (1/$50,000 - 1/$60,000) = $1,000 × (0.00002 - 0.00001667) = $1,000 × 0.00000333 = 0.00000333 BTC

# Realized PnL

Realized PnL is calculated when a position is closed:

For Long Positions:

  • Realized PnL = Contract Value × Number of Contracts × (1/Entry Price - 1/Exit Price) - Fees

For Short Positions:

  • Realized PnL = Contract Value × Number of Contracts × (1/Exit Price - 1/Entry Price) - Fees

# Liquidation Price Calculation

The liquidation price is calculated differently for long and short positions:

For Long Positions:

  • Liquidation Price = Entry Price / (1 - (Initial Margin × Entry Price / Position Value - Maintenance Margin Rate))

For Short Positions:

  • Liquidation Price = Entry Price / (1 + (Initial Margin × Entry Price / Position Value - Maintenance Margin Rate))

# Impact of Price Changes on Margin Requirements

One of the unique aspects of coin-margined contracts is how margin requirements change with price movements:

# For Long Positions:

  • When prices rise, margin requirements decrease (in cryptocurrency terms)
  • When prices fall, margin requirements increase (in cryptocurrency terms)

# For Short Positions:

  • When prices rise, margin requirements increase (in cryptocurrency terms)
  • When prices fall, margin requirements decrease (in cryptocurrency terms)

This inverse relationship creates different risk dynamics compared to USDT-margined contracts.

# Examples with Different Market Scenarios

# Example 1: Long Position in Rising Market

Initial Conditions:

  • Contract: BTC/USD with $100 contract value
  • Position: Long 10 contracts
  • Entry Price: $50,000
  • Leverage: 10x
  • Initial Margin: 0.002 BTC

If the price rises to $60,000:

  • Unrealized PnL = $100 × 10 × (1/$50,000 - 1/$60,000) = 0.00000333 BTC
  • Margin Ratio = (0.002 + 0.00000333) / ($1,000/$60,000) = 0.00200333 / 0.01667 = 12.02%

# Example 2: Short Position in Falling Market

Initial Conditions:

  • Contract: BTC/USD with $100 contract value
  • Position: Short 10 contracts
  • Entry Price: $50,000
  • Leverage: 10x
  • Initial Margin: 0.002 BTC

If the price falls to $40,000:

  • Unrealized PnL = $100 × 10 × (1/$40,000 - 1/$50,000) = 0.00000500 BTC
  • Margin Ratio = (0.002 + 0.00000500) / ($1,000/$40,000) = 0.00200500 / 0.025 = 8.02%

# Important Considerations

  1. Inverse Relationship: Remember that PnL and margin requirements in coin-margined contracts behave inversely to price movements.

  2. Mark Price vs. Last Price: All calculations use the mark price, not the last traded price, to prevent market manipulation.

  3. Funding Rate Impact: Funding payments affect your realized PnL and are also denominated in the underlying cryptocurrency.

  4. Cross Margin vs. Isolated Margin: In cross margin mode, all available balance in your futures account can be used to prevent liquidation. In isolated margin mode, only the allocated margin for that specific position will be used.