Skip to content

Fees & Spread (WIP)

Fees and spread are essential components of a perpetual trading platform to ensure the protocol stays healthy/liquid. Fees are taken from traders, charged on the total position size (collateral * leverage) and used to compensate liquidity providers for their loaned collateral. Spread is enforced on oracle prices to ensure the protocol does not get into unsafe scenarios. Since the protocol settles positions at a single execution price, it is very important to consider the oracle's sources and uncertainty in any individual price data.

Fee Types

  1. Open
  2. Close
  3. Borrowing

TIP

You can save on fees if you close the orders yourself instread of a liquidation bot doing it for you via TP or SL.

Opening Fees

Opening fees are charged upon opening any market position. Depending on the pair, the opening fee varies between 0.05% - 0.15% on the total position size (the fee is fixed for a single pair). It is taken before opening, so the trader's resulting position will reflect a slightly smaller size after accounting for the opening fee. Any limit order that is converted into a position will incur the opening fee at that point in time.

Closing Fees

Closing fees are charged upon closing any market position. Depending on the pair, the opening fee varies between 0.05% - 0.15% on the total position size (the fee is fixed for a single pair). It is taken before closing, so the trader's resulting PnL will reflect this.

Borrowing Fees

Borrowing fees serve to charge a trader for "borrowing" collateral from the liquidity vault. Trader's provide their own collateral, but as long as a position is open, they "borrow" from the vault as there is always a possibility of closing a position with a positive PnL, causing collateral to be withdrawn from the vault. Borrowing fee is the "interest" paid for this scenario. Borrowing fees are charged on any open market position and increase in amount as a function of time that the position is open. I.e. the longer a position is open, the higher the borrowing fee. Borrowing fees treat open trades of the dominant side as vault borrowers. The fee is determined by a pair's (or the group the pair is part of) net OI relative to the overall vault TVL, meaning pairs (or groups) with more lopsided OI will charge more than pairs with balanced OI.

Example Fee Breakdown

Long Market Take Profit TIA-USDC

... (similar to v1 docs)

Short Limit Stop Loss BTC-USDC

... (similar to v1 docs)

Spread Types

  1. Confidence Interval
  2. Dynamic Spread

Confidence Interval

A price oracle aggregates prices from multiple sources. In this process, the returned & aggregated price estimate has some uncertainty associated with it. To account for this uncertainty and ensure the protocol does not get into unsafe scenarios due to a single outlier price, a confidence interval is applied on top of the oracle price. The spread is applied on top of the aggregate price returned from the oracle and positions will settle on the boundary of the interval that protects the protocol from unusual price volatility.

For most pairs, Pyth generally returns a confidence interval / spread of around 0.05 - 0.15% deviation from the aggregate price. This means if the returned price of ETH is $3000 with a confidence range of 0.1%, and you are opening a position to go long on ETH, the position will open at $3000 + ($3000 * 0.001) = $3003.

Dynamic Spread

Dynamic Spread, is added on top of the confidence interval. It depends on the open interest of the pair, the position size of the trade being opened, and on the direction of the trade (long / short).

Dynamic Spread (%) = (Open interest long/short + New trade position size / 2) / 1% depth above/below.

Some pairs do not have a 1% depth set which means they do not charge a dynamic spread.

(Example below taken from v1 docs)

ETH/USD Example So using our above price example with a position size of 2,480 after fees, if the "1% depth above price" parameter for ETH/USD is 8m and there is 100,000 $HONEY of open long interest:

(100,000 + 2,480 / 2) / 8,000,000 = 0.0126% dynamic spread This percentage is then applied to the opening price including the confidence interval.

Final opening price = 3003 + (3003 * 0.000126) = 3003.57 So in this case if the aggregate spot price was $3000, the opening price would be $3003.378