UNPKG
@kamino-finance/kliquidity-sdk
Version:
latest (8.4.0)
8.4.0
8.3.2
8.3.1
8.3.0
8.2.1
8.2.0
8.1.3
8.1.1
8.1.0
8.0.2
8.0.1
8.0.0
7.0.14
7.0.13
7.0.12
7.0.11
7.0.10
7.0.9
7.0.8
7.0.7
7.0.6
7.0.5
7.0.4
7.0.3
7.0.2
7.0.1
7.0.0
6.5.1
6.5.0
6.4.2
6.4.0
6.3.1
6.3.0
6.2.2
6.2.1
6.2.0
6.1.0
6.0.0
Typescript SDK for interacting with the Kamino Liquidity (kliquidity) protocol
kamino.finance
@kamino-finance/kliquidity-sdk
/
src
/
utils
/
raydium.ts
11 lines
(8 loc)
•
269 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
import
Decimal
from
'decimal.js'
;
export
function
priceToTickIndexWithRounding
(
price
:
number
):
number
{
const
tickIndex =
new
Decimal
(
Math
.
log
(
Math
.
sqrt
(price))) .
div
(
new
Decimal
(
Math
.
log
(
Math
.
sqrt
(
1.0001
)))) .
round
() .
toNumber
();
return
tickIndex; }