Skip to main content

calculateVirtualTokensWithBoundsFromX

@bidask-protocol/sdk


@bidask-protocol/sdk / calculateVirtualTokensWithBoundsFromX

Function: calculateVirtualTokensWithBoundsFromX()

calculateVirtualTokensWithBoundsFromX(priceLower, priceUpper, currentPrice, tokenXAmount): object

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

Parameters

priceLower

number

Lower price bound (p_a)

priceUpper

number

Upper price bound (p_b)

currentPrice

number

Current price (p)

tokenXAmount

bigint

Amount of token X

Returns

object

Object with virtualXAmount, virtualYAmount, and tokenYAmount

tokenYAmount

tokenYAmount: bigint

virtualXAmount

virtualXAmount: bigint

virtualYAmount

virtualYAmount: bigint