Margins & PNL Calculations
MEXC offers two kinds of contracts: USDT-M and COIN-M contracts. The USDT-M contract is quoted in USDT and settled in USDT while the COIN-M contract is quoted in USDT and settled in BTC. The principle of calculation is similar but there are some slight differences. Please note that during the calculation, trading fee and other complex components will not be taken into account. The aim is to explain how margin is calculated to users.
- Margins Explained
All MEXC perpetual contracts require a certain amount of margin to open a position.
Successful margin trading requires an understanding of the following concepts:
Starting Margin: This minimum margin required to open a position. Your starting margin is dependent on margin rate requirements.
Maintenance Margin: The minimum margin requirement for maintaining a position below which additional funds will have to be deposited or forced liquidation may occur.
Opening Cost: The total amount of funds required to open a position, including the initial margin for opening a position and transaction fees.
- Margin calculation
In perpetual contracts, the order cost is the margin required to open a position. The actual cost is determined by whether the order is executed by a maker or taker because varying fees apply.
COIN-M contract: Order cost (margin) = number of open positions * futures size / (leverage multiplier * avg. entry price)
USDT-M contract: Order cost (margin) = avg. entry price * number of open positions * futures size / leverage multiplier
Examples:
COIN-M Contracts
If a trader wants to purchase 100 BTC/USDT perpetual contracts at the price of 7,000USD with a leverage multiplier of 25, and the value of each contract is 100 USD, then the margin required = 100x100 / (7000x25 ) = 0.0571BTC.
USDT-M Contracts
If a trader wants to purchase 10,000 BTC/USDT perpetual contracts at the price of 7,000USDT with leverage multiplier of 25, and the value of each contract is 0.0001BTC, then the margin required = 10000x0.0001x7000/25 = 280 USDT.
- PNL Calculation
PNL calculation includes fee income or expenditure, funding fee income or expenditure, and PNL upon closing a position.
Fee
The expenditure of the taker = Position value * Taker fee
The expenditure of the maker = Position value * Maker fee
Funding fee
According to the negative or positive funding fee rate and the long or short position held, the trader will pay or receive funding fee.
Funding fee = funding fee rate * position value
Note: The position value is calculated from the fair price when the funding fee rate is settled.
Closing PNL:
USDT-M Contract
Long position = (exit price - avg. entry price) * number of holding positions * futures size
Short position = (avg. entry price - exit price) * number of holding positions * futures size
COIN-M Contract
Long position = (1/avg. entry price - 1/avg. exit price) * number of holding positions * futures size
Short position = (1/avg. exit price - 1/avg. entry price) * number of holding positions * futures size
Floating PNL
USDT-M Contract
Long position = (fair price - avg. entry price) * number of holding positions * futures size
Short position = (avg. entry price - fair price) * number of holding positions * futures size
COIN-M Contract
Long position = (1/avg. entry price - 1/fair price) * number of holding positions * futures size
Short position = (1/fair price - 1/avg. entry price) * number of holding positions * futures size
For example, a trader purchases 10,000 cont. long for BTC/USDT perpetual contract at the price of 7,000USDT as a taker. If the taker fee is 0.06%, the maker fee is 0.02%, the funding fee rate is -0.025%, and the current fair price is 7000USDT, then the trader shall pay a taker fee of:
7000*10000*0.0001*0.06% = 4.2USDT
and the trader pays a funding fee of:
7000*10000*0.0001*-0.025% = -1.75USDT
In this situation, the negative value means that the trader receives the funding fee instead.
When said trader closes 10,000 cont. BTC/USDT perpetual contract at 8,000USDT, then the closing PNL is:
(8000-7000) *10000*0.0001 = 1000 USDT
And the closing fee can be calculated as follows:
8000*10000*0.0001*0.02% = 1.6 USDT
Hence, the realized PNL of the trader = 1000+1.75-4.2-1.6 = 995.95 USDT