Pyth Case Study

HMX Exchange: Becoming a Leading Multi-Collateral and Cross-Margin Protocol

This case study shows how HMX leverages the breadth and freshness of Pyth oracle data to rapidly become one of the leading leveraged trading platforms on Arbitrum with multi-collateral support and cross-margining.

+5KUsers Onboarded
+40Markets Launched
+$12BCumulative Trading Volume
Blockchains:

“Pyth Network has been our exclusive oracle service provider at HMX since day one. Their remarkable technology, rapid market deployment, and receptive approach to incorporating team feedback have been pivotal reasons for our continued partnership with them. Their commitment to crafting the best product for the market is why we remain dedicated to working together.”

Shu Tsu WeiHead of Engineering, HMX
Pyth Network and HMX

Oracles for Pool-based
Decentralized Perpetual Protocols

Context

Security, speed, freshness, accuracy and diversity of data are paramount to building a multi-collateral cross-margin protocol for permissionless access to fair and effective risk management tools.

Challenge

HMX seeks to offer the most advanced risk management protocol while providing users with best-in-class experience and capital efficiency. This objective requires an oracle solution that enables pricing of risk and the HMX platform to scale without compromising on security.

Solution

Pyth and HMX worked intensively on a successful integration that leverages the Pyth oracle and Pythnet appchain to deliver fast and reliable data covering multiple asset classes. All data consumed on-chain on their platform is secure and can be cryptographically verified.

The Context

Building Unique Features for a Cross-Margin Perpetual Protocol

Fair pricing and effective collateral management are cornerstones to margin trading on perpetual protocols.

HMX is the only pool-based perpetual protocol that offers cross-margin collateral management while also allowing users to use multiple types of assets as collateral. These unique features enable traders to manage their portfolio and allocate their capital efficiently, with the security guarantees that come from a decentralized design.

Explore this case study to learn how Pyth Price Feeds empower HMX to increase the usability of perpetual futures in DeFi on Arbitrum.

The Challenge

Secure, Low-Latency Data for Fair Trading and Cross-Margining

In the realm of DeFi margin trading, traders have high demands for the protocols they use. More specifically, they expect trading platforms they interact with to:

Price trades in a fair, competitive manner — according to prices available on CEXs.

Enable leverage across different types of collateral across their whole portfolio and avoid the need to over-allocate collateral.

Smart derivatives-like perpetual contracts enable traders to easily access leverage — sometimes up to 100x or more. CEXs can attract significant fees with perpetuals since swap fees are charged on the leveraged notional amount. In DeFi, this dynamic makes perpetual DEXs relatively attractive investments as they can efficiently make returns to liquidity providers, while users can access such leverage with little capital.

Historically, DEXs have relied on slow oracles or have developed internal solution to fuel the protocol engine with price data. However slow and/or inaccurate data can expose users to adverse selection and temporal arbitrages (front and backrunning). The ability for protocols to fairly price swaps and collateral, reduce latency-related risks, and expand their markets and risk management logic is their key to success in a highly competitive industry.

The Solution

Accurate, Low-Latency Price Feeds From Pythnet

HMX's trading infrastructure utilizes price feeds through the Pythnet appchain to power its business logic and deliver an accurate and secure trading experience.

In 2022, Pyth introduced its Pull Oracle design which specializes in low-latency price updates and maintaining uptime during periods of volatility. Instead of regularly pushing price updates on-chain like most legacy oracles, Pyth empowers the HMX protocol to request or pull a new price from the Pyth protocol when needed. The architecture of the Pyth Pull Oracle brings several advantages:

Low Feesone of the cheapest fee structures in DeFi perpetual trading.

Performanceclose to real-time data to support chart analysis and accurate triggers.

Securityhigh-resolution data matching external markets to reduce front and backrunning risk.

Diversity of Assetsdiverse asset offerings and rapid availability of new price feeds to enable HMX to quickly list new crypto, forex, and commodities markets with the same quality guarantees.

Accelerated Adoption — HMX has accumulated more than $12B in volume traded and thousands of traders on Arbitrum safely and securely.

Discussion

Pyth Data is integral to the operations of the HMX protocol. Every user interaction with HMX uses Pyth prices:

When collateral is deposited, it is priced to define the leverage and margin allowed by the protocol. The parameters used by HMX for margin requirements and leverage allowed are also based on historical prices provided by Pyth.

For every trade action by the user, the Pyth oracle defines the execution price

Collateral coverage in terms of initial and maintenance margin is evaluated on ongoing basis based on marks provided by Pyth.

Liquidations are triggered based on the Pyth price when margin thresholds are breached and bad debt needs to be avoided.

In its future development, HMX may tap into liquidity data to adapt fees and evaluate the levels of open interest allowed for its 40+ markets. Readers can follow their socials to learn more.

Explore
HMX

Visit HMX to explore what the protocol offers and experience the benefits of Pyth Data firsthand.

Smart contract developers looking to build margin trading protocols can take inspiration from HMX's integration with Pyth Price Feeds.