TickMath
Contains the math to compute corresponding ticks and square root ratios (i.e. price).
GitHub File: tickMath.ts
Properties
Public
Property | Type | Modifier | Description |
---|---|---|---|
MIN_TICK | number | static | The minimum tick of the pool. |
MAX_TICK | number | static | The maximum tick of the pool. |
MIN_SQRT_RATIO | static | The square root ratio (i.e. price) corresponding to the minimum tick. | |
MAX_SQRT_RATIO | static | The square root ratio (i.e. price) corresponding to the maximum tick. |
Constructor
Private constructor that cannot be constructed.
Methods
getSqrtRatioAtTick() - public
static
public
static
Computes the square root ratio (i.e. price) at the specified tick.
Parameters
Params | Type | Description |
---|---|---|
tick | number | The tick for which to compute the price. |
Returns
Type | Description |
---|---|
The square root ratio at the specified tick. |
getTickAtSqrtRatio() - public
static
public
static
Computes the tick corresponding to the specified square root ratio (i.e. price).
Parameters
Params | Type | Description |
---|---|---|
sqrtRatioX96 | The square root ratio (i.e. price) at which to calculate the corresponding tick. |
Returns
Type | Description |
---|---|
The tick corresponding to the square root ratio. |
Last updated