Id-from-price
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
Get 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 sSEI/SEI pair which has a binStep
of 5. We choose here a price equal to 1.075, as both tokens have 18 decimals.
Last updated