Skip to main content

Function: initPriceDecimals()

initPriceDecimals(price, precision): IInitPriceDecimalsReturn

Low level, logarithmic tick descriptor for a single price.

This is the primitive the whole tick system is built on. The tick is roughly price * 10^-precision, so it scales with magnitude and stays reasonable for any price (e.g. a sensible tick exists both at 1000 and at 0.001). The raw tick can be non-round for sub-1 prices (0.9 → 0.09); use cleanLogTick when you need a clean 1/2/5×10^k value for a UI stepper.

All monetary values are bigint, fixed-point scaled by TICK_FIXED_SCALE (use toFixedBigInt / fromFixedBigInt to convert at the boundary).

Parameters

price

bigint

The price to describe, fixed-point scaled.

precision

bigint = 4n

Tick precision (see TickType), a plain integer. Defaults to 4.

Returns

IInitPriceDecimalsReturn