HydraSwap
Published in

HydraSwap

Hydra Market Making (HMM) Backtest

Finding the right balance between LPs & Arbitrageurs

In this article we look at the performance of Hydra Market Maker (HMM) with different compensation parameters to determine an optimal pricing/hedging setup for LPs within the HMM framework.

A quick recap, HMM introduces a parameter on top of the constant product market maker (CPMM) that takes into account an oracle price input to make a more informed pricing decision. The ‘C’ value tries to adjust the price closer to the oracle price only IF the CPMM price is better than the oracle price. In other words, ‘C’ controls how much LPs are looking to compensate themselves vs incentivizing arbitrageurs for rebalancing the liquidity pools. ‘C’ can range from 0 to 2. When C=0, the HMM price is exactly the same as CPMM and LPs are aggressively trying to incentivize arbitrageurs. When C=2, then the HMM price is the lower of the CPMM and oracle price. You can refer to our earlier post on HMM for more details.

CPMM and Lower C values incentivize arbitrageurs aggressively in order to rebalance liquidity pools. But they expose the AMM to negative selection of trades and give away too much PnL to arbitrageurs diminishing the returns of the AMM pools. Higher C values aim to protect LPs from the above pitfalls but if it’s too conservative it could hurt overall trading activity and result in lower fees for LPs. There is a sweet spot in between, which is different for different asset types. In the below backtests we aim to find this sweet spot where we maximize LP returns while enabling healthy trading activity. The idea is that by enhancing LP returns we would be able to attract more passive liquidity providers, which would ultimately result in greater depth and more reliable trading for DeFi users. We look at three different categories of tokens — mainstream, mid-cap and stablecoins and propose optimal ‘c’ values for these. We leave out small-cap tokens for now given unreliable market data.

Backtest Setup

Token Pairs:

  • Mainstream/large-cap Token: BTC/USDT, ETH/USDT
  • Mid-cap Token: BNB/USDT, SOL/USDT
  • Stablecoins: USDC/USDT, USDT/DAI

Market Price tick: Every 1 min

Starting Time = 1/Jan/2021

End Time = 31/Jul/2021

For mainstream and mid-cap tokens, we assume a 0.3% fee for HMM and 0.6% margin requirement for profitable arbitrage. For stablecoins, we assume a 0.05% fee for HMM and 0.1% margin requirement for profitable arbitrage. The backtest also makes the assumption that every trade is an arbitrage transaction and takes place only when the HMM price is out of line and the margin requirement is satisfied.

The higher the C is, the less likely that arbitrageurs will find profitable arbitrage and therefore they are less likely to trade. However, the margin on each trade will be higher for LPs compared to CPMM (same as HMM with C=0). To maximize the returns for LPs in total, there should be a C somewhere between 0 and 2 so that it achieves the maximum product of a number of trades and average margin per trade.

Results

Below are the backtest results for different token types.

BTC/USDT:

ETH/USDT:

BNB/USDT:

SOL/USDT:

USDC/USDT:

For USDC/USDT, we assume 500 x leverage with concentrated liquidity, matching the 0.996/1.004 price range, which was the range of price movement since the start of the year.

USDT/DAI:

For USDT/DAI, we assume 200 x leverage with concentrated liquidity, matching the 0.99/1.01 price range, which was the range of price movement since the start of the year.

Results Discussion

HMM with c>0 shows significant p&l improvements for LPs. With optimal ‘c’ values, large-cap and stable-coin LPs can expect returns greater than twice of simple constant product AMMs (like uni v2). For slightly more volatile mid-cap tokens, we can see that HMM can enhance returns to upto 4x.

For large cap tokens, a ‘c’ value of 1.5 with HMM enhances the returns by over 2x. As the c value increases, there are diminishing returns from HMM as the pricing starts to get conservative. Given, in practice we will encounter users apart from pure arbitrageurs, we propose to keep the c value 1.25 for large-cap tokens. This is to err on the side of showing better pricing and higher volumes while still seeing significant return improvement for LPs.

For mid-cap tokens which are more volatile than large cap tokens, we see an even greater improvement from introducing HMM. In the case of BNB, we see LP returns increase to 5x with c=1.9 vs CPMM (c=0)! We propose a ‘c’ value of 1.5 for mid-cap tokens which is less than 1.9 seen in backtests. This is for the same reasoning as mentioned above in the case of large-cap tokens.

For stable coins, we see best results at c=1 and propose to keep the same under HMM.

About HydraSwap

HydraSwap is a Solana DEX powered by an on-chain intelligent and high-performance AMM focused on maximizing the returns for Liquidity Providers. Our vision is to create an AMM that matches the pricing sophistication and returns of specialized market makers.

Telegram Chat | Telegram Announcement | Twitter | LinkedIn | Discord | Website

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Hydra

Hydra

217 Followers

HydraSwap is building a next-gen DEX powered by a superior AMM focused on Liquidity Providers. By empowering liquidity providers we will make DEX liquidity CEXy