Skip to content

@gala-chain/apiAPI


API > getAmount0Delta

Function: getAmount0Delta()

getAmount0Delta(sqrtPriceA, sqrtPriceB, liquidity): BigNumber

Gets the amount0 delta between two prices.

Calculates liquidity / sqrt(lower) - liquidity / sqrt(upper), i.e., liquidity * (sqrt(upper) - sqrt(lower)) / (sqrt(upper) * sqrt(lower)).

Parameters

sqrtPriceA: BigNumber

A square root price.

sqrtPriceB: BigNumber

Another square root price.

liquidity: BigNumber

The amount of usable liquidity.

Returns

The amount of token0 required to cover a position of size liquidity between the two passed prices.

Source

chain-api/src/utils/dex/sqrtPriceMath.helper.ts:30