Ticks Insight #1 Ticks break up the continuous finite price curve into a curve with evenly spaced discrete points.
Each discrete point represents a specific price at which trades can occur.
Ticks Insight #2 The gap between two adjacent ticks - called tick spacing - is the smallest relative price movement possible for a given pair of assets in a pool.
Ticks <> Prices
The relative price of an asset at a given tick is represented by this neat little equation:
Ticks represent price based on the price of Token 0
relative to Token 1
.
The sorting of token based on lexicographically sorting their contract addresses.
If A
is 0x000..
, while B
is 0x123..
then A
is Token 0
and B
is the Token 1
.
💡 Uniswap v4 has support for pools with native tokens
1.0001
was chosen because for each tick, the relative price moves by 0.01%, this movement is called a basis point or bps.
Basis Point | Percentage |
---|---|
1 | 0.01% |
10 | 0.10% |
50 | 0.50% |
100 | 1.00% |
275 | 2.75% |
400 | 4.00% |
1000 | 10.00% |
ticks stored in int24 the MIN_TICK and MAX_TICK are in range [-887_272, 887_272] |
Liquidity Math
Q64.96 Number
Q64.96 is a way represented rational numbers that uses 64 bits for integer part and 96 bits for fractional part
For example: 1.000234 * 2^96
= 79246701904292675448540839620.378624
how this works, take a look at getSqrtRatioAtTick
and getTickAtSqrtRatio
LINK