Price From Bin Id
Conversion Functions
function getPriceFromId(binId: number, binStep: number): number {
/**
* Convert a binId to the underlying price.
*
* @param binId - Bin Id.
* @param binStep - binStep of the pair.
* @return Price of the bin.
*/
return (1 + binStep / 10_000) ** (binId - 8388608);
}def getPriceFromId(binId: int, binStep: int) -> float:
"""
Convert a binId to the underlying price.
:param binId: Bin Id.
:param binStep: BinStep of the pair.
:return: Price of the bin.
"""
return (1 + binStep / 10_000) ** (binId - 8388608)Example
getPriceFromId(8388755, 5)
>>> 1.0762487670087693Last updated