📈Price Indices
Oracle Price
Perpl uses the Oracle Price (Chainlink Spot Oracle) in multiple ways:
To ensure that the funding price, a spot index value, is reasonable and within tolerance.
To create a synthetic perp price using the BitMex method at every oracle update. This is used to compute unrealized P&L for positions and collateralization of increasing P&L when a position is increased or inverted. It is also used to reject the new position if it is under MMR.
To ensure that the mark price that is set by the protocol is within a tolerance of the synthetic perp price.
Synthetic perp price will be computed in the smart contract as follows:
CFundingRate is the value of the last funding rate.
CBlocksUntilNextFunding is the number of blocks until the next funding rate event.
CBlocksPerFundingInterval is the number of blocks between funding events.
Mark Price
Mark price is an unbiased and robust estimate of the fair perp price, and is used for margining, liquidations, triggering TP/SL, and computing unrealized PnL. It's computed off-chain from a mix of inputs and updated periodically OR during significant periods of change.
The mark price is computed periodically as follows:
Where:
PSyntheticPerp1 is an approximation of the perpetual price obtained by adding a decaying amount of the funding rate to the spot oracle price. This is appropriate because the funding rate is a long-term measure of the difference between prices on the perpetual and spot markets over a defined interval. It decays because the further from the measurement, the less valid the correction becomes. This strategy is employed by both BitMex and Binance.
PBook is a median of a sample of the current order book statistics:
PMinAsk is the minimum ask price of valid (non-expired) orders on the perpetual.
PMaxBid is the maximum bid price of valid (non-expired) orders on the perpetual.
PMinAsk is the last price of a trade on the perpetual.
PSyntheticPerp2 is another approximation of the perpetual price obtained by taking a moving average of the difference between the spot oracle price and a sum of the minimum ask and maximum bid prices, averaged over 30 samples, later adding it to the current oracle price. This algorithm is employed by Binance.
is a 30-sample Moving Average.
Last updated