calculatePriceBounds
@bidask-protocol/sdk / calculatePriceBounds
Function: calculatePriceBounds()
calculatePriceBounds(
tokenXAmount,tokenYAmount,virtualXAmount,virtualYAmount):object
Extracts price bounds (p_a and p_b) from token amounts and virtual token data. This is the inverse operation of calculateVirtualTokensWithBoundsFromX/Y. The current price is calculated from the relationship: Y = p(X + x_v) - y_v
Parameters
tokenXAmount
bigint
Amount of token X (X)
tokenYAmount
bigint
Amount of token Y (Y)
virtualXAmount
bigint
Virtual amount of token X (x_v)
virtualYAmount
bigint
Virtual amount of token Y (y_v)
Returns
object
Object with priceLower (p_a) and priceUpper (p_b)
priceLower
priceLower:
number
priceUpper
priceUpper:
number