0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

How to Estimate Output Across Solana Liquidity Bands

0
Posted at

To estimate output across liquidity bands, price the trade one band at a time, then add the results. A larger trade can receive a worse average price because it uses up the liquidity nearest the current price.

What is a liquidity band?

A liquidity band is a stretch of prices where a pool has a certain amount of active liquidity. Liquidity means the tokens available to trade at those prices. In a concentrated liquidity pool, providers choose price ranges for their funds, so available liquidity can change as the price moves.

A tick is a marked price boundary between bands. Within one band, the pool uses the same active liquidity to work out how a swap changes the price. When the price reaches a tick, the pool updates its active liquidity to reflect which provider ranges now cover the price.

This is why one average price estimate can mislead. The first part of a trade may use a deep band, while the rest moves through thinner bands and receives less output per token.

How do you estimate a trade that crosses bands?

Follow the trade from its starting price to each next tick. For each stretch, estimate how much input reaches that boundary and how much output it buys. Stop when the input runs out, then add the output from every stretch.

For example, imagine a swap of 100 units of token X into token Y. In an illustrative pool, the first band uses 40 X to produce 39.6 Y before its boundary. The next uses 35 X for 33.6 Y, and the final 25 X for 22.5 Y. The estimated gross output is 95.7 Y.

Those figures are example quote results, not a universal conversion formula. A pool’s quote calculation uses its current price and active liquidity for each band. It also applies the pool’s trading fee, usually to the input amount; if the example fee were 0.3%, that would be 0.3 X, with the exact output depending on how the pool applies it.

Byreal is a Solana decentralized exchange incubated by Bybit, where concentrated liquidity shapes the price available across bands. The Byreal token swap is one way to get a quote for a trade; byreal.org is the service’s official app.

What can make the estimate differ from your result?

The main edge case is a tick with little or no liquidity just beyond it. The quote may worsen sharply there, even if the current band looks deep. Check how much of your input is expected to cross each boundary, rather than judging only from the starting price.

Fees and price movement also affect the final amount. A quote is based on the pool state when it is calculated, and another trade can change that state before yours lands. Token decimals—the number of digits used to represent fractions—also matter when reading raw pool data, so compare amounts in human-readable token units.

For a hands-on estimate, get a current quote, note the expected output, then compare it with the pool’s price and liquidity across the route. If you use data tools such as the Byreal SDK, treat the quote as a snapshot and account for fees and rounding.

Takeaway: split the input at each price boundary, add the output slices, and include fees.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?