Margex
English
English
  • Margex
    • Ⓜ️What is Margex?
    • 📜Trading Conditions
      • 1️⃣Trading Pairs and Leverage
      • 2️⃣Trade Fees and Funding
      • 3️⃣Bonuses
      • 4️⃣Promo Codes
    • 🚀Register, Deposit, Start!
    • 🏆Special Events
  • Deposits and Withdrawals
    • ↘️Deposits
      • 1️⃣How to Deposit
      • 2️⃣Deposit Conditions
      • 3️⃣How to Buy Bitcoin With a Credit Card (Buy Crypto with a Bank Card)
    • ↗️Withdrawals
      • 1️⃣How to Withdraw
      • 2️⃣Withdrawal Conditions
    • 🖥️Wallet Interface
  • CONVERTER
    • ↕️How to Convert Crypto
    • 📊Fees and Conditions
    • 📄Conversion History
    • ❔Converter FAQ (Frequently Asked Questions)
  • Leverage Trading Guide
    • ⚖️Leverage and Margin Explained
      • 1️⃣Liquidation. Margex Anti-Liquidation Protection
      • 2️⃣Profit & Loss (PnL) and How It's Calculated
      • 3️⃣RoE and Trade Interface Layout
    • 🖥️Trade Interface
    • 🛒Orders and Positions
      • 1️⃣Order Types
      • 2️⃣Place and Manage Orders
      • 3️⃣Manage Open Positions
      • 4️⃣Cross Margin and Isolated Margin: Differences explained
  • Price Alerts
    • 🔔How to Set Up Price Alerts
  • Copy Trading
    • 👥Copy Trading Explained
    • 🧑‍🎓Followers
      • 1️⃣Choosing the Ideal Strategies: Tips & Key Indicators
      • 2️⃣Quickstart (Followers): How to Follow a Strategy
      • 3️⃣How to stop following a strategy
      • 4️⃣Follower's Portfolio
    • 👨‍🏫Traders
      • 1️⃣Quickstart (Traders): How to Create a Strategy
      • 2️⃣How to Manage Your Strategies
      • 3️⃣Strategy Settings
    • 📈ROE and Performance Indicators
    • 💸Rewards: Follower Tiers and Profit Share Distribution
  • Staking
    • Staking Explained
      • 1️⃣What is APY%? How is Income Calculated?
      • 2️⃣Advantages of Staking on Margex
      • 3️⃣Staking Pool Limits
    • How to Stake/Unstake
    • Staking Stats. Staking Yield Calculator
    • Boost Your Staking Yield
  • Market Making (MM)
    • Become a Market Maker
    • Market Maker Obligations
    • Trading Conditions for Market Makers
  • Account and Security
    • 🔑Understanding Safety and Account Security on Margex
    • 🔐Account Security
      • 1️⃣2FA
      • 2️⃣Reset Password
      • 3️⃣Account Activity Notifications
    • 💬Customer Support
  • Referral Program
    • 🤝Referral Program Explained
    • 🖥️Referral Page Interface
  • Terms
    • Terms of Service
    • Privacy Policy
    • Cookie Policy
    • Copy Trading Terms
    • Staking Terms
    • Affiliate Terms and Conditions
Powered by GitBook
On this page
  1. Leverage Trading Guide
  2. Leverage and Margin Explained

Profit & Loss (PnL) and How It's Calculated

Profit and Loss (PnL) indicator reflects the Profit or Loss of a deal. PnL is calculated in two different ways, depending on if a deal is still currently open or if it has already been closed.

PreviousLiquidation. Margex Anti-Liquidation ProtectionNextRoE and Trade Interface Layout

Last updated 1 month ago

The Profit and Loss (PnL) indicator reflects the Profit or Loss of a position. PnL is calculated in 2 different ways, depending on if a position is still currently Open or if it has already been Closed.

For open positions Realized PnL and Unrealized PnL are taken into account. The potential profit from the deal refers to the Unrealized PnL. Realized PNL in open positions equals already paid commissions (i.e. ).

  • PnL is not reflected in Open positions. It can be calculated by adding Realized PnL + Unrealized PnL.

  • Calculating Unrealized PnL of Open positions requires the use of AskPrice and BidPrice, while calculating Unrealized PnL of Closed positions requires the use of ClosePrice

Below are examples of calculation of PnL in Open Positions and in Closed Positions:

How to calculate PnL in OPEN positions

The general formulas for calculating PnL of OPEN positions:

PnL = Realized PnL + Unrealized PnL, where:

  • Realized PnL = -OpenOrderCommission - Funding, where

    • OpenOrderCommission = (MarginCol * Leverage) * Maker or Taker fee%

    • Funding = (MarginCol * Leverage) * FundingFeeRate%

  • Unrealized PnL (Long) = MarginCol * Leverage * (CurrentAsk - OpenPrice) / OpenPrice

  • Unrealized PnL (Short) = MarginCol * Leverage * (OpenPrice - CurrentBid) / OpenPrice

Note: CloseOrderCommision is NOT included in PnL until a position has been closed.

EXAMPLE:

Parameters of an OPEN position:

  • Direction: Long

  • Order Size: 0.1 BTC

  • Leverage: x100 (-> Margin = 0.001 BTC)

  • Open Order: Limit

  • Funding fee charged: 1 time

First, we must calculate the OpenOrderCommission and Funding:

  • OpenOrderCommission = (MarginCol * Leverage) * MakerFee% = (0.001 * 100) * 0.019% = 0.000019

  • Funding = (MarginCol * Leverage) * FundingFeeRate% = (0.001 * 100) * 0.12% = 0.00012

Next, must calculate Realized PnL and Unrealized PnL:

  • Realized PnL = -OpenOrderCommission - Funding = -0.000019 - 0.00012 = -0.000139

  • Unrealized PnL (Long) = MarginCol * Leverage * (AskPrice- OpenPrice)/OpenPrice = (0.001 * 100) * (11000 - 10000)/10000 = 0.01

Finally, the last step is calculating PnL. As seen above, the Realized PnL= -0.000139 and Unrealized PnL = 0.01;

  • PnL(Long) = Realized PnL + Unrealized PnL = -0.000139 + 0.01 = 0.009861

How to calculate PnL in CLOSED positions

The general formulas for calculating PnL of CLOSED positions:

PnL = Realized PnL + Unrealized PnL - CloseOrderCommission , where:

  • Unrealized PnL (Long) = MarginCol * Leverage * (ClosePrice- OpenPrice)/OpenPrice

  • Unrealized PnL (Short) = MarginCol * Leverage * (OpenPrice - ClosePrice)/OpenPrice

  • CloseOrderCommission = (MarginCol * Leverage) * TakerFee%

  • OpenOrderCommission = (MarginCol * Leverage) * Maker or Taker fee%

  • Funding = (MarginCol * Leverage) * FundingFeeRate%

EXAMPLE:

Parameters of a CLOSED position:

  • Direction: Long

  • Order Size: 0.1 BTC

  • Leverage: x100 (-> Margin = 0.001 BTC)

  • Open Order: Market

  • Close Order: Market

  • Funding fee charged: 1 time

Firstly, we must calculate the CloseOrderCommission:

  • CloseOrderCommission = (MarginCol * Leverage) * TakerFee = (0.001 * 100) * 0.06% = 0.00006

Secondly, we must calculate Realized PnL and Unrealized PnL:

  • Realized PnL = -OpenOrderCommission - Funding = -((MarginCol * Leverage) * TakerFee%) - ((MarginCol * Leverage) * FundingFeeRate%) = -((0.001 * 100) * 0.06%) - ((0.001 * 100) * 0.12%) = -(0.1 * 0.06% ) - (0.1 * 0.12%) = -0.00006 - 0.00012 = -0.00018

  • Unrealized PnL (Long) = MarginCol * Leverage * (ClosePrice - OpenPrice)/OpenPrice = 100 * 0.001 * (11000-10000)/10000 = 0.01

FInally, the last step is calculating PnL. As seen above, the Unrealized PnL = 0.01, Realized PnL = -0.00018, and CloseOrderCommission = 0.00006:

  • PnL = Realized PnL + Unrealized PnL - CloseOrderCommission = -0.00018 + 0.01 - 0.00006 = 0.00976

The PnL for open and closed positions is calculated automatically and reflected in the Open Positions and Position History sections of the page for your convenience.

⚖️
2️⃣
trade fees and funding
Trade