Documentation ¶
Index ¶
Constants ¶
View Source
const ( MaxTick int64 = 262143 // Equivalent to 2**18 - 1 MinTick int64 = -MaxTick // Equivalent to -2**18 + 1 Offset int64 = 262144 // Equivalent to 2**18 )
Variables ¶
This section is empty.
Functions ¶
func PriceToTick ¶
PriceToTick converts the price to tick, it will return the nearest tick that yields less than or equal to the given price. ref: https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation
func TickToPrice ¶
TickToPrice converts the tick to price with 10^9 precision. It will return an error if the tick is out of range or the tick is so large that cannot be converted to uint64. NOTE: the result is rounded up to the nearest integer, this is aligned with the UniswapV3 calculation.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.