Ecosystem Highlight: Pyth Network
Unlocking the Full Potential of DeFi With Pyth Network and the Econia Protocol
As the premier venue for on-chain price discovery in the Aptos ecosystem, Econia provides a settlement engine that is unparalleled in performance and transparency. This back-end system forms the backbone of a comprehensive DeFi ecosystem with a range of products, including derivatives exchanges ranging from perpetual futures to options and more. These protocols enable users to take a position on assets that they do not directly custody, effectively hedging risk or even just achieving higher leverage than they otherwise could on spot markets.
But the implementation of on-chain derivatives markets has historically been limited by a data bottleneck.
With prices for many of today’s assets currently set in disparate centralized venues, developers seeking to build on-chain derivatives trading platforms face the headache of incorporating financial information from different sources and formats into one unified entry point. Once they do this, however, other builders can rarely benefit from their efforts, and the data-wrangling problem plays out again and again in various forms with bespoke solutions.
At the heart of the problem is a simple question — “What is the price?” — that simultaneously enables exotic products, while creating a massive demand for unified financial data.
Pyth Network: A Powerful Oracle Solution
Luckily for developers on the Aptos blockchain, however, Pyth Network is doing everything it can to help meet this demand through a powerful oracle network of first-class data providers at world-class institutions. This public good of high-quality open financial data enables developers to compose with other protocols like Econia as they build out derivatives trading platforms, without having to worry about integrating yet another API or websocket feed.
“The Pyth Network is dedicated to helping Web3 grow to where it needs to be. We’re excited for what Aptos can unlock for developers thanks to its incredible speeds and performance, and we look forward to supporting new projects building on Aptos and Econia with reliable, high-fidelity price data”, said Mike Cahill, a Director of the Pyth Data Association.
Utilizing Econia and Pyth Data for Perpetual Exchanges
One example includes Aptos-based perpetual exchanges. A perpetuals DEX can utilize the Econia order book as a matching and settlement layer while using Pyth oracle data to determine the fair and historical value of underlying assets to calculate:
Funding Rates: Funding rates are the periodic fees charged to traders to maintain their positions.
- The funding rate is calculated based on the difference between the perpetual contract’s price and the underlying asset’s index price.
- A perpetuals exchange can use Pyth’s low-latency price feeds to obtain the most up-to-date index prices and calculate the funding rates accordingly.
Margin Requirements: Margin requirements are the minimum amount of collateral required to open and maintain a position.
- An exchange can use Pyth’s price feeds to calculate the current market value of the collateral and the underlying asset, and apply a margin requirement based on the desired level of leverage.
- This calculation can be done in real-time to ensure that margin requirements are always up-to-date.
- Pyth also provides Confidence Intervals to inform protocols about price uncertainty or divergences across market venues. This data empowers lending platforms to respond to market volatility and uncertainty accordingly when determining when to liquidate.
Liquidation Prices: Liquidation prices are the prices at which a trader’s position will be automatically liquidated if the market moves against them.
- An exchange can use Pyth prices to monitor the current market price of the underlying asset and calculate the liquidation price based on the trader’s leverage and margin requirements.
- This calculation can be done in real-time to ensure that liquidation prices accurately track the markets.
Integrating Econia and Pyth Data for Borrowing and Lending
Another exciting integration idea which utilizes Econia’s order book engine and Pyth data feeds is borrowing and lending. As of today, successful money markets protocols are pool-based and not order-book based due to architectural complexity. However, the latter approach does provide significant benefits:
Better price discovery: In order book-based protocols, borrowers and lenders can set their own interest rates, which means that the market can accurately reflect the supply and demand for the asset being borrowed or lent.
Greater liquidity: Order book-based protocols tend to have greater liquidity than pool-based protocols. This is because in a pool-based protocol, liquidity is determined by the size of the pool, which can be limited.
Better risk management: Order book-based protocols can offer more robust risk management tools than pool-based protocols.
Building the Future of DeFi Together
Now that Pyth has provided a groundbreaking on-chain oracle solution, there is a path forward for the broader Aptos DeFi ecosystem to build out perpetual futures exchanges on top of Econia’s lightning-fast order book infrastructure.
With its source code audited and published on testnet, the Econia Labs team is building out assorted SDKs and developer tooling as well as a reference front-end. Now is the time for projects to start integrating at the contract level and work their way up the dependency stack alongside Econia Labs, so everyone can go live together.
Many developers have undoubtedly seen the explosive growth of perpetual exchange volume over the first quarter of 2023. We hope these recent trends may inspire builders looking to build on the Econia order book while leveraging Pyth’s low-latency market data.
Let's build the future of DeFi, together!
Integrating with Pyth data is seamless and straightforward. You can consult this guide for how to get started with Pyth on Aptos or jump straight into the Pyth documentation section available on the Econia developer website.
Pyth Resources:
Econia Resources: