Tribe3 has implemented a proprietary oracle construct which utilizes mid-price of bids (best collection bid) and asks (lowest listed floor price) as the base data, with a dynamic TWAP period.
With the popularity of platforms such as Blur and OpenSea Pro, bid-ask spread for bluechip collections has gotten very tight with meaningful liquidity on both sides. Using the mid-price of bids and asks would be similar to how one determines price by looking at an order book trading system. To further reduce the risk of manipulation, a TWAP of the mid-price will be used, and the period of TWAP will be determined by the market activity / volatility.
To specifically address the needs of a NFT perpetual futures protocol, it is essential to strike a balance between managing risk of manipulation and ensuring market tracking speed (such that liquidations can occur in a timely manner). Let's consider the below 3 cases of market activity / volatility to pinpoint the desired behavior of such oracle:
- 1.Business as usual: the number of transactions happening is in line with normal market activity level, and the underlying market price or value remains relatively stable. In this case, the baseline TWAP period is preferred
- 2.Low market volatility: the number of transactions happening is much lower than usual and the underlying market price is very stable. In this case, a longer TWAP period is preferred as the underlying market price isn’t moving much and with market being inactive, and a longer TWAP period makes the oracle less prone to manipulation
- 3.High market volatility: the number of transactions happening is much higher than usual, and the underlying market price is very volatile. In this case, a shorter TWAP period is preferred as the oracle price should capture and track the underlying market movement more quickly, ensuring liquidations are done in a timely manner and other price alignment operations (i.e. funding rate and repeg) are being carried out according to the rapidly changing market conditions. Manipulation risk is less of a concern in market with high level of activity since the underlying market activity level is high (after filtering of wash trading is applied), so it is hard to manipulate the market even though TWAP period is shorter
To achieve a dynamic TWAP period, a baseline activity level is established over a lookback period and is compared with the actual number of transactions that happened over a comparison period. If the actual market activity level is higher than the baseline activity level, the TWAP period is decreased from the baseline TWAP period such that the oracle is more sensitive. If the actual market activity level is lower than the normal market activity, the TWAP period is increased from the baseline TWAP period to make the oracle less sensitive.
The mid-price is calculated every 10 seconds.
To calculate the mid-price, the listed floor price and the highest best offer are first fetched from major NFT marketplaces / aggregators including Blur, Opensea, LooksRare and X2Y2.
The fetched data is processed as follows:
The mid-price is then calculated:
Similar to fetching listed floor price and highest best offer, NFT transactions are fetched from major NFT marketplaces / aggregators. Certain transactions, such as wash trades and NFTs that are privately sold, are excluded.
The baseline activity level is established using the past 60 days data.
The NFT transaction data for the past 60 days is grouped into 24-hour intervals, and using the grouped data, the following values will be calculated:
- Median number of transactions (i.e.), which represents the normal market activity level
- Max volume multiple (i.e), which indicates how much more active the market could get compared to the normal market activity level
The calculations are as follows:
The base activity level is then compared with the number of transactions done in the last 24 hours (i.e.
) to see how much more / less active the current market is.
Conceptually, if the current market is more active than usual, the TWAP period is adjusted downwards from the base TWAP period (down to 15 minutes which is the minimum TWAP period). If the market is less active than usual, the TWAP period is adjusted upwards from the base TWAP period (up to 360 minutes which is the maximum TWAP period)
The extent to which the adjustment is made to the base TWAP period is determined by the following equation:
will then be applied to the
to obtain the adjusted TWAP period:
Based on the
, the oracle price is then calculated using the mid-price data fetched.