Here are the details on how to calculate the position’s average entry price for different derivatives products.
Inverse Perpetual & Futures Contract
Inverse Perpetual & Futures contracts are quoted in USD and settled in cryptocurrency such as BTC. The average entry price is calculated as follows:
Formula
Average entry price = Total quantity of contracts / Total contract value
Total contract value= [(Quantity1/Price1) + (Quantity2/Price2) + (Quantity3/Price3)....]
Take BTCUSD as an example,
A trader bought 50 contracts of BTCUSD at $10,000 and another 50 contracts at $15,000.
Total contract value in BTC = (50/10,000) + (50/15,000) = 0.00833333
Average entry price = 100/0.00833333 = $12,000
USDT Perpetual contract
USDT perpetual contracts are quoted in USDT and settled in cryptocurrency such as USDT.
Formula
Average entry price = Total contract value/Total quantity of contracts
Total contract value= [(Quantity1 × Price1) + (Quantity2 × Price2) + (Quantity3 × Price3)....]
Take BTCUSDT as an example,
A trader bought 1 BTC contract at 10,000 USDT and another 2 BTC contracts at 13,000 USDT
Average entry price = (1×10,000+2×13,000) / (1+2)=12,000 USDT
USDC Perpetual Contract
The average entry price of the USDC perpetual contract is the weighted average price of your position during the current settlement cycle, which will be affected by the increases in position size. At the end of each settlement cycle, the Mark Price at the time of settlement will become the new average entry price.
Formula
Average Entry Price = Total Session Value/Total Trade Size
Total Session Value = [(Trade Price 1 × Trade Size 1) + (Trade Price 2 × Trade Size 2) …]
Take BTCUSDC as an example,
Trader A holds a long position of 0.5 BTC with an entry price $50,000. Trader A decides to increase the long position by opening another 0.8 BTC at an entry price of $51,000.
Total Session Value = (50,000 × 0.5) + (51,000 × 0.8) = 65,800 USDC
Average Entry Price = 65,800/(0.5 + 0.8) = $50,615.38
Notes:
For the response parameter on the USDC Contract V3 API, please refer to sessionAvgPrice for the average entry price of the USDC Perpetual Contract. Once the settlement timing is reached, the sessionAvgPrice (average entry price) will be updated to the Mark price at the time of settlement. You are advised to use the updated API endpoint here.