Coinlocally Docs
Perpetual Contracts
Perpetual Contracts
  • Introduction
  • Overview
    • Funding Rate
    • Mark Price
    • Index Price
    • Ladder Balancing Mechanism
    • Insurance Fund
    • Auto-Deleveraging (ADL)
  • USDT Margined Perpetual Contract
    • Introduction
    • Leverage and Position Limit
    • Ladder Maintenance Margin Rate
    • Margin and Profit/Loss Calculations
  • Coin Margined Perpetual Contracts
    • Currency Standard Perpetual Contract
    • Leverage and Position Limit
    • Ladder Maintenance Margin Rate
    • Margin and Profit/Loss Calculations
  • Functions
    • Perpetual Contract User Guide
    • One-way and Two-way Positions
    • Conditional Order
    • Take Profit, Stop Loss TP/SL
    • Take Profit Stop Loss Order
    • Contract Grid
    • Futures Copy
      • How to Carry Out a Transaction
      • Profit Sharing
      • How to Copy Trade
      • Futures Copy Trading Rules
Powered by GitBook
On this page
  • 1. Open Position Margin
  • 2. Average Opening Price
  • 3. Profit and Loss Calculation
  • Important Notes
  1. Coin Margined Perpetual Contracts

Margin and Profit/Loss Calculations

1. Open Position Margin

The opening margin consists of:

  • Initial Margin

  • Opening Loss

Including opening loss in the margin calculation helps prevent immediate liquidation due to unfavorable price movements upon order placement.

1.1 Initial Margin

Initial Margin=Quantity×Contract SizeOrder Price×Leverage\text{Initial Margin} = \frac{\text{Quantity} \times \text{Contract Size}}{\text{Order Price} \times \text{Leverage}}Initial Margin=Order Price×LeverageQuantity×Contract Size​

1.2 Opening Loss

Opening Loss=Quantity×Contract Size×∣min⁡(0, Order Direction×(1Order Price−1Mark Price))∣\text{Opening Loss} = \text{Quantity} \times \text{Contract Size} \times \left| \min\left(0,\ \text{Order Direction} \times \left( \frac{1}{\text{Order Price}} - \frac{1}{\text{Mark Price}} \right) \right) \right|Opening Loss=Quantity×Contract Size×​min(0, Order Direction×(Order Price1​−Mark Price1​))​

Where:

  • Order Direction = 1 for long, -1 for short

Example

  • Contract Type: Coin-margined (e.g., BTC/USD)

  • Order Price: 60,000 USD

  • Mark Price: 55,000 USD

  • Quantity: 12,000 contracts

  • Contract Size: 10 USD

  • Leverage: 10×

Calculation:

Initial Margin:

12,000×1060,000×10=0.2 BTC\frac{12,000 \times 10}{60,000 \times 10} = 0.2\ \text{BTC}60,000×1012,000×10​=0.2 BTC

Opening Loss:

12,000×10×∣min⁡(0,1×(160,000−155,000))∣=0.181819 BTC12,000 \times 10 \times \left| \min\left(0, 1 \times \left( \frac{1}{60,000} - \frac{1}{55,000} \right) \right) \right| = 0.181819\ \text{BTC}12,000×10×​min(0,1×(60,0001​−55,0001​))​=0.181819 BTC

Opening Margin:

0.2+0.181819=0.381819 BTC0.2 + 0.181819 = 0.381819\ \text{BTC}0.2+0.181819=0.381819 BTC

2. Average Opening Price

When multiple entries are made into the same position, the average opening price is recalculated using a BTC-denominated formula:

Average Opening Price=Total ContractsTotal BTC Value\text{Average Opening Price} = \frac{\text{Total Contracts}}{\text{Total BTC Value}}Average Opening Price=Total BTC ValueTotal Contracts​

Example

  • Position 1: 1,000 contracts @ 5,000 USD

  • Position 2: 2,000 contracts @ 6,000 USD

Total Contracts=1,000+2,000=3,000\text{Total Contracts} = 1,000 + 2,000 = 3,000Total Contracts=1,000+2,000=3,000
Total BTC Value=(1,0005,000)+(2,0006,000)=0.2+0.333333=0.533333 BTC\text{Total BTC Value} = \left( \frac{1,000}{5,000} \right) + \left( \frac{2,000}{6,000} \right) = 0.2 + 0.333333 = 0.533333\ \text{BTC}Total BTC Value=(5,0001,000​)+(6,0002,000​)=0.2+0.333333=0.533333 BTC
Average Opening Price=3,0000.533333=5,625.00 USD\text{Average Opening Price} = \frac{3,000}{0.533333} = 5,625.00\ \text{USD}Average Opening Price=0.5333333,000​=5,625.00 USD

3. Profit and Loss Calculation

PnL is calculated based on the difference between inverse prices, since these are reverse (coin-margined) contracts. Profits and losses are settled in the base currency (e.g., BTC), not in USD.

3.1 For Long Positions

Unrealized PnL=Quantity×(1Average Open Price−1Mark Price)\text{Unrealized PnL} = \text{Quantity} \times \left( \frac{1}{\text{Average Open Price}} - \frac{1}{\text{Mark Price}} \right)Unrealized PnL=Quantity×(Average Open Price1​−Mark Price1​)

Example:

  • 1,000 contracts long

  • Average Price: 5,000

  • Mark Price: 5,500

=1,000×(15,000−15,500)=0.01819 BTC= 1,000 \times \left( \frac{1}{5,000} - \frac{1}{5,500} \right) = 0.01819\ \text{BTC}=1,000×(5,0001​−5,5001​)=0.01819 BTC

3.2 For Short Positions

Unrealized PnL=Quantity×(1Mark Price−1Average Open Price)\text{Unrealized PnL} = \text{Quantity} \times \left( \frac{1}{\text{Mark Price}} - \frac{1}{\text{Average Open Price}} \right)Unrealized PnL=Quantity×(Mark Price1​−Average Open Price1​)

Example:

  • 1,000 contracts short

  • Average Price: 5,000

  • Mark Price: 4,500

=1,000×(14,500−15,000)=0.02223 BTC= 1,000 \times \left( \frac{1}{4,500} - \frac{1}{5,000} \right) = 0.02223\ \text{BTC}=1,000×(4,5001​−5,0001​)=0.02223 BTC

Important Notes

  • Reverse contracts (coin-margined) are settled in the base currency (e.g., BTC).

  • USD values are used only for quotation purposes, not for settlement.

  • This structure ensures that traders earn and lose in the underlying asset they’re trading.

PreviousLadder Maintenance Margin RateNextFunctions

Last updated 1 month ago