UNPKG

@kamino-finance/kliquidity-sdk

Version:

Typescript SDK for interacting with the Kamino Liquidity (kliquidity) protocol

11 lines (8 loc) 269 B
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; }