A Deep Dive into the Liquidity Book

SteakHut Finance
6 min readDec 5, 2022

--

The Liquidity Book is the new Automatic Market Maker (AMM) from Trader Joe, the leading DEX on Avalanche. Liquidity Book brings new features onto the AMM scene including:

  • Concentrate Liquidity
  • Liquidity Bins
  • Volatility Accumulator & Surge Pricing
  • Composability

These features create the most efficient AMM in the market, and a new primitive for next-generation DeFi projects to build on top of the Trader Joe DEX.

Concentrated Liquidity

When providing liquidity on traditional AMMs, like UniswapV2, the liquidity will be split across the whole price range. This means each asset will be equally distributed from a price of zero-infinite. The advantage of this design is it makes providing liquidity super simple since users don’t have to worry about price range. It also pioneered AMMs at the time, allowing a market to be made for any asst.

But the downfall of this design is it super inefficient because most of the time the price of assets in the pool moves in the small price range, leaving capital largely underutilized.

Traditional AMMs like Uniswap V2 are built based on the constant product formula (x*y = k). Where X is the quantity of asset X, Y is the quantity of asset Y and K is constant.

Concentrated liquidity is the method of providing liquidity within a specific price range, allowing users to choose the range where they want to put their liquidity to work. This allows assets to be focused at a specific price, such as the current market price, instead of being evenly distributed from zero to infinity. Concentrated liquidity enables the pool to behave as if it has more liquidity than it actually does.

The benefits of this design are that it allows capital to be used more efficiently and allows the pool to facilitate larger trades with minimal price impact. The downside is that it adds complexity to the user experience and liquidity providers may face increased impermanent loss as they provide liquidity within a narrower price range.

Liquidity Bins

Liquidity Book introduces the concept of Liquidity Bins. Bins are used to concentrate liquidity and facilitate the market. The bin’s unique features are:

  • Fixed price
  • A single “Active Bin”
  • Constant Sum Formula
  • Zero slippage

Fixed price range

Each bin in Liquidity Book has a fixed price attached to it. This separates one bin from another bin. Allow liquidity providers to choose the price range they want to provide liquidity by choosing bins.

Each bin has a fixed price range with various liquidity depths depending on LPs

Active Bin

In Liquidity Book there are many bins within a single pool, each consisting of one asset either X or Y. But there is only one bin that will have both assets in it, this bin is called the “Active Bin.”

This bin is called the active bin because it is the bin that is actively being traded at any given moment. The other bins, which contain only one asset (either X or Y), are called inactive bins. The active bin is constantly changing as trades are made, and the assets in the active bin are constantly being traded.

Only liquidity in an active bin is earning swap fees from swaps made by traders.

Constant Sum Formula

The formula Liquid Book use within each bin is a Constant Sum Formula (x+y = k). This enables zero slippage swap, as long as the price stays in the same bin.

While Liquidity Book uses constant sum formula within the bin, it still makes use of a constant product formula (x*y=k) to determine the price between bins. As a result, slippage only occurs when liquidity moves between bins, and the AMM is able to accommodate any swap.

Zero slippage

In the Liquidity Book, Each bin functions as a constant sum pool with its own liquidity reserves, unlike traditional AMM designs that use a constant product formula. This traditional approach calculates pricing using pool reserves, which often result in traders paying more for fewer tokens.

The price in Liquidity Book is derived from an active bin and remains constant within the bin. This means that if a trade uses reserves from the active bin, the trade will be executed without slippage. The price impact only occurs when a trade requires a change in the active bin, which happens when the reserves in the current bin are not sufficient to fulfill the trade. This feature is particularly useful for swaps between stablecoins and other pegged assets, as their prices are typically expected to be equal to each other.

Volatility Accumulator & Surge Pricing

Volatility Accumulator

The volatility accumulator is the mechanism for the Liquidity Book AMM to track market volatility in real time. This happens internally without the need to rely on an external oracle.

1. Volatility Accumulator decrease as the market stabilizes | 2. Volatility Accumulator increase as the market gets more volatile.

It works by calculating parameters taking the bin distance and time into consideration, This allows it to develop volatility parameters as the market price moves rapidly and decays as the market price stabilizes.

This in itself doesn’t translate into a user-facing feature, but it works in tandem with other features to mitigate impermanent loss for LPs.

That feature is called Surge pricing.

Surge Pricing

Liquidity Book allows liquidity provider fees to be dynamically adjusted instead of fixed. This is to mitigate LPs from losing money to impermanent loss as the price of the two assets in the pool diverges from the initial price range. It adjusts fees based on swift market movement, making LPs more fees in volatile market conditions.

More fees to LPs during volatile markets.

Surge Pricing is the feature that increases liquidity provider fees based on market volatility. This was made possible by using data from the volatility accumulator to increase the fee from the base fee. The more volatile market the more fee is increased, but this also has its own limits to prevent traders from paying excessive fees.

Composability

Liquidity Book chooses a different method to represent its LP position, by using an ERC-1155 standard rather than ERC-721. This has two major benefits

  1. The first major benefit is very direct. As ERC-1155 contracts support the efficient and secure management of multiple token types in a single contract, allowing for multiple token transfers in a single transaction and saving on gas fees compared to ERC-721 which is used in UniswapV3.
  2. It also allows for the LP position to be more composable. This means protocol can easily build on top by using Liquidity Book as a DeFi primitive.

SteakHut Liquidity

Providing liquidity on the Liquidity Book can earn you a higher yield, but it also requires significant time and attention. For everyday users, this can be a challenging and stressful process, as they simply want to maximize their earnings.

SteakHut Liquidity allows users to reap all the benefits of the liquidity book but in a set-and-forget way.

SteakHut liquidity offers:

  • Easy and automated concentrated liquidity experience — This includes optimizing, rebalancing, and reinvesting. All automatically without user interaction.
  • Active liquidity provision — Allowing strategists to build actively managed vault strategies for Liquidity Book pools, based on their investment philosophy
  • Composability — SteakHut liquidity wraps positions in an ERC-20 standard. This allows SteakHut to act as “money lego” allowing other protocols to easily integrate LB positions on their own protocol.
  • Liquidity as a service — Protocols that owns their own liquidity can harness SteakHut liquidity to build a custom strategy for their own liquidity. Lending protocols can also use SteakHut LP tokens as collateral.

SteakHut liquidity is set to become the liquidity layer for TraderJoe’s Liquidity Book. Providing immense benefits to the Avalanche community with automated and optimized liquidity for all.

Written by, Pelano (SteakHut community team)

--

--