EP 6.4 PancakeSwap Perpetuals V2 Fee Structure: A Comprehensive Overview

Product

Academy

2023-06-22

Dear PancakeSwap Community,

We are thrilled to present the next installment in our academy series, focusing on the Perpetuals V2 fee structure! Trading on PancakeSwap Perpetuals V2 comes with a fee structure that encompasses various components. These fees play a crucial role in determining the overall cost of trading. In this blog post, we will delve deep into the fee structure of PancakeSwap Perpetuals V2 and provide detailed calculations for each fee component. Whether you're entering or exiting a position, executing orders, or facing liquidation, understanding these fees is essential for trading.

The fee structure on PancakeSwap Perpetuals v2 comprises of the following components:

- Opening Position Fee
- Closing Position Fee
- Execution Fee
- Liquidation Fee
- Funding Fee

Now, let's explore each fee component in detail and uncover how they affect your trading costs.

The opening position fee is charged when entering a position. The fee rate differs based on the asset type: cryptocurrencies or foreign exchange (FX). For cryptocurrency positions, the opening fee rate is 0.08%, while for FX positions, it is 0.02%.

To calculate the opening fee, you can use the following equation:

For instance, suppose you open a long position of 1 ETH/USD at a price of $1,500. The calculation would be as follows:

**Opening Fee = 1 * 1,500 * 0.08% = $1.20**

Hence, the opening fee for this trade amounts to $1.20.

The closing position fee is applied when exiting a position. Similar to the opening fee, the closing fee rate varies based on the asset type: cryptocurrencies or FX. For cryptocurrency positions, the closing fee rate is 0.08%, while for FX positions, it is 0.02%.

To calculate the closing fee, you can use the following equation:

For example, if you close a position of 1 ETH/USD at a price of $1,600, the calculation would be as follows:

**Closing Fee = 1 * 1,600 * 0.08% = $1.28**

Hence, the closing fee for this trade amounts to $1.28.

The execution fee ensures the smooth operation of the Keeper program and covers the costs associated with blockchain network usage. This fee is only charged when opening a position and is set at **$0.30 per order.**
**
The execution fee covers the following:**

- A user submits a request to open a position.
- A keeper requests the index price from Oracles.
- The keeper executes the position at the current index price.
- If the position cannot be executed within the allowed slippage, the request is canceled, and the funds are returned to the user.

The position keepers play a vital role in providing convenience, and the protocol can continue operating even without them.

The liquidation fee comes into play when a position is liquidated. It represents the remaining collateral after liquidation. The calculation of the liquidation fee involves several parameters, including the liquidation price distance.

To determine the liquidation price distance, you can use the following equation:

In this equation:

- Entry Price refers to the price at which the trader opens the position.
- Initial Margin represents the user's initial collateral used as margin.
- Liquidation Loss Rate indicates the forced liquidation loss rate, typically set at 90%.
- Cumulative Funding Fee denotes the accumulated funding fee.
- Leverage refers to the user's selected leverage multiple.

Let's consider an example: Suppose a user opens a long position of ETH/USD with 10x leverage. The entry price is $1,500, the initial margin is $100, the funding fee is $2, and the liquidation loss rate is 90%. The calculation would be as follows:

**Liquidation Price Distance = $1,500 * (100 * 90% + 2) / 100 / 10 = $138**

Consequently, the liquidation price can be calculated as follows:

Liquidation Price (Long) = Entry Price - Liquidation Price Distance

Liquidation Price (Short) = Entry Price + Liquidation Price Distance

**Liquidation Price = $1,500 - $138 = $1,362**

The funding fee aims to balance the Long-Short Open Interest ratio on the PancakeSwap Perpetuals v2 platform. Its purpose is to protect the ApolloX Liquidity Provider (ALP) pool from excessive risk exposure during transactions and minimize ALP holding risks. The funding fee affects the unrealized Profit and Loss (PnL) of a position, directly influencing the user's liquidation price.

The funding fee is computed based on the Base Interest Rate, which is determined by an adjustment factor (k) multiplied by the historical volatility (HV):

**Base Interest Rate = k * HV**

In this equation:

- k represents the adjustment factor, typically set at 1.25.
- HV denotes the historical volatility, calculated as the 2-Week Average Volatility multiplied by square root of 365.

The Base Interest Rate per block is then determined as follows:

**Base Interest Rate Per Block = Base Interest Rate / (365*28800)**

The Funding Fee Rate per block is calculated based on the Long-Short Open Interest ratio (OI) and the Base Interest Rate per block:

Here, the value of Floor is set to 0.00000197% per block for cryptocurrencies. The accumulated funding rate is incremented based on the number of blocks elapsed:

Finally, the funding fee paid by the trader is determined by multiplying the accumulated funding rate difference (between opening and closing) by the number of contracts and the mark price:

Understanding the fee structure on PancakeSwap Perpetuals v2 is vital for traders to assess the costs associated with their positions accurately. By comprehending the calculations behind each fee component, traders can make informed decisions and manage their trading strategies effectively.

We hope this blog post on the fee structure of PancakeSwap Perpetuals V2 has been illuminating! Stay tuned for our upcoming posts, where we will continue to share more insights and updates about Perpetuals V2.

Want to learn more in the meantime? Check out our V2 initial announcement **here**, our step-by-step guide **here**, and click **here** to start Perpetuals trading.

Stack’em,

The Chefs 🥞