Price From Bin Id
In v2.2 each bin
holds the liquidity of the pair for a specific price range. Thus, it is possible to link a certain bin
to a price by using the id
of the underlying bin
. We provide examples to get the price from a binId
.
Conversion Functions
In order to link a binId
to a price it is necessary to know the binStep
of the underlying pair. Here is the conversion logic.
Example
Here is an example to illustrate the conversion function with the sAVAX
/AVAX
pair which has a binStep
of 5. We choose here a binId
equal to 8388755. Price returned doesn't need to be adjusted, as both tokens have 18 decimals.
For second example, let's take BTC.b/USDC pair which has a binStep
of 10. We choose binId
equal to 8394314.
Last updated