Surge Pricing

Surge Pricing: improving swaps and protecting liquidity providers

The cryptocurrency sector is notorious for its intense volatility, with double-digit price fluctuations within a single day being commonplace. This environment can be lucrative for traders but poses significant risks for those providing liquidity on decentralized exchanges.

Impermanent Loss (IL) — the disparity between the performance of an LP position and simply holding the assets in your wallet — is a primary concern for liquidity providers. They face limited control over pricing and even less over the fees they earn for their services. These fees are typically set by the exchange, with 0.3% considered an industry standard.

Yet, this standard fee is often insufficient to offset the IL, particularly with volatile asset pairs. This is where Moe Trade new Liquidity Book comes in.

Every time someone uses Liquidity Book to swap tokens, they are charged a flat Base Fee. In times of high volatility, an additional fee is levied through a Surge Pricing mechanism, calculated using two key factors:

  • Bin Step - variable set at the initialisation of the pair. It defines the price difference between each of the bins.

  • Volatility Accumulator - a novel counter introduced by the Liquidity Book to track on-the-spot pair volatility.

Bin step

The Bin Step defines price increase or decrease for each bin in basis points. One basis point (BPS) is equal to 0.01%. For example, having a bin step of 20 BPS means that the price of each bin in the pair differs by 0.2%.

Consider a MOE-USDC pair with a bin step of 10 BPS created when MOE was worth $15. If the price moves up one bin, it will be worth 15.015 (15*1.001); if it moves down one bin, it will be 14.985 (15*0.999).

For volatile pairs, it makes sense to have a relatively high bin step to allow for bigger price movements. Conversely, smaller bin steps are more useful for pairs like USDC.e-USDC that are expected to trade within a might tighter range. Incorporating the bin step into Surge Pricing calculations allows Liquidity Book to tailor to different volatility expectations across pairs.

Volatility Accumulator

The Volatility Accumulator (VA) is one of the most significant innovations of the Liquidity Book. It enables real-time volatility assessment for each pair without delays.. For each swap, it counts how many bin changes occurred during it (denoted by k). Depending on how much time passed since the last transaction, it then either:

  • Decays - multiply the current count by the reduction factor R, which is set to a value between 0 and 1, then adds k to it;

  • Increases - adds k to the current count;

  • Resets - sets current to k.

The exact behavior is governed by the contract's upper and lower time limits. If the interval between two consecutive transactions is smaller than the lower time limit, the Volatility Accumulator increases. If it is larger than the upper time limit, it resets. Otherwise, the accumulator decays.

It is important to note that the Volatility Accumulator takes the direction of trades into account when they occur below the lower time limit. Quick successive buys and sells have offsetting effects on the Volatility Accumulator.

Consider an example in which someone sells tokens resulting in the price going five bins down. Instantly, another person buys the same tokens leading to the price going four bins up. As a result, the net change in the Volatility Accumulator would be the same as the one for a sale that crosses one bin.

Volatility Accumulator Example

Let’s say that the MOE-USDC pair's lower time limit is 10 seconds and the upper limit is 10 minutes. Four traders are using this pair to buy and sell tokens:

It’s important to note that because k records bin crossovers one by one, each bin's volatility accumulator is calculated separately. For instance, in step 3, VA is 4.5 at the third bin. It will, however, be 1.5 at the starting bin, 2.5 at the next one and 3.5 when the swap crosses the second bin.

While this is a very simple example, it is easy to see how Volatility Accumulator adjusts to market participants' actions to reflect current volatility levels accurately.

Conclusion

If many swaps occur in short succession, indicating increasing levels of uncertainty in the market, the Volatility Accumulator will ramp up. In turn, this will result in a higher fee on each swap. These fees benefit Liquidity Providers, potentially enabling them to surpass market performance or mitigate IL losses.

Because there is no reliance on external oracles or time-bound observations, the Volatility Accumulator can measure instantaneous volatility. This way, even a couple of swaps are enough for the Surge Pricing to kick in. So liquidity providers can benefit from extreme volatility and usual activities such as bots arbitraging pools.

This unique feature is made possible by the Liquidity Book’s architecture and would be impossible elsewhere. Moreover, all elements of the Surge Pricing calculations are customizable, allowing the protocol to adapt and change over time. Upper and lower time bounds can change, and a maximum limit can be set for the accumulator to prevent it from growing out of proportion.

Incorporating Surge Pricing into the Liquidity Book not only shields providers during volatile periods but also allows for reduced fees during normal market conditions. This results in competitive swap rates alongside the inherent low slippage of the Liquidity Book.

Last updated