πPricing (Oracles)
Reference and indexed price feeds for Blitz markets.
Oracles play a crucial role in a decentralized exchange (DEX), functioning as the pathway for Blitzβs on-chain contracts to access existing data sources (e.g., prices) off-chain and execute advanced computations on-chain.
Blitzβs high-performance exchange design requires an oracle architecture developed for ultra-low-latency and robust oracle feeds across the long tail of market pairs.
On a performant DEX, oracles need to deliver price feeds for each market on the exchange with several core properties, including:
Decentralized
Robust
Low-Latency
Cost-Efficient
Price feeds for various exchange assets help calculate intricate functions, including account collateralization, perpetual funding rates, and more. Oracle price referencing also needs to maintain redundancy across data publishers, meaning that data feeds are defensible to stale prices from reference providers (e.g., third-party exchanges) and can operate without a single point of failure.
The Blitz DEX employs a multi-oracle approach where prices are ingested from different providers. Currently, the majority of Blitz markets use Stork.
However, Blitz is also integrated with Chainlink's Low-Latency Data Streams. The high-fidelity, sub-second market data from Chainlink will help secure liquidations, funding rates, and profit / loss calculations for supported markets in tandem with Stork.
03/11/2024: Blitz will utilize Chainlink's Data Streams to support ETH markets. But the use of Chainlink will eventually grow to support multiple markets.
For more information on the Blitz integration of Chainlinkβs Data Streams, please refer to the original Vertex integration announcement with Chainlink below.
Stork is an ultra-low-latency, decentralized, hybrid oracle network for EVM-compatible price feeds.
Storkβs oracle architecture prioritizes performance, congruent with Blitzβs low-latency order-matching and emphasis on CEX-grade execution speeds.
Using ultra-fast WebSockets across multiple regions and node providers, Stork can ensure that Blitzβs reference prices are available on the millisecond level, comparable to the data velocity used on CEXs and TradFi exchange venues.
Stork also empowers Blitz with its hybrid on / off chain architecture, unlocking the ability to perform initial processing off-chain and subsequently push price updates on-chain specific to each product β such as perpetuals.
With the off-chain Vertex Edge sequencer, price updates are bundled off-chain with each sequence of actions submitted before being pushed on-chain, enabling continuous reference prices at lower costs and computational complexity.
This is necessary for a performant DEX relative to other, pure on-chain oracle providers that push price updates less frequently.
Scarcer price updates in pure on-chain oracle models reduce the ability to support long-tail assets where gas fees are not justified relative to the on-chain demand for the corresponding asset.
Less frequent price updates also do not function as effectively as hybrid on/off-chain oracle models amid significant market volatility.
With Stork, Blitz can achieve robust, low-cost, and high-performance price referencing and correlated on-chain calculations (e.g., perpetual funding) while minimizing pricing vulnerabilities across the long tail of assets.
Please refer to the official Stork documentation here for more information on their oracle architecture.
Blitz & Stork Oracle Architecture
Stork publishers and data sources are chosen for their ability to provide low-latency price updates reliably. The methodologies are chosen to enable Stork clients to achieve specific results and will evolve over time.
Each publisher can contribute an index price for the markets supported by Stork. Currently, implementing the index calculation is at each publisherβs discretion; ergo, not every publisher will converge their price.
On Blitz, three different oracle price feeds exist via Stork, all of which are instantaneous per market. These include:
Spot Oracle Prices (spot on centralized exchanges): The spot oracle prices from Stork comprise an index of the reference spot exchanges to price against Blitz perpetual products using a TWAP of the index price across the Median of the Last Trade Price from supported exchanges. Supported exchanges (exchanges with major USD or BUSD markets):
Binance
Coinbase Pro
Kraken
Perpetual Prices (centralized exchanges): Continuous LP-based perpetual prices. These serve as the reference prices for calculating funding for the perpetual futures.
A closed-loop funding rate option is used, where both the exchangeβs (i.e., Blitz's) own mark price and the spot index price TWAPs are captured by Stork.
This helps to reduce centralization and the cost of storing and computing the funding fee on-chain.
The Blitz Perpetual Index price is a volume-weighted perpetual price across supported exchanges, converted from USDT to USD using a volume-weighted average of USDC-USDT and BUSD-USDT spot markets.
Exchanges: Binance, ByBit, OKX.
Markets: Markets quoted in USDT and converted to USD using volume-weighted spot prices for USDC-USDT and BUSD-USDT markets.
Volume: Trailing four (4) hours trailing volume for each perpetual market.
Orderbook Price on Blitz: For liquidations, Blitz uses the Spot Oracle Price and the Perp Oracle Price to calculate a trader's account value. You can find the liquidation calculations here.
For funding, Blitz uses a TWAP of the Orderbook Price on Blitz (#3), known as the mark price, and a TWAP of the Spot Oracle Price (#1). More details on the funding rate calculations can be found here.
For an in-depth description of the Liquidation calculations, please refer to the Basics -- Liquidations & Insurance Fund section.
Unlike the index price, every Stork publisher follows the same calculation for the perpetual index price.
Funding Rate Calculations: The spot index price and Blitzβs perpetual contract price (e.g., mark price) calculate the funding rate.
Calculating Liquidations: The spot oracle price is used for liquidations. You can find the liquidation calculations here.
For liquidations, the Spot Oracle Price is what's utilized for liquidations and displayed on the Blitz front-end app.
An independent oracle price also exists for USDB, which allows for functional health calculations and trading behavior even in the case of USDB de-pegging.
NOTE: The Blitz front-end will always display prices quoted against USDB -- NOT USD). There are NO assumptions within Blitz where 1 USDB = 1 USD.
*Blitz removes the ability to submit relative orders, where trades are executed when the market price deviates X amount from the oracle price. This is because it significantly reduces complexity, and the use case of relative orders is niche.
Last updated