Skip to main content

calculateVirtualTokensWithBoundsFromY

@bidask-protocol/sdk


@bidask-protocol/sdk / calculateVirtualTokensWithBoundsFromY

Function: calculateVirtualTokensWithBoundsFromY()

calculateVirtualTokensWithBoundsFromY(priceLower, priceUpper, currentPrice, tokenYAmount): object

Calculates virtual token amounts and auto-completes tokenX based on price bounds and tokenY. Formula from: "Фиксируем границы, цену, Y (надо найти x_v, y_v и автокомплитнуть X)"

Parameters

priceLower

number

Lower price bound (p_a)

priceUpper

number

Upper price bound (p_b)

currentPrice

number

Current price (p)

tokenYAmount

bigint

Amount of token Y

Returns

object

Object with virtualXAmount, virtualYAmount, and tokenXAmount

tokenXAmount

tokenXAmount: bigint

virtualXAmount

virtualXAmount: bigint

virtualYAmount

virtualYAmount: bigint