🖥️ Trading Interface FAQ

Learn more about the features and functions found on the Perpetual Protocol trading platform. Join our Discord for more discussion! https://discord.gg/mYKKRTn

Why do I see an 'insufficient balance' error?

Be sure to deposit funds to make them available for trading.

Further explanation

Perpetual Protocol uses the xDai network for scaling. This means you must 'deposit' funds from your regular Ethereum wallet (eg. Metamask) to the xDai network. This process is performed entirely within your existing wallet without additional setup. Funds remain in your wallet and under your control at all times.

Why do the funding payments seem to be paid to the wrong side?

Funding payments follow the convention used on other exchanges like FTX and Binance: A negative number in your Position History indicates you received a funding payment, while a positive number in your Position History indicates you payed a funding payment.

The logic is that you make a payment; a positive payment means you end with less money; a negative payment means you end with more money.

How is the Index Price calculated?

The index price (also called 'Oracle price') generally refers to the price of the underlying asset on the spot market. Perpetual Protocol bases the index price on price feeds from Chainlink.

To mitigate frontrunning, we use the 1-hour TWAP (time weighted average price). This may result in the index price shown differing somewhat from the price you see on other major exchanges, especially when the market is volatile.

The price shown in the Perpetual Protocol trading interface is updated when a new price is received from Chainlink. Note, however, that the index price is only used when calculating hourly funding payments.

Timing of updates to the index price is determined by updates in the Chainlink price feed -- a surprisingly complex topic. Deep dive here. Keep in mind that Perpetual Protocol uses the 1-hour TWAP.

How is the Mark Price calculated?

The mark price (also called 'last price') is the current trading price for perpetual contracts of the asset you at viewing, and is the price you can expect to pay/receive when opening or closing a position, respectively (subject to slippage).

It is normal for this price to diverge, sometimes dramatically, from the index price (the open market price referenced by Perpetual Protocol, aka spot price). The mark price is a general indicator of trading sentiment on Perpetual Protocol.

How is the margin ratio calculated?

Margin ratio is calculated by adding your margin size and PnL for a given position, and then dividing by the position notional (position size multiplied by mark price).

marginRatio=(margin+unrealizedPnL)positionNotionalmargin Ratio = \frac{(margin + unrealizedPnL^*)}{positionNotional}

*PnL is calculated using one of two methods, causing the margin ratio to also have two potential values. Learn more here or see the next FAQ on PnL calculation.

Oracle Based Calculation During Severe Market Conditions

In order to combat flash crash risk, if the mark price diverges more than 10% from the index price (oracle price), margin ratio will be calculated using the oracle price.

This measure will greatly reduce the risk of liquidation during a flash crash where the price on Perpetual Protocol diverges severely from spot prices.

How is PnL calculated?

PnL or P&L (profit and loss) shows how much value your position has lost or gained. Until you close your position, these are unrealized profits or losses.

PnL is calculated using the following formula:

PnL=(currentPrice1entryPrice)positionSizePnL = (current Price^1 - entry Price) * position Size
  1. currentPrice will be the greater of two values: 1. current market price as calculated by the vAMM, or 2. the 15 minute TWAP of the market price. This is done to prevent an attacker from manipulating the price on the exchange and triggering liquidations.

Important Your PnL may be significantly affected by slippage if your position size is large. currentPrice above is the 'exit price' - the price you will receive when exiting your position.

What happens when I open a second position?

If you open a second position for a given asset, the new position will be combined with your existing (active) position. E.g. if you have a 1 ETH long position and open a 0.5 ETH short position, your active position will be updated to a 0.5 ETH long position. (Note that your margin will not change—instead, your leverage will be updated. You will need to use Margin Management to reduce or add to your margin).

Note that if you open a 100 ETH long and then a 100 ETH short, you will be left with a dust position due to rounding. Therefore it is best to simply close the position rather than taking an equal, opposite position.

If you want to open multiple positions for the same trading pair, we suggest creating a new account in Metamask, and connecting with this account to the trading platform.

How can I control slippage?

You can set a maximum slippage tolerance on the left side of the trading interface. The slippage tolerance applies when opening or closing a position.

The default is 0.5%, or you can also set your own tolerance. Setting slippage tolerance is especially useful in volatile or high volume market conditions on the Perpetual Protocol exchange, when large numbers/sizes of concurrent trades may result in significant slippage.

What is slippage vs price impact?

Both slippage and price impact are changes in price due to trades happening. Price impact is a predicted change in price; increasing price for longs, and decreasing price for shorts. Size of the price impact depends on the size of the trade.

Slippage is an unexpected change in the price which happens between the time a trader places an order and the time the order is filled. For example, if you place a trade at $10 but by the time the trade executes the price has moved to $11, you may no longer wish to place the order. This is where slippage control becomes essential.

Transaction price impact

How is price impact calculated?

Price impact is calculated using the same x*y=k formula used by Uniswap and many other AMM based exchanges. The price is based on the ratio of x to y. So if you buy x, you receive an amount of y, and in doing so the ratio (and therefore the price) of x and y changes. The more you buy, the greater this change will be. This is price impact.

Calculating price impact is a technical process. First, the formula:

priceImpact=(entryPricespotPrice)1priceImpact = ({entryPrice \over spotPrice}) - 1

where

entryPrice=openNotionalpositionSizeentryPrice = {openNotional \over positionSize}

and

spotPrice=quoteAssetReservebaseAssetReservespotPrice = {quoteAssetReserve \over baseAssetReserve}

openNotional and positionSize are the value of the position you want to open in quote asset (USDC), and the size of the position in base asset, respectively (both are after leverage).

quoteAssetReserve and baseAssetReserve are the x and y in the AMM formula. These values can be obtained for each vAMM on Perpetual Protocol using the perp-cli tool.

Example

The command perp amm BTC will give you the values needed to calculate the price impact for BTC.