@gala-chain/api ∙ API
API > getNextSqrtPriceFromAmount1
Function: getNextSqrtPriceFromAmount1()
getNextSqrtPriceFromAmount1(
sqrtPrice
,liquidity
,amount
,add
):BigNumber
Gets the next square root price given a delta of token1.
Uses sqrtPrice ± amount / liquidity
.
Parameters
▪ sqrtPrice: BigNumber
The starting price, before accounting for the token1 delta.
▪ liquidity: BigNumber
The amount of usable liquidity.
▪ amount: BigNumber
The amount of token1 to add or remove from virtual reserves.
▪ add: boolean
Whether to add (true
) or remove (false
) the amount of token1.
Returns
The price after adding or removing the specified amount.