New Feature Introduction: Adaptive Trading Fees

HMX Marketing
HMX.org
Published in
3 min readDec 6, 2023

Dear Dragons,

One of the challenges for an oracle-based DEX is finding a robust price source for the listed markets. HMX has achieved this with Pyth. However, even with a robust price source, the potential issues related to oracle price are still not fully eliminated, especially on the lower market-cap and thinly traded markets.

At HMX, we have several measures in place to our liquidity providers.

  • Max Trade Size — limit the maximum size per trade to prevent potential exploits from a single large trade from asymmetric info
  • Adaptive Price — augment oracle price (premium or discount from mark price) based on how the trade impacts Open Interest skew

While these two features have served us well in the past, the Adaptive Trading Fee will take our security to the next level and improve user experience at the same time as it enables us to:

  • List more crypto markets including ones with lower market cap
  • Increase Max trade size

Read on to understand how we are able to achieve this…

Adaptive Trading Fees Model 📈

HMX currently charges a flat trading fee ranging from 0.01% — 0.07%, depending on the markets and asset classes. With our new Adaptive Trading Fee (ATF), the formula for the total trading fee becomes:

  • Total Trading Fee = Fixed Fee + ATF

where,

  • sizeDelta: user’s trade size
  • epochDelta: cumulative trading volume (same side of user’s trade only) during the epoch
  • liquidityDepth: cumulative 1% bid / ask for that market on Binance
  • k1 and k2: protocol-defined constants

Don’t let the complex formula scare you. Basically, what it aims to do is to adjust the trading fee based on:

  • Your trade size relative to the CEX’s orderbook liquidity depth
  • Volatility of the asset
  • How much of that asset has been traded recently on HMX (i.e., total trade volume of the asset in the last 15 minutes)

The formula takes an exponential form, which means the fee will grow exponentially based on the trade size. So users who execute small — medium size trade will not see any material impact from the adaptive trading fee. We also set a maximum fee to 1%. That means regardless of all the variables, the maximum fee that can be charged is 1%.

Let’s look through an example, so we understand how the formula works better.

Example

Alice wants to open a Long ARB position with a size of 300,000 USD

  • 1% Ask orderbook depth = 750,000 USD (i.e., market buy order of 750k USD would move the price up 1% on Binance)
  • epochDelta = 0; (Alice is the first to trade in the 15-min window)
  • Volatility of ARB is 0.0035
  • k1 = 0.5; k2 = 0.02
  • ARB’s fixed trading fee = 0.07%

Plugging all the values into the formula, we see that the adaptive fee for Alice is 0.052% so her total fee to pay will be 0.07% + 0.052% = 0.122%.

The graph below shows how the total fee would look for Alice, based on her trade size. As you can see, if Alice’s trade is < ~$100,000 USD, her trading fee will be roughly just 0.07% (no impact from ATF), and the max 1% fee is hit if her trade is > ~$620k USD.

Affected Markets 〽️

With this change, we will be able to increase the max trade size of existing markets and list many more tokens outside of the top50! You can find the updated trade size in our Docs. Trading fee discount and referral rebates will be calculated based on the fixed portion of the fee only.

Timeline

The adaptive trading fees will go live on 7 December 2023. We will gradually add more markets over time so be sure to let us know which tokens you would like us to add in our Discord group.

WebsiteDocs | TwitterTelegramTelegram AnnouncementMediumDiscord

--

--