Bin Id From Price
As mentioned previously, it is possible to link a bin
to a price. It is also possible to perform the conversion in the other direction and thus link a price to a bin
. We provide examples to get the binId
from a price.
Conversion Functions
As the previous example, 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 price equal to 1.075, as both tokens have 18 decimals.
For second example, let's take BTC.b/USDC pair which has a binStep
of 10. To choose price equal to 30000 USDC / BTC.b we need to adjust it
Last updated